Skip to content

Commit

Permalink
chore(build): Fix some build scripts; add banner to bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen committed Mar 27, 2016
1 parent 77b4297 commit d000919
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"compilerOptions": { "rootDir": ".", "outDir": ".." },
"files": [ "core.ts" ]
"files": [ "core.ts", "../typings/es6-shim/es6-shim.d.ts" ]
}
9 changes: 8 additions & 1 deletion packages/core/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// <package>/../../src/ is copied to <package>/src
// This config is then copied to <package>/src/webpack.config.js

var pkg = require('../package.json');
var banner = pkg.description + '\n' +
'@version v' + pkg.version + '\n' +
'@link ' + pkg.homepage + '\n' +
'@license MIT License, http://www.opensource.org/licenses/MIT';

var webpack = require('webpack');
module.exports = {
entry: {
Expand All @@ -26,7 +32,8 @@ module.exports = {
plugins: [
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/, minimize: true
})
}),
new webpack.BannerPlugin(banner)
],

module: {
Expand Down
4 changes: 2 additions & 2 deletions packages/ng1-bower/bower.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "angular-ui-router",
"version": "1.0.0alpha0",
"description": "State-based routing for AngularJS",
"license" : "MIT",
"main": "./release/angular-ui-router.js",
"dependencies": {
"angular": ">= 1.3.0"
"angular": ">= 1.2.0"
},
"ignore": [
"**/.*",
Expand Down
7 changes: 6 additions & 1 deletion packages/ng1/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"compilerOptions": { "rootDir": ".", "outDir": "../commonjs" },
"files": [ "ng1.ts", "ng1/stateEvents.ts" ]
"files": [
"ng1.ts",
"ng1/stateEvents.ts",
"../typings/es6-shim/es6-shim.d.ts" ,
"../typings/angularjs/angular.d.ts"
]
}
9 changes: 8 additions & 1 deletion packages/ng1/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// <package>/../../src/ is copied to <package>/src
// This config is then copied to <package>/src/webpack.config.js

var pkg = require('../package.json');
var banner = pkg.description + '\n' +
'@version v' + pkg.version + '\n' +
'@link ' + pkg.homepage + '\n' +
'@license MIT License, http://www.opensource.org/licenses/MIT';

var webpack = require('webpack');
module.exports = {
entry: {
Expand All @@ -26,7 +32,8 @@ module.exports = {
plugins: [
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/, minimize: true
})
}),
new webpack.BannerPlugin(banner)
],

module: {
Expand Down
2 changes: 1 addition & 1 deletion packages/ng2/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"sourceMap": true
},
"files": [
"ng2.ts"
"ng2.ts", "../typings/es6-shim/es6-shim.d.ts"
]
}
9 changes: 8 additions & 1 deletion packages/ng2/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// <package>/../../src/ is copied to <package>/src
// This config is then copied to <package>/src/webpack.config.js

var pkg = require('../package.json');
var banner = pkg.description + '\n' +
'@version v' + pkg.version + '\n' +
'@link ' + pkg.homepage + '\n' +
'@license MIT License, http://www.opensource.org/licenses/MIT';

var webpack = require('webpack');
module.exports = {
entry: {
Expand All @@ -26,7 +32,8 @@ module.exports = {
plugins: [
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/, minimize: true
})
}),
new webpack.BannerPlugin(banner)
],

module: {
Expand Down
18 changes: 17 additions & 1 deletion scripts/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ function prepPackage(pkgName) {
let files = {};
files.sources = path.resolve(paths.pkgsrc, "sources.json");
files.pkgfile = path.resolve(paths.pkgsrc, "package.json");
files.bowerfile = path.resolve(paths.pkgsrc, "bower.json");
files.tsconfig = path.resolve(paths.pkgsrc, "tsconfig.json");
files.webpack = path.resolve(paths.pkgsrc, "webpack.config.js");

Expand Down Expand Up @@ -66,6 +67,21 @@ function prepPackage(pkgName) {
fs.writeFileSync(packageJsonDest, asJson(packageJson));
}

// If the package definition contains a bower.json, merge it with specific fields from the package.json in
// the project root, and write it to the package build dir
if (test('-f', files.bowerfile)) {
let bowerJsonDest = `${paths.build}/bower.json`;
let pkg = require('../package.json');

echo(`Merging ${files.bowerfile} with ${paths.basedir}/package.json ...`);
echo(`... and writing to ${bowerJsonDest}`);

let packageJson = JSON.parse(fs.readFileSync(files.bowerfile, 'utf8'));
packageJson.version = pkg.version;
packageJson.homepage = pkg.homepage;
fs.writeFileSync(bowerJsonDest, asJson(packageJson));
}

echo(`Copying typescript sources to ${paths.srcCopy}`);
cp('-R', `${paths.basedir}/src/`, paths.srcCopy);
console.log("Excludes: " + sources.excludes);
Expand All @@ -83,7 +99,7 @@ function prepPackage(pkgName) {

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

Expand Down
6 changes: 1 addition & 5 deletions scripts/show_changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,5 @@ if(require.main === module) {
}

function showChangelog(context, gitOpts) {
console.log(context);
console.log(gitOpts);
conventionalChangelog(options, context, gitOpts)
.pipe(process.stdout);

conventionalChangelog(options, context, gitOpts).pipe(process.stdout);
}

0 comments on commit d000919

Please sign in to comment.