Skip to content

Commit dac30b9

Browse files
committed
Fix Windows CI
1 parent f671fcb commit dac30b9

File tree

4 files changed

+17
-51
lines changed

4 files changed

+17
-51
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ cache: npm
77
os:
88
- linux
99
- osx
10+
- windows
1011
notifications:
1112
email: false

gulp/utils/command.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
'use strict'
22

33
const { env } = require('process')
4+
const { promisify } = require('util')
45

5-
const { spawn } = require('npm-run')
6+
const spawn = require('cross-spawn')
7+
const { get: getPath, PATH } = require('npm-path')
68
const PluginError = require('plugin-error')
79

810
// Execute a shell command
9-
const execCommand = function(command, { quiet = false, cwd } = {}) {
11+
const execCommand = async function(command, { quiet = false, cwd } = {}) {
1012
const [commandA, ...args] = command.trim().split(/ +/u)
1113
const stdio = getStdio({ quiet })
12-
const child = spawn(commandA, args, { env, stdio, cwd })
14+
const envA = await getEnv()
15+
const child = spawn(commandA, args, { env: envA, stdio, cwd })
1316

1417
// eslint-disable-next-line promise/avoid-new
1518
return new Promise(execCommandPromise.bind(null, { child, command }))
1619
}
1720

21+
// Allow executing binaries installed in `node_modules/.bin`
22+
const getEnv = async function() {
23+
const path = await promisify(getPath)()
24+
return { ...env, [PATH]: path }
25+
}
26+
1827
// If `opts.quiet` `true`, does not print stdout (but still prints stderr)
1928
const getStdio = function({ quiet }) {
2029
if (quiet) {

package-lock.json

Lines changed: 2 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"devDependencies": {
5454
"ava": "^1.0.0-rc.1",
5555
"coveralls": "^3.0.2",
56+
"cross-spawn": "^6.0.5",
5657
"eslint": "^5.8.0",
5758
"eslint-config-prettier": "^3.1.0",
5859
"eslint-config-standard": "^12.0.0",
@@ -75,7 +76,7 @@
7576
"has-ansi": "^3.0.0",
7677
"lolex": "^3.0.0",
7778
"ndb": "^1.0.26",
78-
"npm-run": "^5.0.1",
79+
"npm-path": "^2.0.4",
7980
"nyc": "^13.1.0",
8081
"plugin-error": "^1.0.1",
8182
"prettier": "^1.15.1",

0 commit comments

Comments
 (0)