File tree Expand file tree Collapse file tree 6 files changed +35
-35
lines changed
Expand file tree Collapse file tree 6 files changed +35
-35
lines changed Original file line number Diff line number Diff line change 11import { Command } from 'commander' ;
2- import type { ExecaSyncReturnValue } from 'execa' ;
2+ import type { ExecaReturnValue } from 'execa' ;
33import fs from 'fs-extra' ;
44import { logger } from '../lib/logger/index.ts' ;
55import { generateDocs } from './docs/index.ts' ;
@@ -26,7 +26,7 @@ program
2626 if ( opts . strict ) {
2727 args . push ( '--strict' ) ;
2828 }
29- const res = exec ( 'pdm' , args , {
29+ const res = await exec ( 'pdm' , args , {
3030 cwd : 'tools/mkdocs' ,
3131 stdio : 'inherit' ,
3232 env : {
@@ -50,7 +50,7 @@ program
5050 if ( opts . strict ) {
5151 args . push ( '--strict' ) ;
5252 }
53- const res = exec ( 'pdm' , args , {
53+ const res = await exec ( 'pdm' , args , {
5454 cwd : 'tools/mkdocs' ,
5555 stdio : 'inherit' ,
5656 } ) ;
@@ -68,7 +68,7 @@ async function prepareDocs(opts: any): Promise<void> {
6868 }
6969}
7070
71- function checkResult ( res : ExecaSyncReturnValue < string > ) : void {
71+ function checkResult ( res : ExecaReturnValue < string > ) : void {
7272 if ( res . signal ) {
7373 logger . error ( `Signal received: ${ res . signal } ` ) ;
7474 process . exit ( - 1 ) ;
Original file line number Diff line number Diff line change 1- import { execaSync } from 'execa' ;
1+ import { execa } from 'execa' ;
22
3- function testRe2 ( ) {
4- execaSync (
3+ async function testRe2 ( ) {
4+ await execa (
55 'node' ,
66 [
77 '-e' ,
@@ -12,8 +12,8 @@ function testRe2() {
1212 console . log ( `Ok.` ) ;
1313}
1414
15- function testSqlite ( ) {
16- execaSync (
15+ async function testSqlite ( ) {
16+ await execa (
1717 'node' ,
1818 [
1919 '-e' ,
@@ -24,19 +24,19 @@ function testSqlite() {
2424 console . log ( `Ok.` ) ;
2525}
2626
27- ( ( ) => {
27+ void ( async ( ) => {
2828 console . log ( 'Checking re2 ... ' ) ;
2929 try {
30- testRe2 ( ) ;
30+ await testRe2 ( ) ;
3131 } catch ( e ) {
3232 console . error ( `Failed.\n${ e } ` ) ;
3333 try {
3434 if ( e . exitCode === 1 ) {
3535 console . log ( `Retry re2 install ...` ) ;
36- execaSync ( 'pnpm' , [ 'rb' , 're2' ] , {
36+ await execa ( 'pnpm' , [ 'rb' , 're2' ] , {
3737 stdio : 'inherit' ,
3838 } ) ;
39- testRe2 ( ) ;
39+ await testRe2 ( ) ;
4040 return ;
4141 }
4242 } catch ( e1 ) {
@@ -47,19 +47,19 @@ function testSqlite() {
4747 }
4848} ) ( ) ;
4949
50- ( ( ) => {
50+ void ( async ( ) => {
5151 console . log ( 'Checking better-sqlite3 ... ' ) ;
5252 try {
53- testSqlite ( ) ;
53+ await testSqlite ( ) ;
5454 } catch ( e ) {
5555 console . error ( `Failed.\n${ e } ` ) ;
5656 try {
5757 if ( e . exitCode === 1 ) {
5858 console . log ( `Retry better-sqlite3 install ...` ) ;
59- execaSync ( 'pnpm' , [ 'rb' , 'better-sqlite3' ] , {
59+ await execa ( 'pnpm' , [ 'rb' , 'better-sqlite3' ] , {
6060 stdio : 'inherit' ,
6161 } ) ;
62- testSqlite ( ) ;
62+ await testSqlite ( ) ;
6363 return ;
6464 }
6565 } catch ( e1 ) {
Original file line number Diff line number Diff line change @@ -31,14 +31,14 @@ void (async () => {
3131 await program . parseAsync ( ) ;
3232 const opts = program . opts ( ) ;
3333 logger . info ( `Preparing v${ opts . version ?. toString ( ) } ...` ) ;
34- build ( ) ;
34+ await build ( ) ;
3535 await generateDocs ( undefined , undefined , opts . version ?. toString ( ) ) ;
3636 await bake ( 'build' , opts ) ;
3737} ) ( ) ;
3838
39- function build ( ) : void {
39+ async function build ( ) : Promise < void > {
4040 logger . info ( 'Building ...' ) ;
41- const res = exec ( 'pnpm' , [ 'build' ] ) ;
41+ const res = await exec ( 'pnpm' , [ 'build' ] ) ;
4242
4343 if ( res . signal ) {
4444 logger . error ( `Signal received: ${ res . signal } ` ) ;
Original file line number Diff line number Diff line change @@ -29,11 +29,11 @@ void (async () => {
2929 const meta = await bake ( 'push' , opts ) ;
3030
3131 if ( meta ?. [ 'push-slim' ] ?. [ 'containerimage.digest' ] ) {
32- sign (
32+ await sign (
3333 `ghcr.io/renovatebot/renovate@${ meta [ 'push-slim' ] [ 'containerimage.digest' ] } ` ,
3434 opts ,
3535 ) ;
36- sign (
36+ await sign (
3737 `renovate/renovate@${ meta [ 'push-slim' ] [ 'containerimage.digest' ] } ` ,
3838 opts ,
3939 ) ;
@@ -42,11 +42,11 @@ void (async () => {
4242 }
4343
4444 if ( meta ?. [ 'push-full' ] ?. [ 'containerimage.digest' ] ) {
45- sign (
45+ await sign (
4646 `ghcr.io/renovatebot/renovate@${ meta [ 'push-full' ] [ 'containerimage.digest' ] } ` ,
4747 opts ,
4848 ) ;
49- sign (
49+ await sign (
5050 `renovate/renovate@${ meta [ 'push-full' ] [ 'containerimage.digest' ] } ` ,
5151 opts ,
5252 ) ;
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ export async function bake(
6666 args . push ( target ) ;
6767
6868 for ( let tries = opts . tries ?? 0 ; tries >= 0 ; tries -- ) {
69- const result = exec ( `docker` , args ) ;
69+ const result = await exec ( `docker` , args ) ;
7070 if ( result . signal ) {
7171 logger . error ( `Signal received: ${ result . signal } ` ) ;
7272 process . exit ( - 1 ) ;
@@ -97,15 +97,15 @@ export async function bake(
9797 return meta ;
9898}
9999
100- export function sign (
100+ export async function sign (
101101 image : string ,
102102 opts : {
103103 args ?: string [ ] ;
104104 exitOnError ?: boolean ;
105105 } ,
106- ) : void {
106+ ) : Promise < void > {
107107 logger . info ( `Signing ${ image } ...` ) ;
108- const result = exec ( 'cosign' , [ 'sign' , '--yes' , image ] ) ;
108+ const result = await exec ( 'cosign' , [ 'sign' , '--yes' , image ] ) ;
109109 if ( result . signal ) {
110110 logger . error ( `Signal received: ${ result . signal } ` ) ;
111111 process . exit ( - 1 ) ;
Original file line number Diff line number Diff line change 1- import type { ExecaSyncReturnValue , SyncOptions } from 'execa' ;
2- import { execaSync } from 'execa' ;
1+ import type { ExecaReturnValue , Options } from 'execa' ;
2+ import { execa } from 'execa' ;
33
44const maxBuffer = 20 * 1024 * 1024 ;
55
66/**
7- * Execute a command synchronously using execa
7+ * Execute a command asynchronously using execa
88 * @param {string } cmd
99 * @param {string[] } args
1010 */
11- export function exec (
11+ export async function exec (
1212 cmd : string ,
1313 args : string [ ] = [ ] ,
14- opts : SyncOptions = { } ,
15- ) : ExecaSyncReturnValue < string > {
16- return execaSync ( cmd , args , {
14+ opts : Options = { } ,
15+ ) : Promise < ExecaReturnValue < string > > {
16+ return await execa ( cmd , args , {
1717 ...opts ,
1818 maxBuffer,
1919 encoding : 'utf8' ,
You can’t perform that action at this time.
0 commit comments