-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathJakefile
61 lines (50 loc) · 1.72 KB
/
Jakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
desc('Run unit tests.');
task('test', function() {
console.log('Running unit tests...');
jake.exec(['jasmine-node --coffee test'], complete, {stdout: true});
});
desc('Bump minor version, update changelog, create tag, push to github.');
task('version', function () {
var fs = require('fs');
var packagePath = process.cwd() + '/package.json';
var pkg = JSON.parse(fs.readFileSync(packagePath).toString());
var versionArray = pkg.version.split('.');
var previousVersionTag = 'v' + pkg.version;
// bump minor version
versionArray.push(parseInt(versionArray.pop(), 10) + 1);
pkg.version = versionArray.join('.');
// Update package.json with the new version-info
fs.writeFileSync(packagePath, JSON.stringify(pkg, true, 2));
var TEMP_FILE = '.changelog.temp';
var message = 'Bump version to v' + pkg.version;
jake.exec([
// update changelog
'echo "### v' + pkg.version + '" > ' + TEMP_FILE,
'git log --pretty="* %s" ' + previousVersionTag + '..HEAD >> ' + TEMP_FILE,
'echo "" >> ' + TEMP_FILE,
'cat CHANGELOG.md >> ' + TEMP_FILE,
'mv ' + TEMP_FILE + ' CHANGELOG.md',
'sublime -w CHANGELOG.md',
// commit + push to github
'git commit package.json CHANGELOG.md -m "' + message + '"',
'git push origin master',
'git tag -a v' + pkg.version + ' -m "Version ' + pkg.version + '"',
'git push --tags'
], function () {
console.log(message);
complete();
});
});
desc('Bump version, publish to npm.');
task('publish', ['version'], function() {
jake.exec([
'npm publish'
], function() {
console.log('Published to npm');
complete();
});
});
desc('Run JSLint check.');
task('jsl', function() {
jake.exec(['jsl -conf jsl.conf'], complete, {stdout: true});
});