Skip to content
This repository was archived by the owner on Jul 27, 2020. It is now read-only.

Commit 84398d6

Browse files
authored
chore: Rework build and upgrade to Angular 2 RC6 (#8)
1 parent 22b78a2 commit 84398d6

21 files changed

+331
-460
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ tmp
2929
typings
3030
dist
3131
example_dist
32+
release

.npmignore

Lines changed: 0 additions & 29 deletions
This file was deleted.

example/index.html

Lines changed: 0 additions & 31 deletions
This file was deleted.

example/main.ts

Lines changed: 0 additions & 34 deletions
This file was deleted.

example/tsconfig.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './src/database';

karma.conf.js

Lines changed: 65 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,82 @@
1-
// Karma configuration
2-
// Generated on Wed Jan 06 2016 19:58:14 GMT-0800 (PST)
3-
var argv = require('yargs').argv;
1+
var path = require('path');
42

5-
module.exports = function(config) {
6-
config.set({
3+
module.exports = function(karma) {
4+
'use strict';
75

8-
// base path that will be used to resolve all patterns (eg. files, exclude)
9-
basePath: '',
6+
karma.set({
7+
basePath: __dirname,
108

11-
plugins: [ require('./spec/support/tsc-preprocessor'), 'karma-jasmine', 'karma-chrome-launcher'],
12-
// frameworks to use
13-
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
149
frameworks: ['jasmine'],
1510

16-
17-
// list of files / patterns to load in the browser
1811
files: [
19-
'node_modules/es6-shim/es6-shim.js',
20-
'node_modules/systemjs/dist/system.js',
21-
'spec/support/karma-system.js',
22-
'node_modules/reflect-metadata/Reflect.js',
23-
{pattern: 'node_modules/@angular/**/*.js', included: false},
24-
{pattern: 'node_modules/rxjs/**/*.js', included: false},
25-
26-
{pattern: 'src/**/*', included: false},
27-
{pattern: 'spec/**/*', included: false}
28-
],
29-
30-
31-
// list of files to exclude
32-
exclude: [
12+
{ pattern: 'tests.bundle.ts', watched: false }
3313
],
3414

15+
exclude: [],
3516

36-
// preprocess matching files before serving them to the browser
37-
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
3817
preprocessors: {
39-
'spec/*.ts': ['tsc'],
40-
'src/*.ts': ['tsc']
18+
'tests.bundle.ts': ['coverage', 'webpack', 'sourcemap']
4119
},
4220

21+
reporters: ['mocha', 'coverage'],
4322

44-
// test results reporter to use
45-
// possible values: 'dots', 'progress'
46-
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
47-
reporters: ['progress'],
48-
49-
50-
// web server port
51-
port: 9876,
23+
coverageReporter: {
24+
dir: 'coverage/',
25+
reporters: [
26+
{ type: 'text-summary' },
27+
{ type: 'json' },
28+
{ type: 'html' }
29+
]
30+
},
5231

32+
browsers: ['Chrome'],
5333

54-
// enable / disable colors in the output (reporters and logs)
34+
port: 9018,
35+
runnerPort: 9101,
5536
colors: true,
56-
57-
58-
// level of logging
59-
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
60-
logLevel: config.LOG_INFO,
61-
62-
63-
// enable / disable watching file and executing tests whenever any file changes
37+
logLevel: karma.LOG_INFO,
6438
autoWatch: true,
65-
66-
67-
// start these browsers
68-
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
69-
browsers: ['Chrome'],
70-
71-
72-
// Continuous Integration mode
73-
// if true, Karma captures browsers, runs the tests and exits
74-
singleRun: true,
75-
76-
// Concurrency level
77-
// how many browser should be started simultaneous
78-
concurrency: Infinity
79-
})
80-
}
39+
singleRun: false,
40+
webpackServer: { noInfo: true },
41+
webpack: {
42+
devtool: 'inline-source-map',
43+
resolve: {
44+
root: __dirname,
45+
extensions: ['', '.ts', '.js']
46+
},
47+
module: {
48+
preLoaders: [
49+
{
50+
test: /\.ts$/,
51+
loader: 'tslint-loader',
52+
exclude: [
53+
/node_modules/
54+
]
55+
}
56+
],
57+
loaders: [
58+
{
59+
test: /\.ts?$/,
60+
exclude: /(node_modules)/,
61+
loader: 'ts'
62+
}
63+
],
64+
postLoaders: [
65+
{
66+
test: /\.(js|ts)$/, loader: 'istanbul-instrumenter',
67+
include: path.resolve(__dirname, 'src'),
68+
exclude: [
69+
/\.(e2e|spec|bundle)\.ts$/,
70+
/node_modules/
71+
]
72+
}
73+
]
74+
},
75+
tslint: {
76+
emitErrors: false,
77+
failOnHint: false,
78+
resourcePath: 'src'
79+
}
80+
}
81+
});
82+
};

package.json

Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,58 @@
22
"name": "@ngrx/db",
33
"version": "1.1.1",
44
"description": "RxJS + IndexedDB for Angular2",
5-
"main": "index.js",
5+
"main": "bundles/db.umd.js",
6+
"module": "index.js",
67
"scripts": {
7-
"test": "karma start --ci",
8-
"prepare": "npm run clean && npm run build && npm run copy_package",
9-
"copy_package": "cp -r package.json dist/package.json",
10-
"watch": "karma start",
11-
"build": "tsc",
12-
"build_test": "tsc -p ./spec",
13-
"clean": "rm -rf dist",
14-
"clean_example": "rm -rf example_dist",
15-
"example": "npm run clean_example && tsc -p ./example && http-server"
8+
"karma": "karma start --single-run",
9+
"test": "npm run karma",
10+
"clean:pre": "rimraf release",
11+
"clean:post": "rimraf src/**/*.ngfactory.ts",
12+
"copy": "cpy LICENSE package.json README.md release",
13+
"build:js": "ngc -p tsconfig.dist.json",
14+
"build:umd": "rollup -c rollup.config.js",
15+
"build:uglify": "uglifyjs -c --screw-ie8 --comments -o ./release/bundles/db.min.umd.js ./release/bundles/db.umd.js",
16+
"prebuild": "npm run test && npm run clean:pre",
17+
"postbuild": "npm run clean:post && npm run copy",
18+
"build": "npm run build:js && npm run build:umd && npm run build:uglify"
1619
},
1720
"author": "Rob Wormald <[email protected]>",
1821
"license": "MIT",
1922
"peerDependencies": {
20-
"@angular/core": "^2.0.0-rc.1",
21-
"rxjs": "5.0.0-beta.6"
23+
"@angular/core": "^2.0.0-rc.6",
24+
"rxjs": "^5.0.0-beta.11"
2225
},
2326
"devDependencies": {
24-
"@angular/core": "^2.0.0-rc.1",
25-
"@angular/platform-browser-dynamic": "^2.0.0-rc.1",
26-
"es6-promise": "^3.0.2",
27-
"es6-shim": "^0.33.13",
28-
"http-server": "^0.8.5",
29-
"jasmine": "^2.4.1",
30-
"jasmine-core": "^2.4.1",
31-
"karma": "^0.13.19",
32-
"karma-chrome-launcher": "^0.2.2",
33-
"karma-firefox-launcher": "^0.1.7",
34-
"karma-jasmine": "^0.3.6",
35-
"reflect-metadata": "^0.1.2",
36-
"rxjs": "5.0.0-beta.6",
37-
"systemjs": "^0.19.11",
38-
"typescript": "^1.7.5",
39-
"yargs": "^3.31.0",
40-
"zone.js": "^0.6.12"
41-
},
42-
"typings": "index.d.ts"
27+
"@angular/common": "^2.0.0-rc.6",
28+
"@angular/compiler": "^2.0.0-rc.6",
29+
"@angular/compiler-cli": "^0.6.0",
30+
"@angular/core": "^2.0.0-rc.6",
31+
"@angular/platform-browser": "^2.0.0-rc.6",
32+
"@angular/platform-browser-dynamic": "^2.0.0-rc.6",
33+
"@angular/platform-server": "^2.0.0-rc.6",
34+
"@types/jasmine": "^2.2.33",
35+
"@types/node": "^6.0.38",
36+
"awesome-typescript-loader": "^2.2.1",
37+
"core-js": "^2.4.1",
38+
"cpy-cli": "^1.0.1",
39+
"istanbul-instrumenter-loader": "^0.2.0",
40+
"jasmine": "^2.5.0",
41+
"karma": "^1.2.0",
42+
"karma-chrome-launcher": "^2.0.0",
43+
"karma-coverage": "^1.1.1",
44+
"karma-jasmine": "^1.0.2",
45+
"karma-mocha-reporter": "^2.1.0",
46+
"karma-sourcemap-loader": "^0.3.7",
47+
"karma-webpack": "^1.8.0",
48+
"rimraf": "^2.5.4",
49+
"rollup": "^0.34.13",
50+
"rxjs": "^5.0.0-beta.11",
51+
"ts-loader": "^0.8.2",
52+
"tslint": "^3.15.1",
53+
"tslint-loader": "^2.1.5",
54+
"typescript": "^2.0.2",
55+
"uglifyjs": "^2.4.10",
56+
"webpack": "^2.1.0-beta.21",
57+
"zone.js": "^0.6.17"
58+
}
4359
}

rollup.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
export default {
2+
entry: './release/index.js',
3+
dest: './release/bundles/db.umd.js',
4+
format: 'umd',
5+
moduleName: 'ngrx.db',
6+
globals: {
7+
'@angular/core': 'ng.core',
8+
9+
'rxjs/Observable': 'Rx',
10+
'rxjs/Subject': 'Rx',
11+
'rxjs/operator/mergeMap': 'Rx.Observable.prototype',
12+
'rxjs/operator/do': 'Rx.Observable.prototype',
13+
'rxjs/observable/from': 'Rx.Observable'
14+
}
15+
}

0 commit comments

Comments
 (0)