@@ -8,23 +8,29 @@ import 'hard-rejection/register'
8
8
9
9
const argv = minimist ( process . argv . slice ( 2 ) )
10
10
11
- const { project, version } = argv
11
+ const { project, version, install , build } = argv
12
12
13
13
const exit = function exit ( ) {
14
14
console . log ( ...arguments )
15
15
process . exit ( 1 )
16
16
}
17
17
18
18
const runCmd = async ( cmd , path ) => {
19
- console . log ( chalk . underline ( `Running '${ chalk . green ( cmd ) } '` ) )
20
- const executedCmd = await execa ( cmd , { cwd : path , shell : true } )
19
+ console . log ( chalk . underline ( `Running '${ chalk . green ( cmd ) } ' in '${ path } '` ) )
20
+ try {
21
+ const executedCmd = await execa ( `cd ${ path } && ${ cmd } ` , { shell : true } )
22
+
23
+ if ( executedCmd . failed ) {
24
+ console . error ( executedCmd . stdout )
25
+ console . error ( executedCmd . stderr )
26
+ process . exit ( 1 )
21
27
22
- if ( executedCmd . failed ) {
23
- console . error ( executedCmd . stderr )
28
+ }
29
+ console . log ( executedCmd . stdout + '\n' )
30
+ } catch ( error ) {
31
+ console . log ( error )
24
32
process . exit ( 1 )
25
33
}
26
-
27
- console . log ( executedCmd . stdout + '\n' )
28
34
}
29
35
; ( async ( ) => {
30
36
if ( ! project || ! version ) {
@@ -55,11 +61,15 @@ const runCmd = async (cmd, path) => {
55
61
56
62
let buildDocs = async projDirPath => {
57
63
checkIfProjectDirExists ( projDirPath )
58
- await runCmd ( 'yarn' , projDirPath )
59
64
60
- console . log ( '\n\n' )
65
+ if ( install ) {
66
+ await runCmd ( project === 'ember' ? 'yarn' : 'pnpm install' , projDirPath )
67
+ console . log ( '\n\n' )
68
+ }
61
69
62
- await runCmd ( project === 'ember' ? 'yarn docs' : 'yarn workspace ember-data docs' , projDirPath )
70
+ if ( build ) {
71
+ await runCmd ( project === 'ember' ? 'yarn docs' : 'pnpm build:docs' , projDirPath )
72
+ }
63
73
64
74
const projYuiDocFile = `tmp/s3-docs/v${ version } /${ project } -docs.json`
65
75
removeSync ( projYuiDocFile )
0 commit comments