jenkins snippet set ci script
This commit is contained in:
		| @@ -20,10 +20,12 @@ const path = require ('path'); | ||||
|  * @param {Array} args function arguments | ||||
|  */ | ||||
| function run (folder, args) { | ||||
|   const is_node = args.length === 1 && (/^node$/ui).test (args[0]); | ||||
|  | ||||
|   const template = path.join ( | ||||
|     __dirname, | ||||
|     'template', | ||||
|     args.length === 1 && (/^node$/ui).test | ||||
|     is_node | ||||
|       ? 'node' | ||||
|       : 'general' | ||||
|   ); | ||||
| @@ -35,6 +37,15 @@ function run (folder, args) { | ||||
|       { 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'); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| /** | ||||
|   | ||||
		Reference in New Issue
	
	Block a user