diff --git a/lib/Helper.ts b/lib/Helper.ts index 289d7a0..ef22ceb 100644 --- a/lib/Helper.ts +++ b/lib/Helper.ts @@ -18,7 +18,8 @@ async function apply_template ( } type JSONMutator = { - (json: object): Promise; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (json: any): any; } /** @@ -46,11 +47,17 @@ async function modify_json ( */ function run_command (command: string, folder = ''): Promise { return new Promise ((res) => { - const exec = child_process.exec ( + child_process.exec ( command, - { cwd: path.join (process.cwd (), folder), stdio: 'inherit' } + { cwd: path.join (process.cwd (), folder) }, + (err, stdout, stderr) => { + if (err) + throw err; + // eslint-disable-next-line no-console + console.log (stdout + stderr); + res (); + } ); - exec.on ('close', res); }); } diff --git a/lib/snippets/jenkins/index.ts b/lib/snippets/jenkins/index.ts index 61d6669..3e19f5d 100644 --- a/lib/snippets/jenkins/index.ts +++ b/lib/snippets/jenkins/index.ts @@ -24,7 +24,8 @@ export class Jenkins implements Snippet { if (is_node) { await apply_template (node_js, 'jenkins.js'); await apply_template (node_jenkinsfile, 'Jenkinsfile'); - await modify_json ((obj) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + await modify_json ((obj: any): any => { obj.scripts.ci = 'yarn && node jenkins.js'; return obj; }); diff --git a/lib/snippets/node/index.ts b/lib/snippets/node/index.ts index 14f63c0..f72115c 100644 --- a/lib/snippets/node/index.ts +++ b/lib/snippets/node/index.ts @@ -35,7 +35,7 @@ export class Node implements Snippet { folder ); - await modify_json ((obj) => { + await modify_json ((obj: Record) => { obj.scripts = { lint: 'eslint . --ext .js,.jsx,.ts,.tsx,.vue,.mjs', test: 'nyc ava'