From 3a1160d30cad275af9eb5c9e5142714b974123e6 Mon Sep 17 00:00:00 2001 From: Chris Thielen Date: Sun, 3 Apr 2016 01:19:21 -0500 Subject: [PATCH] chore(build): fix packaging stateEvents.js into ng1-bower and ng1 closes #2655 --- packages/core/{.npmignore => npmignore} | 0 packages/ng1-bower/gitignore | 7 ++++ packages/ng1-bower/tsconfig.json | 9 +++++ packages/ng1-bower/webpack.config.js | 46 +++++++++++++++++++++++++ packages/ng1/{.npmignore => npmignore} | 0 packages/ng1/webpack.config.js | 4 ++- packages/ng2/{.npmignore => npmignore} | 0 scripts/package.js | 4 +-- 8 files changed, 67 insertions(+), 3 deletions(-) rename packages/core/{.npmignore => npmignore} (100%) create mode 100644 packages/ng1-bower/gitignore create mode 100644 packages/ng1-bower/tsconfig.json create mode 100644 packages/ng1-bower/webpack.config.js rename packages/ng1/{.npmignore => npmignore} (100%) rename packages/ng2/{.npmignore => npmignore} (100%) diff --git a/packages/core/.npmignore b/packages/core/npmignore similarity index 100% rename from packages/core/.npmignore rename to packages/core/npmignore diff --git a/packages/ng1-bower/gitignore b/packages/ng1-bower/gitignore new file mode 100644 index 000000000..afe5ea5f5 --- /dev/null +++ b/packages/ng1-bower/gitignore @@ -0,0 +1,7 @@ +**/tsconfig.json +**/webpack.config.js +**/node_modules +**/ng2* +commonjs +typings +.* diff --git a/packages/ng1-bower/tsconfig.json b/packages/ng1-bower/tsconfig.json new file mode 100644 index 000000000..aed791b41 --- /dev/null +++ b/packages/ng1-bower/tsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { "rootDir": ".", "outDir": "../commonjs" }, + "files": [ + "ng1.ts", + "ng1/stateEvents.ts", + "../typings/es6-shim/es6-shim.d.ts" , + "../typings/angularjs/angular.d.ts" + ] +} diff --git a/packages/ng1-bower/webpack.config.js b/packages/ng1-bower/webpack.config.js new file mode 100644 index 000000000..230fc15e7 --- /dev/null +++ b/packages/ng1-bower/webpack.config.js @@ -0,0 +1,46 @@ +// /../../src/ is copied to /src +// This config is then copied to /src/webpack.config.js + +var pkg = require('../bower.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: { + "angular-ui-router": "./ng1.ts", + "angular-ui-router.min": "./ng1.ts", + "stateEvents": "./ng1/stateEvents.ts", + "stateEvents.min": "./ng1/stateEvents.ts" + }, + + output: { + path: __dirname + "/../release", + filename: "[name].js", + libraryTarget: "umd", + library: "angular-ui-router", + umdNamedDefine: true + }, + + devtool: 'source-map', + + resolve: { + modulesDirectories: ['../../node_modules'], + extensions: ['', '.js', '.ts'] + }, + + plugins: [ + new webpack.optimize.UglifyJsPlugin({ + include: /\.min\.js$/, minimize: true + }), + new webpack.BannerPlugin(banner) + ], + + module: { + loaders: [ + { test: /\.ts$/, loader: "ts-loader" } + ] + } +}; diff --git a/packages/ng1/.npmignore b/packages/ng1/npmignore similarity index 100% rename from packages/ng1/.npmignore rename to packages/ng1/npmignore diff --git a/packages/ng1/webpack.config.js b/packages/ng1/webpack.config.js index ee4be99a2..fa8702ad9 100644 --- a/packages/ng1/webpack.config.js +++ b/packages/ng1/webpack.config.js @@ -11,7 +11,9 @@ var webpack = require('webpack'); module.exports = { entry: { "angular-ui-router": "./ng1.ts", - "angular-ui-router.min": "./ng1.ts" + "angular-ui-router.min": "./ng1.ts", + "stateEvents": "./ng1/stateEvents.ts", + "stateEvents.min": "./ng1/stateEvents.ts" }, output: { diff --git a/packages/ng2/.npmignore b/packages/ng2/npmignore similarity index 100% rename from packages/ng2/.npmignore rename to packages/ng2/npmignore diff --git a/scripts/package.js b/scripts/package.js index e19152747..b1e1566e0 100755 --- a/scripts/package.js +++ b/scripts/package.js @@ -99,9 +99,9 @@ function prepPackage(pkgName) { // Copy any of these files from the packages dir // Override any baseFiles with the copy from the package dir. - let pkgFiles = ['.gitignore', '.npmignore']; + let pkgFiles = ['gitignore', 'npmignore']; baseFiles.concat(pkgFiles).filter(file => test('-f', `${paths.pkgsrc}/${file}`)) - .forEach(file => cp(`${paths.pkgsrc}/${file}`, paths.build)); + .forEach(file => cp(`${paths.pkgsrc}/${file}`, `${paths.build}/.${file}`)); cp(files.webpack, paths.srcCopy);