Version 4.0.0

This commit is contained in:
Josh Johnson 2018-10-27 16:45:19 +01:00
parent 8149db8436
commit 62bfde18bc
5 changed files with 687 additions and 511 deletions

View file

@ -24,7 +24,7 @@
"css:sass": "node-sass --output-style expanded --include-path scss src/styles/base.scss public/assets/styles/base.css && node-sass --output-style expanded --include-path scss src/styles/choices.scss public/assets/styles/choices.css",
"css:prefix": "postcss --use autoprefixer -b 'last 2 versions' public/assets/styles/*.css -d public/assets/styles",
"css:min": "csso public/assets/styles/base.css public/assets/styles/base.min.css && csso public/assets/styles/choices.css public/assets/styles/choices.min.css",
"version": "node version.js --current $npm_package_version --new $npm_config_newVersion",
"version": "node version.js --current $npm_package_version",
"postversion": "npm run js:build",
"prepush": "run-p lint test:unit"
},

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -2,8 +2,9 @@
const fs = require('fs');
const path = require('path');
const config = {
files: ['bower.json', 'package.json', 'index.html', 'version.js']
files: ['package.json', 'public/index.html', 'version.js'],
};
/**
@ -14,15 +15,15 @@ const argvToObject = () => {
const args = {};
let arg = null;
process.argv.forEach((val, index) => {
if(/^--/.test(val)) {
if (/^--/.test(val)) {
arg = {
index: index,
name: val.replace(/^--/, '')
}
index,
name: val.replace(/^--/, ''),
};
return;
}
if(arg && ((arg.index+1 === index ))) {
if (arg && arg.index + 1 === index) {
args[arg.name] = val;
}
});
@ -34,14 +35,14 @@ const argvToObject = () => {
* Loop through files updating the current version
* @param {Object} config
*/
const updateVersion = (config) => {
const updateVersion = ({ files }) => {
const args = argvToObject();
const currentVersion = args.current;
const newVersion = args.new;
const newVersion = args.new || currentVersion;
console.log(`Updating version from ${currentVersion} to ${newVersion}`);
config.files.forEach((file) => {
files.forEach(file => {
const filePath = path.join(__dirname, file);
const regex = new RegExp(currentVersion, 'g');