complete for jenkins build

This commit is contained in:
Timo Hocker 2020-01-15 11:50:44 +01:00
parent 4af5d613a6
commit b7e845f093
8 changed files with 1678 additions and 17 deletions

17
.eslintrc.js Normal file
View File

@ -0,0 +1,17 @@
module.exports = {
env: {
commonjs: true,
es6: true,
node: true
},
extends: [
'@scode'
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly'
},
parserOptions: {
ecmaVersion: 2018
}
}

1
.npmrc Normal file
View File

@ -0,0 +1 @@
@scode:registry=https://npm.scode.ovh

40
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,40 @@
pipeline {
agent any
environment {
VERSION = VersionNumber([
versionNumberString:
'${BUILDS_ALL_TIME}',
versionPrefix: '1.1.',
worstResultForIncrement: 'SUCCESS'
])
publish = 0
}
stages {
stage('Setup') {
steps {
echo 'Setting up test environment'
sh 'npm ci'
sh 'nodejs jenkins.js ${VERSION}'
script {
currentBuild.displayName = env.VERSION
}
}
}
}
post {
success {
script {
publish = sh script: "git log -1 | grep '\\[no publish\\]'", returnStatus: true
if (publish != 0) {
echo 'Deploying'
sh 'npm publish'
} else {
echo 'Build successful, Commit not marked for deploying'
currentBuild.result = "UNSTABLE"
}
}
}
}
}

7
jenkins.js Normal file
View File

@ -0,0 +1,7 @@
const fs = require ('fs');
const pkg = JSON.parse (fs.readFileSync ('package.json', 'utf-8'));
[
,, pkg.version
] = process.argv;
fs.writeFileSync ('package.json', JSON.stringify (pkg, null, 2));

1594
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
{ {
"name": "snippeteer", "name": "@scode/snippeteer",
"version": "1.0.0", "version": "1.0.0",
"description": "macros for setting up projects or project parts", "description": "macros for setting up projects or project parts",
"main": "index.js", "main": "index.js",
@ -11,5 +11,9 @@
"url": "git@git.scode.ovh:timo/snippeteer" "url": "git@git.scode.ovh:timo/snippeteer"
}, },
"author": "Timo Hocker", "author": "Timo Hocker",
"license": "GPL-3.0-or-later" "license": "GPL-3.0-or-later",
"devDependencies": {
"@scode/eslint-config": "^1.1.10",
"eslint": "^6.8.0"
}
} }

View File

@ -1,15 +1,15 @@
const fs = require('fs'); const fs = require ('fs');
const path = require('path'); const path = require ('path');
exports.run = async (folder, args) => { exports.run = async (folder, args) => {
const snipFolder = path.join(folder, args[0]); const snipFolder = path.join (folder, args[0]);
const template = path.join(__dirname, 'template'); const template = path.join (__dirname, 'template');
fs.mkdir(snipFolder); fs.mkdir (snipFolder);
fs.copy(path.join(template, 'index.js'), path.join(snipFolder, 'index.js')); fs.copy (path.join (template, 'index.js'), path.join (snipFolder, 'index.js'));
}; };
exports.assert = (args) { exports.assert = (args) => {
assert(args.length == 1); assert (args.length == 1);
assert(typeof args[0] == 'string'); assert (typeof args[0] === 'string');
assert(/^[a-zA-Z]+$/u.test(args[0])) assert ((/^[a-zA-Z]+$/u).test (args[0]));
} };

View File

@ -1,5 +1,5 @@
const fs = require('fs'); const fs = require ('fs');
module.exports = async (folder) => {
module.exports = async folder => {
}; };