Skip to content

Commit fb7f7f0

Browse files
committed
prod build & test
1 parent baa18e5 commit fb7f7f0

File tree

3 files changed

+28
-20
lines changed

3 files changed

+28
-20
lines changed

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
},
2020
"license": "MIT",
2121
"scripts": {
22-
"build": "webpack --config webpack/config.js",
22+
"prod-build": "webpack --config webpack/config.js",
23+
"prod-test": "karma start test/config/karma.conf.js",
2324
"dev-build": "webpack --config webpack/config.js",
2425
"dev-test": "karma start test/config/karma.conf.js",
25-
"test": "concurrently --kill-others --raw \"npm run dev-build\" \"npm run dev-test\""
26+
"test": "concurrently --kill-others --raw \"npm run dev-build\" \"npm run dev-test\"",
27+
"build": "npm run prod-build && npm run prod-test"
2628
},
2729
"devDependencies": {
2830
"babel-core": "^6.24.1",

test/config/karma.conf.files.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,23 @@ var files = [
77
'../misc/test.css',
88
'../misc/datasources.js',
99
'../misc/scaffolding*.js',
10-
'../*Spec.js',
10+
'../*Spec.js'
11+
];
12+
13+
module.exports.development = files.concat([
14+
'../../temp/ui-scroll.js',
15+
'../../temp/ui-scroll-grid.js',
1116
{
12-
pattern: scrollerPath + '*.js.map',
17+
pattern: '../../temp/*.js.map',
1318
included: false
1419
}
15-
];
16-
17-
module.exports.defaultFiles = files.concat([
18-
scrollerPath + 'ui-scroll.js',
19-
scrollerPath + 'ui-scroll-grid.js'
2020
]);
2121

22-
module.exports.compressedFiles = files.concat([
23-
scrollerPath + 'ui-scroll.min.js',
24-
scrollerPath + 'ui-scroll-grid.min.js'
22+
module.exports.production = files.concat([
23+
'../../dist/ui-scroll.min.js',
24+
'../../dist/ui-scroll-grid.min.js',
25+
{
26+
pattern: '../../dist/*.js.map',
27+
included: false
28+
}
2529
]);

test/config/karma.conf.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
var chrome = process.platform === 'linux' ? 'Chromium' : 'Chrome';
2-
var firefox = 'Firefox';
3-
var ie = 'IE';
1+
const chrome = process.platform === 'linux' ? 'Chromium' : 'Chrome';
2+
const firefox = 'Firefox';
3+
const ie = 'IE';
4+
5+
const ENV = (process.env.npm_lifecycle_event.indexOf('dev') === 0) ? 'development' : 'production';
46

57
module.exports = function (config) {
68
config.set({
@@ -9,28 +11,28 @@ module.exports = function (config) {
911

1012
frameworks: ['jasmine'],
1113

12-
files: require('./karma.conf.files.js').defaultFiles,
14+
files: require('./karma.conf.files.js')[ENV],
1315

1416
exclude: [],
1517

1618
reporters: ['dots'],
1719

18-
port: 8082,
20+
port: ENV === 'development' ? 9100 : 8082,
1921

2022
colors: true,
2123

2224
logLevel: config.LOG_INFO,
2325

24-
autoWatch: true,
26+
autoWatch: ENV === 'development',
2527

26-
keepalive: true,
28+
keepalive: ENV === 'development',
2729

2830
browsers: process.env.TRAVIS ?
2931
[firefox, chrome] :
3032
[chrome],
3133

3234
captureTimeout: 60000,
3335

34-
singleRun: false
36+
singleRun: ENV !== 'development'
3537
});
3638
};

0 commit comments

Comments
 (0)