Skip to content

Commit

Permalink
feat(build): support offline template compilation
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

For System.js users the path to the UMD files has changed:

Before:
```
node_modules/angular2-resizable/angular2-resizable.js
```

After:
```
node_modules/angular2-resizable/dist/umd/angular2-resizable.js
```
  • Loading branch information
Matt Lewis committed Sep 25, 2016
1 parent db794e3 commit f3fe12a
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 18 deletions.
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
"name": "angular2-resizable",
"version": "0.3.3",
"description": "An angular2 directive that allows an element to be dragged and resized",
"main": "./angular2-resizable.js",
"typings": "./angular2-resizable.d.ts",
"main": "./dist/umd/angular2-resizable.js",
"module": "./dist/esm/src/index.js",
"typings": "./dist/esm/src/index.d.ts",
"scripts": {
"start": "concurrently --raw \"webpack-dev-server --open\" \"npm run test:watch\"",
"build:demo": "webpack -p",
"build:dist": "webpack --config webpack.config.dist.js",
"build:umd": "webpack --config webpack.config.umd.js",
"build:ngc": "ngc -p tsconfig-ngc.json",
"build:dist": "npm run build:umd && npm run build:ngc",
"build:clean": "rm -rf dist",
"test": "karma start",
"test:watch": "karma start --watch",
"clean": "del ./src/*.d.ts ./demo/*.d.ts ./test/*.d.ts angular2-resizable.d.ts angular2-resizable.js*",
"commit": "git-cz",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"typedoc": "typedoc --options typedoc.json src/*.ts",
Expand All @@ -36,9 +39,11 @@
"devDependencies": {
"@angular/common": "~2.0.1",
"@angular/compiler": "~2.0.1",
"@angular/compiler-cli": "~0.6.3",
"@angular/core": "~2.0.1",
"@angular/platform-browser": "~2.0.1",
"@angular/platform-browser-dynamic": "~2.0.1",
"@angular/platform-server": "~2.0.1",
"@types/chai": "~3.4.33",
"@types/core-js": "~0.9.34",
"@types/jasmine": "~2.2.34",
Expand All @@ -51,7 +56,6 @@
"conventional-changelog-cli": "~1.2.0",
"core-js": "~2.4.1",
"cz-conventional-changelog": "~1.2.0",
"del-cli": "~0.2.0",
"ghooks": "~1.3.2",
"imports-loader": "~0.6.5",
"jasmine-core": "~2.5.0",
Expand Down Expand Up @@ -82,10 +86,7 @@
"@angular/core": "^2.0.0"
},
"files": [
"angular2-resizable.js",
"angular2-resizable.js.map",
"angular2-resizable.d.ts",
"src/**/*.d.ts"
"dist"
],
"config": {
"ghooks": {
Expand Down
25 changes: 25 additions & 0 deletions tsconfig-ngc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"declaration": true,
"experimentalDecorators": true,
"baseUrl": ".",
"stripInternal": true,
"outDir": "./dist/esm",
"rootDir": "./",
"sourceMap": true,
"inlineSources": true,
"skipLibCheck": true
},
"files": [
"src/index.ts"
],
"angularCompilerOptions": {
"strictMetadataEmit": true,
"genDir": "./dist/esm",
"skipTemplateCodegen": true,
"debug": true
}
}
4 changes: 2 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ module.exports = {
},
module: {
preLoaders: [{
test: /\.ts$/, loader: 'tslint?emitErrors=false&failOnHint=false', exclude: /node_modules/
test: /\.ts$/, loader: 'tslint-loader?emitErrors=false&failOnHint=false', exclude: /node_modules/
}],
loaders: [{
test: /\.ts$/, loader: 'ts', exclude: /node_modules/
test: /\.ts$/, loader: 'ts-loader', exclude: /node_modules/
}]
},
resolve: {
Expand Down
10 changes: 3 additions & 7 deletions webpack.config.dist.js → webpack.config.umd.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
entry: './src/index.ts',
output: {
path: __dirname + '/dist/umd',
filename: './angular2-resizable.js',
libraryTarget: 'umd',
library: 'angular2Resizable'
Expand Down Expand Up @@ -76,15 +77,10 @@ module.exports = {
devtool: 'source-map',
module: {
preLoaders: [{
test: /\.ts$/, loader: 'tslint?emitErrors=true&failOnHint=true', exclude: /node_modules/
test: /\.ts$/, loader: 'tslint-loader?emitErrors=true&failOnHint=true', exclude: /node_modules/
}],
loaders: [{
test: /\.ts$/, loader: 'ts', exclude: /node_modules/,
query: {
compilerOptions: {
declaration: true
}
}
test: /\.ts$/, loader: 'ts-loader', exclude: /node_modules/
}]
},
resolve: {
Expand Down

0 comments on commit f3fe12a

Please sign in to comment.