Skip to content

Commit 52f7730

Browse files
chore(release): update execa and fix incompatibility with Listr
1 parent b571354 commit 52f7730

File tree

3 files changed

+183
-20
lines changed

3 files changed

+183
-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

+23-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,29 @@ 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(({ stdout, stderr }) => resolve({
25+
stdout: stdout as unknown as string,
26+
stderr: stderr as unknown as string
27+
}), (err) => reject(err))
28+
})
29+
}
30+
831
/**
932
* Runs a litany of tasks used to ensure a safe release of a new version of Stencil
1033
* @param opts build options containing the metadata needed to release a new version of Stencil
@@ -18,8 +41,6 @@ export async function runReleaseTasks(opts: BuildOptions, args: ReadonlyArray<st
1841
const isDryRun = args.includes('--dry-run') || opts.version.includes('dryrun');
1942
let tagPrefix: string;
2043

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

0 commit comments

Comments
 (0)