From 9cb9c4e8d76c29c54f98625ed4006afc4d9d76f4 Mon Sep 17 00:00:00 2001 From: Timo Hocker Date: Fri, 15 May 2020 12:56:20 +0200 Subject: [PATCH] auto update jenkins.js --- asset_jenkins.js | 53 +++++++++++------------------------------------- jenkins.js | 51 ++++++++++------------------------------------ 2 files changed, 23 insertions(+), 81 deletions(-) diff --git a/asset_jenkins.js b/asset_jenkins.js index 11f1e73..f212285 100644 --- a/asset_jenkins.js +++ b/asset_jenkins.js @@ -7,51 +7,22 @@ 'use strict'; -module.exports = `/* eslint-disable */ - -'use strict'; +module.exports = `'use strict'; +const https = require ('https'); const fs = require ('fs'); -const child_process = require ('child_process'); +const { execSync: exec_sync } = require ('child_process'); -const pkg = JSON.parse (fs.readFileSync ('package.json', 'utf-8')); -[ - ,, pkg.version -] = process.argv; -fs.writeFileSync ('package.json', JSON.stringify (pkg, null, 2)); +const run_file = fs.createWriteStream ('.jenkins.run.js'); -child_process.execSync ('yarn lint', { stdio: 'inherit' }); -child_process.execSync ('yarn test', { stdio: 'inherit' }); -child_process.execSync ('yarn compile', { stdio: 'inherit' }); +run_file.on ('close', () => { + exec_sync ('node .jenkins.run.js', { stdio: 'inherit' }); +}); -if (typeof pkg.description === 'undefined' || pkg.description === '') { - console.log ('description undefined'); - process.exit (1); -} - -if (typeof pkg.repository === 'undefined') { - console.log ('repository undefined'); - process.exit (1); -} - -function major (version) { - return version.replace (/\\.[0-9x]+$/ui, ''); -} - -if (fs.existsSync ('README.md')) { - const readme = fs.readFileSync ('README.md', 'utf-8'); - const version = (/version: ([0-9x.]+)/ui).exec (readme); - if ( - version === null - || major (version[1]) !== major (pkg.version) - ) { - console.log ('readme version does not match package version'); - process.exit (1); +https.request ( + 'https://git.scode.ovh/Timo/standard/raw/branch/master/jenkins.run.js', + (msg) => { + msg.pipe (run_file); } - else { child_process.execSync ('yarn publish --access public'); } -} -else { - console.log ('readme does not exist'); - process.exit (1); -} +); `; diff --git a/jenkins.js b/jenkins.js index 37c1969..74573e9 100644 --- a/jenkins.js +++ b/jenkins.js @@ -1,47 +1,18 @@ -/* eslint-disable */ - 'use strict'; +const https = require ('https'); const fs = require ('fs'); -const child_process = require ('child_process'); +const { execSync: exec_sync } = require ('child_process'); -const pkg = JSON.parse (fs.readFileSync ('package.json', 'utf-8')); -[ - ,, pkg.version -] = process.argv; -fs.writeFileSync ('package.json', JSON.stringify (pkg, null, 2)); +const run_file = fs.createWriteStream ('.jenkins.run.js'); -child_process.execSync ('yarn lint', { stdio: 'inherit' }); -child_process.execSync ('yarn test', { stdio: 'inherit' }); -child_process.execSync ('yarn compile', { stdio: 'inherit' }); +run_file.on ('close', () => { + exec_sync ('node .jenkins.run.js', { stdio: 'inherit' }); +}); -if (typeof pkg.description === 'undefined' || pkg.description === '') { - console.log ('description undefined'); - process.exit (1); -} - -if (typeof pkg.repository === 'undefined') { - console.log ('repository undefined'); - process.exit (1); -} - -function major (version) { - return version.replace (/\.[0-9x]+$/ui, ''); -} - -if (fs.existsSync ('README.md')) { - const readme = fs.readFileSync ('README.md', 'utf-8'); - const version = (/version: ([0-9x.]+)/ui).exec (readme); - if ( - version === null - || major (version[1]) !== major (pkg.version) - ) { - console.log ('readme version does not match package version'); - process.exit (1); +https.request ( + 'https://git.scode.ovh/Timo/standard/raw/branch/master/jenkins.run.js', + (msg) => { + msg.pipe (run_file); } - else { child_process.execSync ('yarn publish --access public'); } -} -else { - console.log ('readme does not exist'); - process.exit (1); -} +);