@@ -5,6 +5,29 @@ 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 ( ( { stdout, stderr } ) => resolve ( {
25
+ stdout : stdout as unknown as string ,
26
+ stderr : stderr as unknown as string
27
+ } ) , ( err ) => reject ( err ) )
28
+ } )
29
+ }
30
+
8
31
/**
9
32
* Runs a litany of tasks used to ensure a safe release of a new version of Stencil
10
33
* @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
18
41
const isDryRun = args . includes ( '--dry-run' ) || opts . version . includes ( 'dryrun' ) ;
19
42
let tagPrefix : string ;
20
43
21
- const { execa } = await import ( 'execa' ) ;
22
-
23
44
if ( isDryRun ) {
24
45
console . log ( color . bold . yellow ( `\n 🏃 Dry Run!\n` ) ) ;
25
46
}
0 commit comments