Skip to content

Commit

Permalink
chore(build): fix packaging stateEvents.js into ng1-bower and ng1
Browse files Browse the repository at this point in the history
closes #2655
  • Loading branch information
christopherthielen committed Apr 3, 2016
1 parent b8412da commit 3a1160d
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 3 deletions.
File renamed without changes.
7 changes: 7 additions & 0 deletions packages/ng1-bower/gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**/tsconfig.json
**/webpack.config.js
**/node_modules
**/ng2*
commonjs
typings
.*
9 changes: 9 additions & 0 deletions packages/ng1-bower/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
46 changes: 46 additions & 0 deletions packages/ng1-bower/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// <package>/../../src/ is copied to <package>/src
// This config is then copied to <package>/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: {

This comment has been minimized.

Copy link
@earlyster

earlyster Sep 13, 2016

When using require js to load angular-ui-router and stateEvents ... stateEvents is never loaded because umd module has the same name as angular-ui-router.

This comment has been minimized.

Copy link
@christopherthielen

christopherthielen Sep 13, 2016

Author Contributor

doh! will you file a bug?

This comment has been minimized.

Copy link
@earlyster

earlyster Sep 13, 2016

FYI... I was trying to replace

$scope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState) {

})

handler with new transitions but it wasn't clear how do we do this.

This comment has been minimized.

Copy link
@christopherthielen

christopherthielen Sep 13, 2016

Author Contributor

it wasn't clear how do we do this.

$transitions.onSuccess({}, function(transition) {
  var toState = transition.to();
  var toParams = transition.params();
  var fromState = transition.from();
  ...
});

This comment has been minimized.

Copy link
@earlyster

earlyster Sep 16, 2016

Can you do this with multiple ng-apps on one page?
I am running into issues with multiple ng apps on same page. Where the injector is from the last app and templateCache and $rootScope is not the one I want.

This comment has been minimized.

Copy link
@christopherthielen

christopherthielen via email Sep 16, 2016

Author Contributor
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" }
]
}
};
File renamed without changes.
4 changes: 3 additions & 1 deletion packages/ng1/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions scripts/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 3a1160d

Please sign in to comment.