2
2
3
3
import { execSync } from 'child_process' ;
4
4
import { error } from 'console' ;
5
+ import { existsSync } from 'fs' ;
5
6
6
7
( ( ) => {
7
8
try {
@@ -23,25 +24,34 @@ import { error } from 'console';
23
24
*/
24
25
execSync ( `pnpm -C packages/versions build` ) ;
25
26
26
- // Invoke fuels' build:proxy script (will rewrite header versions in generated files)
27
- execSync ( `pnpm -C packages/fuels build:proxy ` ) ;
27
+ // Invoke recipes build script (will rewrite header versions in generated files)
28
+ execSync ( `pnpm -C packages/recipes build` ) ;
28
29
29
30
// Checks if the commands above generated git changes
30
31
const versionsFilePath = `packages/versions/src/lib/getBuiltinVersions.ts` ;
31
- const proxyDirPath = `packages/fuels/src/cli/commands/deploy/proxy` ;
32
+ const recipeDirPath = `packages/recipes/src` ;
33
+
34
+ // Ensure paths exist
35
+ const paths = [ versionsFilePath , recipeDirPath ] ;
36
+ if ( ! paths . every ( existsSync ) ) {
37
+ throw new Error (
38
+ `Paths do not exist: ${ paths . filter ( ( path ) => ! existsSync ( path ) ) . join ( ', ' ) } `
39
+ ) ;
40
+ }
32
41
33
42
const versionsChanged = ! ! execSync ( `git status --porcelain ${ versionsFilePath } ` )
34
43
. toString ( )
35
44
. trim ( ) ;
36
45
37
- const proxyChanged = ! ! execSync ( `git status --porcelain ${ proxyDirPath } ` ) . toString ( ) . trim ( ) ;
46
+ const proxyChanged = ! ! execSync ( `git status --porcelain ${ recipeDirPath } ` ) . toString ( ) . trim ( ) ;
38
47
39
48
// If they did, add and commit the changes
40
49
if ( versionsChanged || proxyChanged ) {
41
- execSync ( `git add ${ versionsFilePath } ${ proxyDirPath } ` ) ;
50
+ execSync ( `git add ${ versionsFilePath } ${ recipeDirPath } ` ) ;
42
51
execSync ( `git commit -m"ci(scripts): update versions"` ) ;
43
52
}
44
53
} catch ( err ) {
45
54
error ( err . toString ( ) ) ;
55
+ process . exit ( 1 ) ;
46
56
}
47
57
} ) ( ) ;
0 commit comments