Skip to content
This repository was archived by the owner on Jan 21, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions source/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
"lint:js": "eslint --cache .",
"readme:build": "node ./scripts/build-readme.js",
"package:build": "node ./scripts/build-package.json.js",
"bump:version": "node ./scripts/bump-version.js",
"create:tag": "node ./scripts/create-tag.js",
"release": "yarn release:patch",
"release:major": "git checkout master && git pull && yarn build && git add .. && yarn version --new-version major && git push --follow-tags",
"release:minor": "git checkout master && git pull && yarn build && git add .. && yarn version --new-version minor && git push --follow-tags",
"release:patch": "git checkout master && git pull && yarn build && git add .. && yarn version --new-version patch && git push --follow-tags",
"release:major": "git checkout master && git pull && yarn bump:version major && yarn build && git add .. && yarn create:tag && git push --follow-tags",
"release:minor": "git checkout master && git pull && yarn bump:version minor && yarn build && git add .. && yarn create:tag && git push --follow-tags",
"release:patch": "git checkout master && git pull && yarn bump:version patch && yarn build && git add .. && yarn create:tag && git push --follow-tags",
"styleguide:build": "styleguidist build --config ./config/styleguide.config.js",
"styleguide:watch": "styleguidist server --config ./config/styleguide.config.js",
"ci": "yarn lint && yarn test --runInBand",
Expand Down Expand Up @@ -72,6 +74,7 @@
"rollup-plugin-sass": "^0.9.2",
"rollup-plugin-string": "^2.0.2",
"sass-loader": "^7.1.0",
"semver": "^5.5.1",
"sinon": "^6.3.4",
"stylelint": "^9.5.0",
"stylelint-config-fandom": "git://github.com/Wikia/stylelint-config-fandom.git#0.0.1",
Expand Down
17 changes: 17 additions & 0 deletions source/scripts/bump-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const fs = require('fs');
const semver = require('semver');

const source = require('../package.json');
const version = process.argv.length === 3 ? process.argv[2] : 'patch';

console.log(process.argv[2]);

const target = {
...source,
version: semver.inc(source.version, version),
};

console.log(`Updating ${source.version} to version ${target.version}.`);

// write template to the file
fs.writeFileSync(`${__dirname}/../package.json`, `${JSON.stringify(target, null, 2)}\n`);
22 changes: 22 additions & 0 deletions source/scripts/create-tag.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const { exec } = require('child_process');

let { version } = require('../package.json');

version = `${version}-test2`;

console.log(`Creating tag for version ${version}.`);

const command = `git tag -m "${version}" -a ${version} -s`;

exec(command, (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
if (stdout && stdout.length > 0) {
console.log(`stdout: ${stdout}`);
}
if (stderr && stderr.length > 0) {
console.log(`stdout: ${stderr}`);
}
});