fixes
This commit is contained in:
parent
f383ed0ce4
commit
c0c2881020
@ -18,7 +18,8 @@ async function apply_template (
|
|||||||
}
|
}
|
||||||
|
|
||||||
type JSONMutator = {
|
type JSONMutator = {
|
||||||
(json: object): Promise<object>;
|
// 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<void> {
|
function run_command (command: string, folder = ''): Promise<void> {
|
||||||
return new Promise ((res) => {
|
return new Promise ((res) => {
|
||||||
const exec = child_process.exec (
|
child_process.exec (
|
||||||
command,
|
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);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,8 @@ export class Jenkins implements Snippet {
|
|||||||
if (is_node) {
|
if (is_node) {
|
||||||
await apply_template (node_js, 'jenkins.js');
|
await apply_template (node_js, 'jenkins.js');
|
||||||
await apply_template (node_jenkinsfile, 'Jenkinsfile');
|
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';
|
obj.scripts.ci = 'yarn && node jenkins.js';
|
||||||
return obj;
|
return obj;
|
||||||
});
|
});
|
||||||
|
@ -35,7 +35,7 @@ export class Node implements Snippet {
|
|||||||
folder
|
folder
|
||||||
);
|
);
|
||||||
|
|
||||||
await modify_json ((obj) => {
|
await modify_json ((obj: Record<string, unknown>) => {
|
||||||
obj.scripts = {
|
obj.scripts = {
|
||||||
lint: 'eslint . --ext .js,.jsx,.ts,.tsx,.vue,.mjs',
|
lint: 'eslint . --ext .js,.jsx,.ts,.tsx,.vue,.mjs',
|
||||||
test: 'nyc ava'
|
test: 'nyc ava'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user