Compare commits
60 Commits
49fab71c15
...
master
Author | SHA1 | Date | |
---|---|---|---|
ce8ae68362
|
|||
db74826cc4
|
|||
d2ff45e09e
|
|||
b7d0827f5e | |||
1c375d8d55 | |||
85d10032d9 | |||
cdb3558184 | |||
d5b018f2e4 | |||
18303c7197 | |||
0bec27954e | |||
648d9aac43 | |||
68074c9f02 | |||
80e0207021 | |||
6c102547d8 | |||
0fa904bed2 | |||
b5364f05e1 | |||
fe0ec6a077 | |||
48d46b5f0b | |||
681a0874e2 | |||
32d4902f6c | |||
e533f73d31 | |||
cc5e2c429b | |||
d93392db02 | |||
45dabc112f | |||
ef4aefd3e9 | |||
0955d18339 | |||
d8a0139ce4 | |||
f89082563a | |||
01dc0b4d4a | |||
1c4224adf6 | |||
28fae0cf69 | |||
e8189ffe11 | |||
c08137241c | |||
d1becabe18 | |||
d3434ab10b | |||
c0b5976b77 | |||
4798aeba0e | |||
40698083b7 | |||
3deca2424b | |||
3307c2913f | |||
2022bc0884 | |||
76315d5cd2 | |||
e2688f7a0c | |||
e8e8cc1a5c | |||
8b6e3b1df2 | |||
2c15e4df49 | |||
61da0a40c5 | |||
b7b93c807c | |||
938c4c0383 | |||
98cf38343c | |||
d73f5c860d | |||
6cd279c970 | |||
7c7ede2f68 | |||
d6a9b3689c | |||
9cb9c4e8d7 | |||
67abb12c33 | |||
da04a5175d | |||
cca9c21cb7 | |||
23a1cc5742 | |||
6a110e32d1 |
14
.drone.yml
Normal file
14
.drone.yml
Normal file
@ -0,0 +1,14 @@
|
||||
kind: pipeline
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: setup
|
||||
image: registry:5000/node-build
|
||||
commands:
|
||||
- yarn
|
||||
- curl https://git.scode.ovh/Timo/standard/raw/branch/master/ci.js > ci.js
|
||||
|
||||
- name: build
|
||||
image: registry:5000/node-build
|
||||
commands:
|
||||
- node ci.js
|
24
.eslintrc.js
24
.eslintrc.js
@ -1,24 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) SapphireCode - All Rights Reserved
|
||||
* This file is part of Standard which is released under MIT.
|
||||
* Copyright (C) Sapphirecode - All Rights Reserved
|
||||
* This file is part of standard which is released under MIT.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@sapphirecode.ovh>, May 2020
|
||||
* Created by Timo Hocker <timo@scode.ovh>, May 2020
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
env: {
|
||||
commonjs: true,
|
||||
es6: true,
|
||||
node: true
|
||||
es6: true,
|
||||
node: true
|
||||
},
|
||||
extends: [
|
||||
'@sapphirecode'
|
||||
],
|
||||
extends: [ '@sapphirecode' ],
|
||||
globals: {
|
||||
Atomics: 'readonly',
|
||||
Atomics: 'readonly',
|
||||
SharedArrayBuffer: 'readonly'
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018
|
||||
}
|
||||
}
|
||||
parserOptions: { ecmaVersion: 2018 }
|
||||
};
|
||||
|
@ -2,7 +2,7 @@
|
||||
"has_license": true,
|
||||
"license": "MIT",
|
||||
"author": "Timo Hocker",
|
||||
"company": "SapphireCode",
|
||||
"company": "Sapphirecode",
|
||||
"email": "timo@scode.ovh",
|
||||
"software": "Standard"
|
||||
"software": "standard"
|
||||
}
|
28
CHANGELOG.md
Normal file
28
CHANGELOG.md
Normal file
@ -0,0 +1,28 @@
|
||||
# Changelog
|
||||
|
||||
## 1.5.x
|
||||
|
||||
add standard stryker config file
|
||||
|
||||
## 1.4.x
|
||||
|
||||
switching projects from ava to jasmine test framework
|
||||
|
||||
## 1.3.x
|
||||
|
||||
using custom image to simplify node module deployment
|
||||
|
||||
## 1.2.x
|
||||
|
||||
adapt to drone.io deployment
|
||||
|
||||
## 1.1.x
|
||||
|
||||
Require up to date changelog file in jenkins build
|
||||
|
||||
## 1.0.x
|
||||
|
||||
Initial release
|
||||
|
||||
- standard files for jenkins ci
|
||||
- standard scripts
|
23
Jenkinsfile
vendored
23
Jenkinsfile
vendored
@ -1,23 +0,0 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
environment {
|
||||
VERSION = VersionNumber([
|
||||
versionNumberString:
|
||||
'${BUILDS_ALL_TIME}',
|
||||
versionPrefix: '1.0.',
|
||||
worstResultForIncrement: 'SUCCESS'
|
||||
])
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Building') {
|
||||
steps {
|
||||
script {
|
||||
currentBuild.displayName = env.VERSION
|
||||
}
|
||||
sh 'yarn ci ${VERSION}'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,9 @@
|
||||
# @sapphirecode/standard
|
||||
|
||||
[](https://packagequality.com/#?package=%40sapphirecode%2Fstandard)
|
||||
|
||||
version: 1.0.x
|
||||
version: 1.5.x
|
||||
|
||||
standard files and scripts for sapphirecode modules
|
||||
|
||||
@sapphirecode/standard contains standard files and scripts used in sapphirecode modules
|
||||
|
||||
## License
|
||||
|
||||
MIT © Timo Hocker <timo@sapphirecode.ovh>
|
||||
MIT © Timo Hocker <timo@scode.ovh>
|
||||
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) SapphireCode - All Rights Reserved
|
||||
* This file is part of Standard which is released under MIT.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@sapphirecode.ovh>, May 2020
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = `/* eslint-disable */
|
||||
|
||||
'use strict';
|
||||
|
||||
const fs = require ('fs');
|
||||
const child_process = 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));
|
||||
|
||||
child_process.execSync ('yarn lint', { stdio: 'inherit' });
|
||||
child_process.execSync ('yarn test', { stdio: 'inherit' });
|
||||
child_process.execSync ('yarn compile', { 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);
|
||||
}
|
||||
else { child_process.execSync ('yarn publish --access public'); }
|
||||
}
|
||||
else {
|
||||
console.log ('readme does not exist');
|
||||
process.exit (1);
|
||||
}
|
||||
`;
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) SapphireCode - All Rights Reserved
|
||||
* This file is part of Standard which is released under MIT.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@sapphirecode.ovh>, May 2020
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = `pipeline {
|
||||
agent any
|
||||
|
||||
environment {
|
||||
VERSION = VersionNumber([
|
||||
versionNumberString:
|
||||
'\${BUILDS_ALL_TIME}',
|
||||
versionPrefix: '1.0.',
|
||||
worstResultForIncrement: 'SUCCESS'
|
||||
])
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Building') {
|
||||
steps {
|
||||
script {
|
||||
currentBuild.displayName = env.VERSION
|
||||
}
|
||||
sh 'yarn ci \${VERSION}'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
24
assets/drone.js
Normal file
24
assets/drone.js
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) Sapphirecode - All Rights Reserved
|
||||
* This file is part of standard which is released under MIT.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, May 2020
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = `kind: pipeline
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: setup
|
||||
image: registry:5000/node-build
|
||||
commands:
|
||||
- yarn
|
||||
- curl https://git.scode.ovh/Timo/standard/raw/branch/master/ci.js > ci.js
|
||||
|
||||
- name: build
|
||||
image: registry:5000/node-build
|
||||
commands:
|
||||
- node ci.js
|
||||
`;
|
14
assets/index.js
Normal file
14
assets/index.js
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) Sapphirecode - All Rights Reserved
|
||||
* This file is part of standard which is released under MIT.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, September 2020
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const drone = require ('./drone');
|
||||
const jasmine = require ('./jasmine');
|
||||
const stryker = require ('./stryker');
|
||||
|
||||
module.exports = { drone, jasmine, stryker };
|
24
assets/jasmine.js
Normal file
24
assets/jasmine.js
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) Sapphirecode - All Rights Reserved
|
||||
* This file is part of standard which is released under MIT.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, September 2020
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = `
|
||||
{
|
||||
"spec_dir": "test",
|
||||
"spec_files": [
|
||||
"spec/*.js",
|
||||
"spec/*.ts"
|
||||
],
|
||||
"helpers": [
|
||||
"helpers/*.js",
|
||||
"helpers/*.ts"
|
||||
],
|
||||
"stopSpecOnExpectationFailure": false,
|
||||
"random": false
|
||||
}
|
||||
`;
|
32
assets/stryker.js
Normal file
32
assets/stryker.js
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) Sapphirecode - All Rights Reserved
|
||||
* This file is part of standard which is released under MIT.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, October 2020
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = `'use strict';
|
||||
|
||||
/**
|
||||
* @type {import('@stryker-mutator/api/core').StrykerOptions}
|
||||
*/
|
||||
module.exports = {
|
||||
packageManager: 'yarn',
|
||||
reporters: [
|
||||
'clear-text',
|
||||
'progress'
|
||||
],
|
||||
testRunner: 'jasmine',
|
||||
jasmineConfigFile: 'jasmine.json',
|
||||
coverageAnalysis: 'perTest',
|
||||
mutate: [
|
||||
'**/*.js',
|
||||
'**/*.ts',
|
||||
'!**/test/**/*',
|
||||
'!**/spec/**/*',
|
||||
'!stryker.conf.js'
|
||||
]
|
||||
};
|
||||
`;
|
104
ci.js
Normal file
104
ci.js
Normal file
@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright (C) Sapphirecode - All Rights Reserved
|
||||
* This file is part of standard which is released under MIT.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, May 2020
|
||||
*/
|
||||
|
||||
/* eslint-disable */
|
||||
'use strict';
|
||||
|
||||
const authors = [
|
||||
JSON.stringify ({ name: 'Timo Hocker', email: 'timo@scode.ovh' })
|
||||
];
|
||||
|
||||
const fs = require ('fs');
|
||||
const child_process = require ('child_process');
|
||||
|
||||
const pkg = JSON.parse (fs.readFileSync ('package.json', 'utf-8'));
|
||||
|
||||
child_process.execSync ('yarn lint', { stdio: 'inherit' });
|
||||
child_process.execSync ('yarn test', { stdio: 'inherit' });
|
||||
child_process.execSync ('yarn compile', { stdio: 'inherit' });
|
||||
|
||||
let ok = true;
|
||||
|
||||
if (typeof pkg.description === 'undefined' || pkg.description === '') {
|
||||
console.log ('description undefined');
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (typeof pkg.repository === 'object') {
|
||||
if (pkg.repository.type !== 'git') {
|
||||
console.log ('repository is not of type git');
|
||||
ok = false;
|
||||
}
|
||||
if (!(/^https:\/\/.+\.git/iu).test (pkg.repository.url))
|
||||
console.log ('repo url is not https.git');
|
||||
}
|
||||
else {
|
||||
console.log ('repository undefined');
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (!(/^https:\/\/.+/iu).test (pkg.bugs)) {
|
||||
console.log ('issue tracker url not defined');
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (typeof pkg.author === 'object') {
|
||||
if (!authors.includes (JSON.stringify (pkg.author))) {
|
||||
console.log ('author is none of the registered');
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.log ('author not in object format');
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (!Array.isArray(pkg.keywords) || pkg.keywords.length < 1) {
|
||||
console.log ('keywords empty');
|
||||
ok = false;
|
||||
}
|
||||
|
||||
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');
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.log ('readme does not exist');
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (fs.existsSync ('CHANGELOG.md')) {
|
||||
const changelog = fs.readFileSync ('CHANGELOG.md', 'utf-8');
|
||||
const cl_version = (/^## ([0-9x.]+)/mu).exec (changelog);
|
||||
if (
|
||||
cl_version === null
|
||||
|| major (cl_version[1]) !== major (pkg.version)
|
||||
) {
|
||||
console.log ('changelog is not up to date');
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.log ('changelog does not exist');
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (ok)
|
||||
child_process.execSync ('yarn publish --access public');
|
||||
else
|
||||
process.exit (1);
|
19
index.js
19
index.js
@ -1,23 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) SapphireCode - All Rights Reserved
|
||||
* This file is part of Standard which is released under MIT.
|
||||
* Copyright (C) Sapphirecode - All Rights Reserved
|
||||
* This file is part of standard which is released under MIT.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@sapphirecode.ovh>, May 2020
|
||||
* Created by Timo Hocker <timo@scode.ovh>, May 2020
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const jenkins = require ('./asset_jenkins');
|
||||
const jenkinsfile = require ('./asset_jenkinsfile');
|
||||
|
||||
const files = { jenkins, jenkinsfile };
|
||||
const files = require ('./assets');
|
||||
|
||||
const scripts = {
|
||||
lint: 'eslint . --ext .js,.jsx,.ts,.tsx,.vue,.mjs',
|
||||
test: {
|
||||
common: 'nyc ava',
|
||||
ts: 'tsc && nyc ava',
|
||||
no: 'echo "no test"'
|
||||
common: 'nyc jasmine --config="jasmine.json"',
|
||||
ts: 'nyc jasmine --config="jasmine.json"',
|
||||
ts_pre: 'tsc',
|
||||
ts_post: 'tsc --build --clean',
|
||||
no: 'echo "no test"'
|
||||
},
|
||||
compile: {
|
||||
common: 'tsc --allowJs --declaration --emitDeclarationOnly index.js',
|
||||
|
47
jenkins.js
47
jenkins.js
@ -1,47 +0,0 @@
|
||||
/* eslint-disable */
|
||||
|
||||
'use strict';
|
||||
|
||||
const fs = require ('fs');
|
||||
const child_process = 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));
|
||||
|
||||
child_process.execSync ('yarn lint', { stdio: 'inherit' });
|
||||
child_process.execSync ('yarn test', { stdio: 'inherit' });
|
||||
child_process.execSync ('yarn compile', { 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);
|
||||
}
|
||||
else { child_process.execSync ('yarn publish --access public'); }
|
||||
}
|
||||
else {
|
||||
console.log ('readme does not exist');
|
||||
process.exit (1);
|
||||
}
|
22
package.json
22
package.json
@ -1,27 +1,35 @@
|
||||
{
|
||||
"name": "@sapphirecode/standard",
|
||||
"version": "1.0.0",
|
||||
"version": "1.5.5",
|
||||
"main": "index.js",
|
||||
"author": "Timo Hocker <timo@sapphirecode.ovh>",
|
||||
"author": {
|
||||
"name": "Timo Hocker",
|
||||
"email": "timo@scode.ovh"
|
||||
},
|
||||
"description": "standard files and scripts for sapphirecode modules",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://git.scode.ovh/timo/standard.git"
|
||||
},
|
||||
"bugs": "https://redmine.scode.ovh/projects/standard",
|
||||
"keywords": [
|
||||
"standard"
|
||||
],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@sapphirecode/eslint-config": "^2.0.15",
|
||||
"eslint": "^6.8.0"
|
||||
"@sapphirecode/eslint-config": "^2.1.3",
|
||||
"eslint": "^7.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.vue,.mjs",
|
||||
"test": "echo \"no test\"",
|
||||
"compile": "tsc --allowJs --declaration --emitDeclarationOnly index.js",
|
||||
"ci": "yarn && node jenkins.js"
|
||||
"compile": "tsc --allowJs --declaration --emitDeclarationOnly index.js"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"*.js",
|
||||
"*.d.ts"
|
||||
"*.d.ts",
|
||||
"assets/*.js",
|
||||
"assets/*.d.ts"
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user