feature: Publish gulptasks are implemented

This commit is contained in:
bharathm 2017-03-28 14:21:42 +05:30
Родитель 9f1d5605bd
Коммит 67be562e9c
6 изменённых файлов: 52 добавлений и 4 удалений

6
.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,6 @@
node_modules
src/*.js
test/*.js
dist
coverage
.vscode

11
.npmignore Normal file
Просмотреть файл

@ -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

Просмотреть файл

@ -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
}
}
}