feature: Publish gulptasks are implemented
This commit is contained in:
Родитель
9f1d5605bd
Коммит
67be562e9c
|
@ -0,0 +1,6 @@
|
|||
node_modules
|
||||
src/*.js
|
||||
test/*.js
|
||||
dist
|
||||
coverage
|
||||
.vscode
|
|
@ -0,0 +1,11 @@
|
|||
.\test
|
||||
gulpfile.js
|
||||
karma.conf.js
|
||||
system.config.js
|
||||
test-main.js
|
||||
tslint.json
|
||||
node_modules
|
||||
coverage
|
||||
.vscode
|
||||
.gitignore
|
||||
tsconfig.json
|
30
gulpfile.js
30
gulpfile.js
|
@ -3,6 +3,7 @@ var karma = require('karma');
|
|||
var ts = require("gulp-typescript");
|
||||
var tsProject = ts.createProject("tsconfig.json");
|
||||
var tslint = require("gulp-tslint");
|
||||
var exec = require('child_process').execSync;
|
||||
|
||||
/**
|
||||
* Compile the source and ship to dist folder
|
||||
|
@ -33,3 +34,32 @@ gulp.task('lint', () => {
|
|||
}))
|
||||
.pipe(tslint.report())
|
||||
});
|
||||
|
||||
gulp.task('version', () => {
|
||||
var releaseType = "patch";
|
||||
// Fetching last commit message
|
||||
var commitmsg = exec("git log -n 1 --format=%s").toString("utf8").replace(/\n/g, " ");
|
||||
|
||||
// Looking for keyword "breaking-change" to mark this release as major
|
||||
if (/breaking-change/i.test(commitmsg)) {
|
||||
releaseType = "major";
|
||||
}
|
||||
// Looking for prefix "feature" to mark this release as minor
|
||||
else if (commitmsg.split(":", 2)[0].toLowerCase() == "feature") {
|
||||
releaseType = "minor";
|
||||
}
|
||||
|
||||
// Executing npm version command.
|
||||
exec(`npm version ${releaseType} --no-git-tag-version -m "${commitmsg}"`);
|
||||
|
||||
// Committing the package.json
|
||||
exec(`git commit --no-verify package.json -m "ci-skip: version update"`);
|
||||
|
||||
// Pushing the changes to current branch
|
||||
exec("git push --force");
|
||||
});
|
||||
|
||||
gulp.task('publish:npm', ["version"], () => {
|
||||
// Executing npm publish command.
|
||||
exec("npm publish");
|
||||
});
|
|
@ -1,9 +1,10 @@
|
|||
{
|
||||
"name": "ts-whitepaper",
|
||||
"name": "cd-typescript-seed",
|
||||
"version": "1.0.0",
|
||||
"description": "Test project",
|
||||
"description": "Seed project for TypeScript configured with Jasmine, SystemJS, Karma and Jenkinsfile",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"prepublish": "gulp lint && gulp compile:dist",
|
||||
"test": "gulp test"
|
||||
},
|
||||
"author": "",
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
export function sayHello(name: string): string{
|
||||
export function sayHello(name: string): string {
|
||||
return `Hello ${name || ""}`;
|
||||
}
|
|
@ -6,4 +6,4 @@
|
|||
"no-namespace": true,
|
||||
"no-trailing-whitespace": true
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче