[7.x] Update dependency execa to v3 (#48975) (#49139)

* Update dependency execa to v3

* update kbn/pm dist

* remove old @types/execa package

* remove use of removed methods/properties, specify preferLocal when needed

* [@kbn/pm] specify preferLocal when running install scripts

* update kbn/pm dist

* Joi now converts input to matching option from .valid()

* fix failed tests

* Revert "Joi now converts input to matching option from .valid()"

This reverts commit 75531b1d09.
This commit is contained in:
Spencer 2019-10-23 20:54:03 -07:00 committed by GitHub
parent cb116308e3
commit 39d0e3c088
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 3092 additions and 3613 deletions

View file

@ -158,7 +158,7 @@
"elasticsearch": "^16.4.0",
"elasticsearch-browser": "^16.4.0",
"encode-uri-query": "1.0.1",
"execa": "^1.0.0",
"execa": "^3.2.0",
"expiry-js": "0.1.7",
"file-loader": "4.2.0",
"font-awesome": "4.7.0",
@ -299,7 +299,6 @@
"@types/elasticsearch": "^5.0.33",
"@types/enzyme": "^3.9.0",
"@types/eslint": "^6.1.2",
"@types/execa": "^0.9.0",
"@types/fetch-mock": "^7.3.1",
"@types/getopts": "^2.0.1",
"@types/glob": "^7.1.1",

View file

@ -12,7 +12,7 @@
"dependencies": {
"chalk": "^2.4.2",
"dedent": "^0.7.0",
"execa": "^1.0.0",
"execa": "^3.2.0",
"exit-hook": "^2.2.0",
"getopts": "^2.2.5",
"moment": "^2.20.1",

View file

@ -87,6 +87,7 @@ export function startProc(name: string, options: ProcOptions, log: ToolingLog) {
cwd,
env,
stdio: ['pipe', 'pipe', 'pipe'],
preferLocal: true,
});
if (stdin) {

View file

@ -11,7 +11,7 @@
"chalk": "^2.4.2",
"dedent": "^0.7.0",
"del": "^4.1.1",
"execa": "^1.0.0",
"execa": "^3.2.0",
"getopts": "^2.2.4",
"glob": "^7.1.2",
"node-fetch": "^2.6.0",

View file

@ -6,7 +6,7 @@
"dependencies": {
"chalk": "^2.4.2",
"dedent": "^0.7.0",
"execa": "^1.0.0",
"execa": "^3.2.0",
"getopts": "^2.2.4",
"lodash.camelcase": "^4.3.0",
"lodash.kebabcase": "^4.1.1",

View file

@ -17,7 +17,7 @@
"argv-split": "^2.0.1",
"commander": "^2.9.0",
"del": "^4.1.1",
"execa": "^1.0.0",
"execa": "^3.2.0",
"globby": "^8.0.1",
"gulp-babel": "^8.0.0",
"gulp-rename": "1.4.0",

File diff suppressed because one or more lines are too long

View file

@ -18,7 +18,6 @@
"@types/cmd-shim": "^2.0.0",
"@types/cpy": "^5.1.0",
"@types/dedent": "^0.7.0",
"@types/execa": "^0.9.0",
"@types/getopts": "^2.0.1",
"@types/glob": "^5.0.35",
"@types/globby": "^6.1.0",
@ -41,7 +40,7 @@
"cpy": "^7.3.0",
"dedent": "^0.7.0",
"del": "^4.1.1",
"execa": "^1.0.0",
"execa": "^3.2.0",
"getopts": "^2.2.4",
"glob": "^7.1.2",
"globby": "^8.0.1",

View file

@ -34,6 +34,7 @@ function generateColors() {
export function spawn(command: string, args: string[], opts: execa.Options) {
return execa(command, args, {
stdio: 'inherit',
preferLocal: true,
...opts,
});
}
@ -48,6 +49,7 @@ export function spawnStreaming(
) {
const spawned = execa(command, args, {
stdio: ['ignore', 'pipe', 'pipe'],
preferLocal: true,
...opts,
});

View file

@ -351,14 +351,6 @@
'@types/elasticsearch',
],
},
{
groupSlug: 'execa',
groupName: 'execa related packages',
packageNames: [
'execa',
'@types/execa',
],
},
{
groupSlug: 'fetch-mock',
groupName: 'fetch-mock related packages',

View file

@ -27,16 +27,14 @@ it(
'types return values to prevent mutations in typescript',
async () => {
await expect(
execa.stdout('tsc', ['--noEmit'], {
execa('tsc', ['--noEmit'], {
cwd: resolve(__dirname, '__fixtures__/frozen_object_mutation'),
})
).rejects.toThrowErrorMatchingInlineSnapshot(`
"Command failed: tsc --noEmit
index.ts(28,12): error TS2540: Cannot assign to 'baz' because it is a read-only property.
index.ts(36,11): error TS2540: Cannot assign to 'bar' because it is a read-only property.
"
`);
preferLocal: true,
}).catch(err => err.stdout)
).resolves.toMatchInlineSnapshot(`
"index.ts(28,12): error TS2540: Cannot assign to 'baz' because it is a read-only property.
index.ts(36,11): error TS2540: Cannot assign to 'bar' because it is a read-only property."
`);
},
MINUTE
);

View file

@ -36,6 +36,7 @@ export async function exec(log, cmd, args, options = {}) {
stdio: ['ignore', 'pipe', 'pipe'],
cwd,
env,
preferLocal: true,
});
await watchStdioForLine(proc, line => log[level](line), exitAfter);

View file

@ -28,7 +28,9 @@ async function getBuildNumber() {
return log.stdout.split('\n').length;
}
const wc = await execa.shell('git log --format="%h" | wc -l');
const wc = await execa.command('git log --format="%h" | wc -l', {
shell: true
});
return parseFloat(wc.stdout.trim());
}
@ -39,7 +41,7 @@ export async function getVersionInfo({ isRelease, versionQualifier, pkg }) {
);
return {
buildSha: await execa.stdout('git', ['rev-parse', 'HEAD']),
buildSha: (await execa('git', ['rev-parse', 'HEAD'])).stdout,
buildVersion,
buildNumber: await getBuildNumber(),
};

View file

@ -52,7 +52,7 @@ it(
}
);
expect(result.code).toBe(1);
expect(result.exitCode).toBe(1);
await expect(parseXml(readFileSync(XML_PATH, 'utf8'))).resolves.toEqual({
testsuites: {
$: {

View file

@ -86,7 +86,7 @@ run(
// attempt to init upstream remote
await execInDir('git', ['remote', 'add', 'upstream', UPSTREAM_URL]);
} catch (error) {
if (error.code !== 128) {
if (error.exitCode !== 128) {
throw error;
}

View file

@ -76,12 +76,16 @@ const apiExtractorConfig = (folder: string): ExtractorConfig => {
};
const runBuildTypes = async () => {
await execa.shell('yarn run build:types');
await execa('yarn', ['run', 'build:types']);
};
const runApiDocumenter = async (folder: string) => {
await execa.shell(
`api-documenter markdown -i ./build/${folder} -o ./docs/development/core/${folder}`
await execa(
'api-documenter',
['markdown', '-i', `./build/${folder}`, '-o', `./docs/development/core/${folder}`],
{
preferLocal: true,
}
);
};

View file

@ -45,6 +45,7 @@ export function execInProjects(
cwd: process.cwd(),
env: chalk.enabled ? { FORCE_COLOR: 'true' } : {},
stdio: ['ignore', 'pipe', 'pipe'],
preferLocal: true,
}).catch(error => {
throw new ProjectFailure(project, error);
}),

View file

@ -30,7 +30,7 @@ import { PROJECTS } from './projects';
export async function runCheckTsProjectsCli() {
run(
async ({ log }) => {
const files = await execa.stdout('git', ['ls-tree', '--name-only', '-r', 'HEAD'], {
const { stdout: files } = await execa('git', ['ls-tree', '--name-only', '-r', 'HEAD'], {
cwd: REPO_ROOT,
});

View file

@ -58,12 +58,13 @@ grunt.registerTask(
const done = this.async();
try {
const stats = JSON.parse(await execa.stderr(process.execPath, [
const result = await execa(process.execPath, [
'scripts/functional_test_runner',
...TEST_TAGS.map(tag => `--include-tag=${tag}`),
'--config', 'test/functional/config.js',
'--test-stats'
]));
]);
const stats = JSON.parse(result.stderr);
if (stats.excludedTests.length > 0) {
grunt.fail.fatal(`

View file

@ -133,7 +133,7 @@
"enzyme-adapter-react-16": "^1.14.0",
"enzyme-adapter-utils": "^1.12.0",
"enzyme-to-json": "^3.3.4",
"execa": "^1.0.0",
"execa": "^3.2.0",
"fancy-log": "^1.3.2",
"fetch-mock": "^7.3.9",
"graphql-code-generator": "^0.18.2",

View file

@ -3265,13 +3265,6 @@
resolved "https://registry.yarnpkg.com/@types/events/-/events-1.2.0.tgz#81a6731ce4df43619e5c8c945383b3e62a89ea86"
integrity sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA==
"@types/execa@^0.9.0":
version "0.9.0"
resolved "https://registry.yarnpkg.com/@types/execa/-/execa-0.9.0.tgz#9b025d2755f17e80beaf9368c3f4f319d8b0fb93"
integrity sha512-mgfd93RhzjYBUHHV532turHC2j4l/qxsF/PbfDmprHDEUHmNZGlDn1CEsulGK3AfsPdhkWzZQT/S/k0UGhLGsA==
dependencies:
"@types/node" "*"
"@types/fancy-log@^1.3.1":
version "1.3.1"
resolved "https://registry.yarnpkg.com/@types/fancy-log/-/fancy-log-1.3.1.tgz#dd94fbc8c2e2ab8ab402ca8d04bb8c34965f0696"
@ -9025,6 +9018,15 @@ cross-spawn@^5.0.1, cross-spawn@^5.1.0:
shebang-command "^1.2.0"
which "^1.2.9"
cross-spawn@^7.0.0:
version "7.0.1"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.1.tgz#0ab56286e0f7c24e153d04cc2aa027e43a9a5d14"
integrity sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg==
dependencies:
path-key "^3.1.0"
shebang-command "^2.0.0"
which "^2.0.1"
crypt@~0.0.1:
version "0.0.2"
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
@ -11775,6 +11777,22 @@ execa@^2.0.4:
signal-exit "^3.0.2"
strip-final-newline "^2.0.0"
execa@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-3.2.0.tgz#18326b79c7ab7fbd6610fd900c1b9e95fa48f90a"
integrity sha512-kJJfVbI/lZE1PZYDI5VPxp8zXPO9rtxOkhpZ0jMKha56AI9y2gGVC6bkukStQf0ka5Rh15BA5m7cCCH4jmHqkw==
dependencies:
cross-spawn "^7.0.0"
get-stream "^5.0.0"
human-signals "^1.1.1"
is-stream "^2.0.0"
merge-stream "^2.0.0"
npm-run-path "^4.0.0"
onetime "^5.1.0"
p-finally "^2.0.0"
signal-exit "^3.0.2"
strip-final-newline "^2.0.0"
execall@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/execall/-/execall-1.0.0.tgz#73d0904e395b3cab0658b08d09ec25307f29bb73"
@ -15060,6 +15078,11 @@ https-proxy-agent@^2.2.2:
agent-base "^4.3.0"
debug "^3.1.0"
human-signals@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3"
integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==
humanize-ms@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed"
@ -20333,6 +20356,13 @@ npm-run-path@^3.0.0:
dependencies:
path-key "^3.0.0"
npm-run-path@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.0.tgz#d644ec1bd0569187d2a52909971023a0a58e8438"
integrity sha512-8eyAOAH+bYXFPSnNnKr3J+yoybe8O87Is5rtAQ8qRczJz1ajcsjg8l2oZqP+Ppx15Ii3S1vUTjQN2h4YO2tWWQ==
dependencies:
path-key "^3.0.0"
npmconf@^2.1.3:
version "2.1.3"
resolved "https://registry.yarnpkg.com/npmconf/-/npmconf-2.1.3.tgz#1cbe5dd02e899d365fed7260b54055473f90a15c"
@ -21478,7 +21508,7 @@ path-key@^2.0.0, path-key@^2.0.1:
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"
integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=
path-key@^3.0.0:
path-key@^3.0.0, path-key@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.0.tgz#99a10d870a803bdd5ee6f0470e58dfcd2f9a54d3"
integrity sha512-8cChqz0RP6SHJkMt48FW0A7+qUOn+OsnOsVtzI59tZ8m+5bCSk7hzwET0pulwOM2YMn9J1efb07KB9l9f30SGg==
@ -25411,11 +25441,23 @@ shebang-command@^1.2.0:
dependencies:
shebang-regex "^1.0.0"
shebang-command@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea"
integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==
dependencies:
shebang-regex "^3.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"
integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=
shebang-regex@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
shell-quote@1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.6.1.tgz#f4781949cce402697127430ea3b3c5476f481767"
@ -29794,6 +29836,13 @@ which@^1.1.1, which@^1.2.1, which@^1.2.14, which@^1.2.8, which@^1.3.0:
dependencies:
isexe "^2.0.0"
which@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/which/-/which-2.0.1.tgz#f1cf94d07a8e571b6ff006aeb91d0300c47ef0a4"
integrity sha512-N7GBZOTswtB9lkQBZA4+zAXrjEIWAUOB93AvzUiudRzRxhUdLURQ7D/gAIMY1gatT/LTbmbcv8SiYazy3eYB7w==
dependencies:
isexe "^2.0.0"
wide-align@1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457"