Skip to content

Commit 8a7d89a

Browse files
chore(release): update execa and fix incompatibility with Listr (#5897)
* chore(release): update execa and fix incompatibility with Listr * prettier * wrap package names in back ticks to get around cspell
1 parent 5e74837 commit 8a7d89a

File tree

3 files changed

+187
-20
lines changed

3 files changed

+187
-20
lines changed

package-lock.json

+159-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@
154154
"eslint-plugin-jsdoc": "^48.0.0",
155155
"eslint-plugin-simple-import-sort": "^12.0.0",
156156
"eslint-plugin-wdio": "^8.24.12",
157-
"execa": "8.0.1",
157+
"execa": "9.3.0",
158158
"exit": "^0.1.2",
159159
"fs-extra": "^11.0.0",
160160
"glob": "10.4.1",

scripts/release-tasks.ts

+27-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,33 @@ import { buildAll } from './build';
55
import { BuildOptions } from './utils/options';
66
import { isPrereleaseVersion, isValidVersionInput, SEMVER_INCREMENTS, updateChangeLog } from './utils/release-utils';
77

8+
/**
9+
* We have to wrap `execa` in a promise to ensure it works with `Listr`. `Listr` uses rxjs under the hood which
10+
* seems to have issues with `execa`'s `ResultPromise` as it never resolves a task.
11+
* @param command command to run
12+
* @param args arguments to pass to the command
13+
* @param options `execa` options
14+
* @returns a promise that resolves with the stdout and stderr of the command
15+
*/
16+
async function execa(command: string, args: string[], options?: any) {
17+
/**
18+
* consecutive imports are cached and don't have an impact on the execution speed
19+
*/
20+
const { execa: execaOrig } = await import('execa');
21+
22+
return new Promise<{ stdout: string; stderr: string }>((resolve, reject) => {
23+
const run = execaOrig(command, args, options);
24+
run.then(
25+
({ stdout, stderr }) =>
26+
resolve({
27+
stdout: stdout as unknown as string,
28+
stderr: stderr as unknown as string,
29+
}),
30+
(err) => reject(err),
31+
);
32+
});
33+
}
34+
835
/**
936
* Runs a litany of tasks used to ensure a safe release of a new version of Stencil
1037
* @param opts build options containing the metadata needed to release a new version of Stencil
@@ -18,8 +45,6 @@ export async function runReleaseTasks(opts: BuildOptions, args: ReadonlyArray<st
1845
const isDryRun = args.includes('--dry-run') || opts.version.includes('dryrun');
1946
let tagPrefix: string;
2047

21-
const { execa } = await import('execa');
22-
2348
if (isDryRun) {
2449
console.log(color.bold.yellow(`\n 🏃‍ Dry Run!\n`));
2550
}

0 commit comments

Comments
 (0)