@@ -5,6 +5,33 @@ import { buildAll } from './build';
5
5
import { BuildOptions } from './utils/options' ;
6
6
import { isPrereleaseVersion , isValidVersionInput , SEMVER_INCREMENTS , updateChangeLog } from './utils/release-utils' ;
7
7
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
+
8
35
/**
9
36
* Runs a litany of tasks used to ensure a safe release of a new version of Stencil
10
37
* @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
18
45
const isDryRun = args . includes ( '--dry-run' ) || opts . version . includes ( 'dryrun' ) ;
19
46
let tagPrefix : string ;
20
47
21
- const { execa } = await import ( 'execa' ) ;
22
-
23
48
if ( isDryRun ) {
24
49
console . log ( color . bold . yellow ( `\n 🏃 Dry Run!\n` ) ) ;
25
50
}
0 commit comments