@@ -18,7 +18,7 @@ import {
1818 handleResponse ,
1919} from "../../utils/api" ;
2020import { getInferredApiKey } from "../../utils/constants" ;
21- import { hashDirectory } from "../utils/hash " ;
21+ import { hashDirectory as getFilePaths } from "../utils/files " ;
2222import { startVm } from "../../Sandboxes" ;
2323import { mkdir , writeFile } from "fs/promises" ;
2424
@@ -121,8 +121,7 @@ export const buildCommand: yargs.CommandModule<
121121 alias = createAlias ( path . resolve ( argv . directory ) , argv . alias ) ;
122122 }
123123
124- const { hash, files : filePaths } = await hashDirectory ( argv . directory ) ;
125- const tag = `sha:${ hash . slice ( 0 , 6 ) } ` ;
124+ const filePaths = await getFilePaths ( argv . directory ) ;
126125
127126 try {
128127 const templateData = handleResponse (
@@ -132,7 +131,7 @@ export const buildCommand: yargs.CommandModule<
132131 forkOf : argv . fromSandbox || getDefaultTemplateId ( apiClient ) ,
133132 title : argv . name ,
134133 // We filter out sdk-templates on the dashboard
135- tags : [ "sdk-template" , tag ] ,
134+ tags : [ "sdk-template" ] ,
136135 } ,
137136 } ) ,
138137 "Failed to create template"
@@ -209,10 +208,10 @@ export const buildCommand: yargs.CommandModule<
209208 updateSpinnerMessage ( index , "Writing files to sandbox..." )
210209 ) ;
211210
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 {
216215 const fullPath = path . join ( argv . directory , filePath ) ;
217216 const content = await fs . readFile ( fullPath ) ;
218217 const dirname = path . dirname ( filePath ) ;
@@ -221,9 +220,11 @@ export const buildCommand: yargs.CommandModule<
221220 create : true ,
222221 overwrite : true ,
223222 } ) ;
223+ } catch ( error ) {
224+ throw new Error (
225+ `Failed to write "${ filePath } " to sandbox: ${ error } `
226+ ) ;
224227 }
225- } catch ( error ) {
226- throw new Error ( `Failed to write files to sandbox: ${ error } ` ) ;
227228 }
228229
229230 spinner . start ( updateSpinnerMessage ( index , "Building sandbox..." ) ) ;
0 commit comments