Skip to content

Commit d000919

Browse files
chore(build): Fix some build scripts; add banner to bundles
1 parent 77b4297 commit d000919

File tree

9 files changed

+52
-14
lines changed

9 files changed

+52
-14
lines changed

packages/core/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"compilerOptions": { "rootDir": ".", "outDir": ".." },
3-
"files": [ "core.ts" ]
3+
"files": [ "core.ts", "../typings/es6-shim/es6-shim.d.ts" ]
44
}

packages/core/webpack.config.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
// <package>/../../src/ is copied to <package>/src
22
// This config is then copied to <package>/src/webpack.config.js
33

4+
var pkg = require('../package.json');
5+
var banner = pkg.description + '\n' +
6+
'@version v' + pkg.version + '\n' +
7+
'@link ' + pkg.homepage + '\n' +
8+
'@license MIT License, http://www.opensource.org/licenses/MIT';
9+
410
var webpack = require('webpack');
511
module.exports = {
612
entry: {
@@ -26,7 +32,8 @@ module.exports = {
2632
plugins: [
2733
new webpack.optimize.UglifyJsPlugin({
2834
include: /\.min\.js$/, minimize: true
29-
})
35+
}),
36+
new webpack.BannerPlugin(banner)
3037
],
3138

3239
module: {

packages/ng1-bower/bower.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "angular-ui-router",
3-
"version": "1.0.0alpha0",
3+
"description": "State-based routing for AngularJS",
44
"license" : "MIT",
55
"main": "./release/angular-ui-router.js",
66
"dependencies": {
7-
"angular": ">= 1.3.0"
7+
"angular": ">= 1.2.0"
88
},
99
"ignore": [
1010
"**/.*",

packages/ng1/tsconfig.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
{
22
"compilerOptions": { "rootDir": ".", "outDir": "../commonjs" },
3-
"files": [ "ng1.ts", "ng1/stateEvents.ts" ]
3+
"files": [
4+
"ng1.ts",
5+
"ng1/stateEvents.ts",
6+
"../typings/es6-shim/es6-shim.d.ts" ,
7+
"../typings/angularjs/angular.d.ts"
8+
]
49
}

packages/ng1/webpack.config.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
// <package>/../../src/ is copied to <package>/src
22
// This config is then copied to <package>/src/webpack.config.js
33

4+
var pkg = require('../package.json');
5+
var banner = pkg.description + '\n' +
6+
'@version v' + pkg.version + '\n' +
7+
'@link ' + pkg.homepage + '\n' +
8+
'@license MIT License, http://www.opensource.org/licenses/MIT';
9+
410
var webpack = require('webpack');
511
module.exports = {
612
entry: {
@@ -26,7 +32,8 @@ module.exports = {
2632
plugins: [
2733
new webpack.optimize.UglifyJsPlugin({
2834
include: /\.min\.js$/, minimize: true
29-
})
35+
}),
36+
new webpack.BannerPlugin(banner)
3037
],
3138

3239
module: {

packages/ng2/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
"sourceMap": true
1212
},
1313
"files": [
14-
"ng2.ts"
14+
"ng2.ts", "../typings/es6-shim/es6-shim.d.ts"
1515
]
1616
}

packages/ng2/webpack.config.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
// <package>/../../src/ is copied to <package>/src
22
// This config is then copied to <package>/src/webpack.config.js
33

4+
var pkg = require('../package.json');
5+
var banner = pkg.description + '\n' +
6+
'@version v' + pkg.version + '\n' +
7+
'@link ' + pkg.homepage + '\n' +
8+
'@license MIT License, http://www.opensource.org/licenses/MIT';
9+
410
var webpack = require('webpack');
511
module.exports = {
612
entry: {
@@ -26,7 +32,8 @@ module.exports = {
2632
plugins: [
2733
new webpack.optimize.UglifyJsPlugin({
2834
include: /\.min\.js$/, minimize: true
29-
})
35+
}),
36+
new webpack.BannerPlugin(banner)
3037
],
3138

3239
module: {

scripts/package.js

+17-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function prepPackage(pkgName) {
2929
let files = {};
3030
files.sources = path.resolve(paths.pkgsrc, "sources.json");
3131
files.pkgfile = path.resolve(paths.pkgsrc, "package.json");
32+
files.bowerfile = path.resolve(paths.pkgsrc, "bower.json");
3233
files.tsconfig = path.resolve(paths.pkgsrc, "tsconfig.json");
3334
files.webpack = path.resolve(paths.pkgsrc, "webpack.config.js");
3435

@@ -66,6 +67,21 @@ function prepPackage(pkgName) {
6667
fs.writeFileSync(packageJsonDest, asJson(packageJson));
6768
}
6869

70+
// If the package definition contains a bower.json, merge it with specific fields from the package.json in
71+
// the project root, and write it to the package build dir
72+
if (test('-f', files.bowerfile)) {
73+
let bowerJsonDest = `${paths.build}/bower.json`;
74+
let pkg = require('../package.json');
75+
76+
echo(`Merging ${files.bowerfile} with ${paths.basedir}/package.json ...`);
77+
echo(`... and writing to ${bowerJsonDest}`);
78+
79+
let packageJson = JSON.parse(fs.readFileSync(files.bowerfile, 'utf8'));
80+
packageJson.version = pkg.version;
81+
packageJson.homepage = pkg.homepage;
82+
fs.writeFileSync(bowerJsonDest, asJson(packageJson));
83+
}
84+
6985
echo(`Copying typescript sources to ${paths.srcCopy}`);
7086
cp('-R', `${paths.basedir}/src/`, paths.srcCopy);
7187
console.log("Excludes: " + sources.excludes);
@@ -83,7 +99,7 @@ function prepPackage(pkgName) {
8399

84100
// Copy any of these files from the packages dir
85101
// Override any baseFiles with the copy from the package dir.
86-
let pkgFiles = ['bower.json', '.gitignore', '.npmignore'];
102+
let pkgFiles = ['.gitignore', '.npmignore'];
87103
baseFiles.concat(pkgFiles).filter(file => test('-f', `${paths.pkgsrc}/${file}`))
88104
.forEach(file => cp(`${paths.pkgsrc}/${file}`, paths.build));
89105

scripts/show_changelog.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,5 @@ if(require.main === module) {
2424
}
2525

2626
function showChangelog(context, gitOpts) {
27-
console.log(context);
28-
console.log(gitOpts);
29-
conventionalChangelog(options, context, gitOpts)
30-
.pipe(process.stdout);
31-
27+
conventionalChangelog(options, context, gitOpts).pipe(process.stdout);
3228
}

0 commit comments

Comments
 (0)