Skip to content

Commit

Permalink
[plugin-helpers] use execa so that errors include stdout with helpful…
Browse files Browse the repository at this point in the history
… info (#20110)
  • Loading branch information
Spencer authored Jun 22, 2018
1 parent d9b3171 commit 7f0308b
Show file tree
Hide file tree
Showing 4 changed files with 324 additions and 24 deletions.
1 change: 1 addition & 0 deletions packages/kbn-plugin-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"argv-split": "^2.0.1",
"commander": "^2.9.0",
"del": "^2.2.2",
"execa": "^0.10.0",
"gulp-rename": "1.2.2",
"gulp-zip": "^4.1.0",
"inquirer": "^1.2.2",
Expand Down
20 changes: 7 additions & 13 deletions packages/kbn-plugin-helpers/tasks/build/create_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
const path = require('path');
const relative = require('path').relative;
const { readFileSync, writeFileSync, unlinkSync, existsSync } = require('fs');
const execFileSync = require('child_process').execFileSync;
const execa = require('execa');
const sass = require('node-sass');
const del = require('del');
const vfs = require('vinyl-fs');
Expand Down Expand Up @@ -112,15 +112,12 @@ module.exports = function createBuild(
}

// install packages in build
const options = {
cwd: buildRoot,
stdio: ['ignore', 'ignore', 'pipe'],
};

execFileSync(
execa.sync(
winCmd('yarn'),
['install', '--production', '--pure-lockfile'],
options
{
cwd: buildRoot,
}
);
})
.then(function() {
Expand Down Expand Up @@ -172,13 +169,10 @@ module.exports = function createBuild(
writeFileSync(buildConfigPath, JSON.stringify(buildConfig));
}

execFileSync(
execa.sync(
path.join(buildSource, 'node_modules', '.bin', winCmd('tsc')),
['--pretty', 'true'],
{
cwd: buildRoot,
stdio: ['ignore', 'pipe', 'pipe'],
}
{ cwd: buildRoot }
);

del.sync([
Expand Down
60 changes: 59 additions & 1 deletion packages/kbn-plugin-helpers/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,16 @@ cross-spawn@^3.0.0:
lru-cache "^4.0.1"
which "^1.2.9"

cross-spawn@^6.0.0:
version "6.0.5"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
dependencies:
nice-try "^1.0.4"
path-key "^2.0.1"
semver "^5.5.0"
shebang-command "^1.2.0"
which "^1.2.9"

[email protected]:
version "2.0.5"
resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8"
Expand Down Expand Up @@ -376,6 +386,18 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"

execa@^0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-0.10.0.tgz#ff456a8f53f90f8eccc71a96d11bdfc7f082cb50"
dependencies:
cross-spawn "^6.0.0"
get-stream "^3.0.0"
is-stream "^1.1.0"
npm-run-path "^2.0.0"
p-finally "^1.0.0"
signal-exit "^3.0.0"
strip-eof "^1.0.0"

exit-hook@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8"
Expand Down Expand Up @@ -792,6 +814,10 @@ is-relative@^1.0.0:
dependencies:
is-unc-path "^1.0.0"

is-stream@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"

is-typedarray@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
Expand Down Expand Up @@ -988,6 +1014,10 @@ nan@^2.10.0:
version "2.10.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f"

nice-try@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4"

node-gyp@^3.3.1:
version "3.7.0"
resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-3.7.0.tgz#789478e8f6c45e277aa014f3e28f958f286f9203"
Expand Down Expand Up @@ -1056,6 +1086,12 @@ now-and-later@^2.0.0:
dependencies:
once "^1.3.2"

npm-run-path@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
dependencies:
path-key "^2.0.0"

"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.0:
version "4.1.2"
resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b"
Expand Down Expand Up @@ -1131,6 +1167,10 @@ osenv@0:
os-homedir "^1.0.0"
os-tmpdir "^1.0.0"

p-finally@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"

parse-json@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9"
Expand All @@ -1155,6 +1195,10 @@ path-is-inside@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53"

path-key@^2.0.0, path-key@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"

path-type@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441"
Expand Down Expand Up @@ -1434,7 +1478,7 @@ scss-tokenizer@^0.2.3:
js-base64 "^2.1.8"
source-map "^0.4.2"

"semver@2 || 3 || 4 || 5":
"semver@2 || 3 || 4 || 5", semver@^5.5.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"

Expand All @@ -1446,6 +1490,16 @@ set-blocking@^2.0.0, set-blocking@~2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"

shebang-command@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
dependencies:
shebang-regex "^1.0.0"

shebang-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"

signal-exit@^3.0.0:
version "3.0.2"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
Expand Down Expand Up @@ -1565,6 +1619,10 @@ strip-bom@^2.0.0:
dependencies:
is-utf8 "^0.2.0"

strip-eof@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf"

strip-indent@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-1.0.1.tgz#0c7962a6adefa7bbd4ac366460a638552ae1a0a2"
Expand Down
Loading

0 comments on commit 7f0308b

Please sign in to comment.