This repository was archived by the owner on Jan 24, 2025. It is now read-only.
File tree 3 files changed +17
-4
lines changed
3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 1
1
import * as fs from 'fs-extra'
2
2
import * as path from 'path'
3
- import spawn from 'cross-spawn'
4
3
import sh from 'shelljs'
5
4
6
5
import * as paths from '../config/paths'
7
6
import { BuildFn } from '../lib/Bundler'
8
7
import { ensureFiles } from './machine/actions'
8
+ import { spawnSync } from '../utils/spawn'
9
9
10
10
export const build : BuildFn = async ( config , dist ) => {
11
11
const publicDir = path . join ( paths . docz , 'public' )
@@ -19,6 +19,6 @@ export const build: BuildFn = async (config, dist) => {
19
19
}
20
20
ensureFiles ( { args : config } )
21
21
sh . cd ( paths . docz )
22
- spawn . sync ( 'npm' , cliArgs , { stdio : 'inherit' } )
22
+ spawnSync ( 'npm' , cliArgs )
23
23
await fs . copy ( publicDir , dist )
24
24
}
Original file line number Diff line number Diff line change 1
- import spawn from 'cross-spawn'
2
1
import sh from 'shelljs'
3
2
4
3
import * as paths from '../config/paths'
4
+ import { spawnSync } from '../utils/spawn'
5
5
6
6
export const serve = async ( ) => {
7
7
const cliArgs = [ 'run' , 'serve' ]
8
8
sh . cd ( paths . docz )
9
- spawn . sync ( 'npm' , cliArgs , { stdio : 'inherit' } )
9
+ spawnSync ( 'npm' , cliArgs )
10
10
}
Original file line number Diff line number Diff line change
1
+ import crossSpawn from 'cross-spawn'
2
+
3
+ export const spawnSync = ( command : string , args ?: readonly string [ ] ) => {
4
+ const output = crossSpawn . sync ( command , args , {
5
+ stdio : [ 'inherit' , 'inherit' , 'pipe' ] ,
6
+ } )
7
+
8
+ if ( ! output . stderr ) {
9
+ return
10
+ }
11
+
12
+ process . exitCode = output . status || 1
13
+ }
You can’t perform that action at this time.
0 commit comments