Use npm to bump version
This commit is contained in:
parent
85b53cc445
commit
651d1a4bd5
55
gulpfile.js
55
gulpfile.js
@ -1,9 +1,6 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const gulp = require('gulp');
|
const gulp = require('gulp');
|
||||||
const concat = require('gulp-concat');
|
const concat = require('gulp-concat');
|
||||||
const spawn = require('child_process').spawn;
|
|
||||||
const util = require('gulp-util');
|
|
||||||
const version = require('./package').version;
|
|
||||||
|
|
||||||
const prismScripts = [
|
const prismScripts = [
|
||||||
'prismjs/components/prism-core',
|
'prismjs/components/prism-core',
|
||||||
@ -17,54 +14,6 @@ const prismScripts = [
|
|||||||
prismScripts.push(
|
prismScripts.push(
|
||||||
path.join(path.dirname(require.resolve('prismjs/components/prism-core')), 'prism-!(*.min).js'));
|
path.join(path.dirname(require.resolve('prismjs/components/prism-core')), 'prism-!(*.min).js'));
|
||||||
|
|
||||||
function exec(commands, cb) {
|
|
||||||
if (commands.length === 0) {
|
|
||||||
cb();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let file;
|
|
||||||
let args;
|
|
||||||
const command = commands.shift();
|
|
||||||
const options = {
|
|
||||||
cwd: process.cwd(),
|
|
||||||
};
|
|
||||||
// Credit: https://github.com/nodejs/node/blob/master/lib/child_process.js
|
|
||||||
if (process.platform === 'win32') {
|
|
||||||
file = process.env.comspec || 'cmd.exe';
|
|
||||||
args = ['/s', '/c', `"${command}"`];
|
|
||||||
options.windowsVerbatimArguments = true;
|
|
||||||
} else {
|
|
||||||
file = '/bin/sh';
|
|
||||||
args = ['-c', command];
|
|
||||||
}
|
|
||||||
const proc = spawn(file, args, options);
|
|
||||||
proc.stdout.pipe(process.stdout);
|
|
||||||
proc.stderr.pipe(process.stderr);
|
|
||||||
proc.on('error', (error) => {
|
|
||||||
util.log(util.colors.red(error));
|
|
||||||
cb(error);
|
|
||||||
});
|
|
||||||
proc.on('exit', (code) => {
|
|
||||||
if (code) {
|
|
||||||
cb(code);
|
|
||||||
} else {
|
|
||||||
exec(commands, cb);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
gulp.task('build-prism', () => gulp.src(prismScripts)
|
gulp.task('build-prism', () => gulp.src(prismScripts)
|
||||||
.pipe(concat('prism.js'))
|
.pipe(concat('prism.js'))
|
||||||
.pipe(gulp.dest(path.dirname(require.resolve('prismjs')))));
|
.pipe(gulp.dest(path.dirname(require.resolve('prismjs')))));
|
||||||
|
|
||||||
gulp.task('tag', (cb) => {
|
|
||||||
const tag = `v${version}`;
|
|
||||||
util.log(`Tagging as: ${util.colors.cyan(tag)}`);
|
|
||||||
exec([
|
|
||||||
'git add package.json',
|
|
||||||
'git commit -m "Prepare release"; true', // Ignore "no changes added to commit" error
|
|
||||||
`git tag -a ${tag} -m "Version ${version}"`,
|
|
||||||
'git push origin master --tags',
|
|
||||||
'npm publish',
|
|
||||||
], cb);
|
|
||||||
});
|
|
||||||
|
@ -13,10 +13,11 @@
|
|||||||
"start": "node build/dev-server.js",
|
"start": "node build/dev-server.js",
|
||||||
"build": "node build/build.js",
|
"build": "node build/build.js",
|
||||||
"lint": "eslint --ext .js,.vue src",
|
"lint": "eslint --ext .js,.vue src",
|
||||||
"patch": "yarn run lint && npm-bump patch",
|
"preversion": "npm run lint",
|
||||||
"minor": "yarn run lint && npm-bump minor",
|
"postversion": "git push origin master --tags && npm publish",
|
||||||
"major": "yarn run lint && npm-bump major",
|
"patch": "npm version patch -m \"Tag v%s\"",
|
||||||
"tag": "gulp tag"
|
"minor": "npm version minor -m \"Tag v%s\"",
|
||||||
|
"major": "npm version major -m \"Tag v%s\""
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bezier-easing": "^1.1.0",
|
"bezier-easing": "^1.1.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user