Skip to content

Commit 8d02b2b

Browse files
chore(build): Generate ui-router-core changelog using tag ranges extracted from package.json dependencies
chore(build): Remove old scripts chore(*): bump core dependency
1 parent 94cb1d0 commit 8d02b2b

File tree

8 files changed

+42
-271
lines changed

8 files changed

+42
-271
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
src
55
config
66
test
7+
scripts
78

89
node_modules
910

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"main": "lib/ng2.js",
5151
"typings": "lib/ng2.d.ts",
5252
"dependencies": {
53-
"ui-router-core": "=1.0.0"
53+
"ui-router-core": "=1.0.1"
5454
},
5555
"peerDependencies": {
5656
"@angular/core": "^2.0.0",

scripts/docs.sh

Lines changed: 0 additions & 42 deletions
This file was deleted.

scripts/package.js

Lines changed: 0 additions & 135 deletions
This file was deleted.

scripts/publish_bower.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

scripts/release.js

Lines changed: 15 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -2,80 +2,26 @@
22
"use strict";
33

44
require('shelljs/global');
5-
let _ = require('lodash');
6-
var argv = require('yargs')
7-
.usage('Usage: $0 <packages> [options]')
8-
.command('packages', '[optional] Comma separated list of packages to build.')
9-
.alias('c', 'no-changelog')
10-
.describe('c', 'Do not update CHANGELOG.md')
11-
.alias('b', 'branch')
12-
.nargs('b', 1)
13-
.describe('b', 'Specify non-master branch to release from')
14-
.help('h')
15-
.alias('h', 'help')
16-
.example('$0 --no-changelog --branch feature', 'Release all packages from "feature" branch')
17-
.argv;
5+
let readlineSync = require('readline-sync');
6+
let util = require('./util');
7+
let _exec = util._exec;
188

19-
let path = require('path');
20-
let _exec = require('./util')._exec;
219
let version = require('../package.json').version;
22-
let rootDir = path.resolve(__dirname, '..');
23-
let commands = []; // List of commands that will commit the release
2410

25-
cd(rootDir);
26-
27-
let knownProjects = ['core', 'ng1', 'ng1-bower', 'ng2'];
28-
let projects = knownProjects.slice();
29-
30-
projects.forEach(project => {
31-
if (knownProjects.indexOf(project) === -1)
32-
throw new Error(`Unknwon project: ${project}; try: ${knownProjects.join(',')}`);
33-
});
34-
35-
projects = projects.reduce((memo, key) => { memo[key] = true; return memo; }, {});
36-
37-
38-
echo('--> Checking working copy status...');
39-
_exec(`node ${rootDir}/scripts/ensure_clean_master.js ${argv.branch || 'master'}`);
40-
41-
commands.push(``);
42-
commands.push(``);
43-
commands.push(`################# To perform the release ################# `);
44-
commands.push(``);
45-
46-
if (!argv['no-changelog']) {
47-
echo('--> Updating CHANGELOG...');
48-
_exec(`node ${rootDir}/scripts/update_changelog.js`);
49-
50-
echo('--> Committing changelog...');
51-
commands.push(`git commit -m "chore(*): Release prep - Update CHANGELOG" CHANGELOG.md`);
11+
if (!readlineSync.keyInYN('Did you bump the version number in package.json?')) {
12+
process.exit(1);
5213
}
5314

54-
commands.push(`git tag ${version}`);
55-
commands.push(`git push origin ${version}`);
56-
57-
58-
Object.keys(projects).map(project => {
59-
echo(`Packaging ${project} for npm...`);
60-
_exec(`node ${rootDir}/scripts/package.js ${project}`);
61-
var pkgPath = path.resolve(rootDir, "build_packages", project);
62-
cd(pkgPath);
63-
64-
if (test('-f', './package.json')) {
65-
commands.push(`echo To publish ${project} to npm:`);
66-
commands.push(`cd ${pkgPath}`);
67-
commands.push(`npm publish`);
68-
commands.push(``);
69-
}
15+
if (!readlineSync.keyInYN('Did you update CHANGELOG.md using scripts/update_changelog.js?')) {
16+
process.exit(1);
17+
}
7018

71-
if (test('-f', './bower.json')) {
72-
commands.push(`echo To publish ${project} to bower:`);
73-
commands.push(`cd ${pkgPath}`);
74-
commands.push(`node ${rootDir}/scripts/publish_bower.js`);
75-
commands.push(``);
76-
}
77-
});
78-
79-
commands.forEach(line => echo(line));
19+
if (!readlineSync.keyInYN('Did you commit/push all changes back to origin?')) {
20+
process.exit(1);
21+
}
8022

23+
util.ensureCleanMaster('master');
24+
_exec(`npm publish`);
25+
_exec(`git tag ${version}`);
26+
_exec(`git push origin ${version}`);
8127

scripts/show_core_changelog.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!env node
2+
"use strict";
3+
var gitSemverTags = require('git-semver-tags');
4+
var shelljs = require('shelljs');
5+
var path = require('path');
6+
7+
shelljs.config.silent = true;
8+
gitSemverTags(function (err, val) {
9+
var fromTag;
10+
if(require.main === module) {
11+
if (process.argv[2]) {
12+
fromTag = process.argv[2];
13+
}
14+
} else {
15+
var prev = shelljs.exec('git show ' + val[0] + ':package.json', {silent:true}).stdout;
16+
fromTag = JSON.parse(prev).dependencies['ui-router-core'].replace(/[=~^]/, "");
17+
}
18+
19+
var toTag = require("../package.json").dependencies['ui-router-core'].replace(/[=~^]/g, "");
20+
shelljs.pushd(path.join(__dirname, "../../ui-router-core"));
21+
// console.log("node " + path.join(__dirname, "../../ui-router-core/scripts/show_changelog.js") + " " + fromTag + " " + toTag)
22+
shelljs.config.silent = false;
23+
shelljs.exec("node " + path.join(__dirname, "../../ui-router-core/scripts/show_changelog.js") + " " + fromTag + " " + toTag)
24+
});

scripts/update_changelog.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ cd(path.resolve(__dirname, '..'));
1010
echo('Updating CHANGELOG...');
1111
cp('CHANGELOG.md', 'CHANGELOG.bak');
1212
_exec('node ./scripts/show_changelog.js >> CHANGELOG.new');
13+
_exec('node ./scripts/show_core_changelog.js >> CHANGELOG.new');
1314
_exec('cat CHANGELOG.new CHANGELOG.bak > CHANGELOG.md');
1415
rm('CHANGELOG.bak', 'CHANGELOG.new');

0 commit comments

Comments
 (0)