Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 0df5525

Browse files
committed
Add cwd arg to sh
1 parent 17cb29d commit 0df5525

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

build/gulp/sh.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as childProcess from 'child_process'
22

3-
const sh = (command: string, pipeOutputToResult: boolean = false): Promise<string> =>
3+
const sh = (command: string, cwd?: string, pipeOutputToResult: boolean = false): Promise<string> =>
44
new Promise((resolve, reject) => {
55
const [cmd, ...args] = command.split(' ')
66

77
const options: childProcess.SpawnOptions = {
8-
cwd: process.cwd(),
8+
cwd: cwd || process.cwd(),
99
env: process.env,
1010
stdio: pipeOutputToResult ? 'pipe' : [0, 1, 2],
1111
shell: true,

build/gulp/tasks/bundle.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@ task('bundle:package:es', () =>
4545
)
4646

4747
task('bundle:package:types:tsc', () => {
48-
let cmd = 'tsc -b'
49-
if (process.cwd() === config.path_base) {
50-
cmd = `cd packages && cd ${packageName} && ${cmd}`
51-
}
52-
return sh(cmd)
48+
return sh('tsc -b', paths.packages(packageName))
5349
})
5450
task('bundle:package:types:copy', () => {
5551
return src(paths.packageDist(packageName, 'dts/src/**/*.d.ts')).pipe(

build/gulp/tasks/docs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ task('build:docs:toc', () =>
137137
task('build:docs:schema', () =>
138138
src(schemaSrc, { since: lastRun('build:docs:schema') }).pipe(
139139
through2.obj((file, enc, done) => {
140-
sh(`cd packages/ability-attributes && npm run schema`)
140+
sh('npm run schema', paths.packages('ability-attributes'))
141141
.then(() => done(null, file))
142142
.catch(done)
143143
}),

build/gulp/tasks/test-projects.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const log = (context: string) => (message: string) => {
2424
console.log('='.repeat(80))
2525
}
2626

27-
export const runIn = targetPath => cmd => sh(`cd ${targetPath} && ${cmd}`)
27+
export const runIn = targetPath => cmd => sh(cmd, targetPath)
2828

2929
const addResolutionPathsForProjectPackages = async (
3030
testProjectDir: string,

0 commit comments

Comments
 (0)