jenkins snippet set ci script
This commit is contained in:
parent
8c47eef18f
commit
b81f7349ef
@ -20,10 +20,12 @@ const path = require ('path');
|
|||||||
* @param {Array} args function arguments
|
* @param {Array} args function arguments
|
||||||
*/
|
*/
|
||||||
function run (folder, args) {
|
function run (folder, args) {
|
||||||
|
const is_node = args.length === 1 && (/^node$/ui).test (args[0]);
|
||||||
|
|
||||||
const template = path.join (
|
const template = path.join (
|
||||||
__dirname,
|
__dirname,
|
||||||
'template',
|
'template',
|
||||||
args.length === 1 && (/^node$/ui).test
|
is_node
|
||||||
? 'node'
|
? 'node'
|
||||||
: 'general'
|
: 'general'
|
||||||
);
|
);
|
||||||
@ -35,6 +37,15 @@ function run (folder, args) {
|
|||||||
{ filter: (src, dest) => !fs.existsSync (dest) }
|
{ filter: (src, dest) => !fs.existsSync (dest) }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_node) {
|
||||||
|
const pkg = path.join (folder, 'package.json');
|
||||||
|
if (fs.existsSync (pkg)) {
|
||||||
|
const json = JSON.parse (fs.readFileSync (pkg, 'utf-8'));
|
||||||
|
json.scripts.ci = 'yarn && node jenkins.js';
|
||||||
|
fs.writeFileSync (pkg, JSON.stringify (json, null, 2), 'utf-8');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user