@@ -18,7 +18,7 @@ import {
18
18
handleResponse ,
19
19
} from "../../utils/api" ;
20
20
import { getInferredApiKey } from "../../utils/constants" ;
21
- import { hashDirectory } from "../utils/hash " ;
21
+ import { hashDirectory as getFilePaths } from "../utils/files " ;
22
22
import { startVm } from "../../Sandboxes" ;
23
23
import { mkdir , writeFile } from "fs/promises" ;
24
24
@@ -121,8 +121,7 @@ export const buildCommand: yargs.CommandModule<
121
121
alias = createAlias ( path . resolve ( argv . directory ) , argv . alias ) ;
122
122
}
123
123
124
- const { hash, files : filePaths } = await hashDirectory ( argv . directory ) ;
125
- const tag = `sha:${ hash . slice ( 0 , 6 ) } ` ;
124
+ const filePaths = await getFilePaths ( argv . directory ) ;
126
125
127
126
try {
128
127
const templateData = handleResponse (
@@ -132,7 +131,7 @@ export const buildCommand: yargs.CommandModule<
132
131
forkOf : argv . fromSandbox || getDefaultTemplateId ( apiClient ) ,
133
132
title : argv . name ,
134
133
// We filter out sdk-templates on the dashboard
135
- tags : [ "sdk-template" , tag ] ,
134
+ tags : [ "sdk-template" ] ,
136
135
} ,
137
136
} ) ,
138
137
"Failed to create template"
@@ -209,10 +208,10 @@ export const buildCommand: yargs.CommandModule<
209
208
updateSpinnerMessage ( index , "Writing files to sandbox..." )
210
209
) ;
211
210
212
- try {
213
- let i = 0 ;
214
- for ( const filePath of filePaths ) {
215
- i ++ ;
211
+ let i = 0 ;
212
+ for ( const filePath of filePaths ) {
213
+ i ++ ;
214
+ try {
216
215
const fullPath = path . join ( argv . directory , filePath ) ;
217
216
const content = await fs . readFile ( fullPath ) ;
218
217
const dirname = path . dirname ( filePath ) ;
@@ -221,9 +220,11 @@ export const buildCommand: yargs.CommandModule<
221
220
create : true ,
222
221
overwrite : true ,
223
222
} ) ;
223
+ } catch ( error ) {
224
+ throw new Error (
225
+ `Failed to write "${ filePath } " to sandbox: ${ error } `
226
+ ) ;
224
227
}
225
- } catch ( error ) {
226
- throw new Error ( `Failed to write files to sandbox: ${ error } ` ) ;
227
228
}
228
229
229
230
spinner . start ( updateSpinnerMessage ( index , "Building sandbox..." ) ) ;
0 commit comments