Skip to content

Commit 71bc9e9

Browse files
Bump demo to NativeScript 6
1 parent 794c78b commit 71bc9e9

File tree

27 files changed

+50
-20
lines changed

27 files changed

+50
-20
lines changed

demo/karma.conf.js

+39-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
module.exports = function(config) {
2-
config.set({
1+
module.exports = function (config) {
2+
const options = {
33

44
// base path that will be used to resolve all patterns (eg. files, exclude)
55
basePath: '',
@@ -11,9 +11,7 @@ module.exports = function(config) {
1111

1212

1313
// list of files / patterns to load in the browser
14-
files: [
15-
'demoapp/**/*.js',
16-
],
14+
files: ['demoapp/tests/**/*.*'],
1715

1816

1917
// list of files to exclude
@@ -72,6 +70,39 @@ module.exports = function(config) {
7270

7371
// Continuous Integration mode
7472
// if true, Karma captures browsers, runs the tests and exits
75-
singleRun: true
76-
});
77-
};
73+
singleRun: false
74+
};
75+
76+
setWebpackPreprocessor(config, options);
77+
setWebpack(config, options);
78+
79+
config.set(options);
80+
}
81+
82+
function setWebpackPreprocessor(config, options) {
83+
if (config && config.bundle) {
84+
if (!options.preprocessors) {
85+
options.preprocessors = {};
86+
}
87+
88+
options.files.forEach(file => {
89+
if (!options.preprocessors[file]) {
90+
options.preprocessors[file] = [];
91+
}
92+
options.preprocessors[file].push('webpack');
93+
});
94+
}
95+
}
96+
97+
function setWebpack(config, options) {
98+
if (config && config.bundle) {
99+
const env = {};
100+
env[config.platform] = true;
101+
env.sourceMap = config.debugBrk;
102+
options.webpack = require('./webpack.config')(env);
103+
delete options.webpack.entry;
104+
delete options.webpack.output.libraryTarget;
105+
const invalidPluginsForUnitTesting = ["GenerateBundleStarterPlugin", "GenerateNativeScriptEntryPointsPlugin"];
106+
options.webpack.plugins = options.webpack.plugins.filter(p => !invalidPluginsForUnitTesting.includes(p.constructor.name));
107+
}
108+
}

demo/nsconfig.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
22
"appPath": "demoapp",
3-
"appResourcesPath": "appresources",
4-
"useLegacyWorkflow": true
3+
"appResourcesPath": "appresources"
54
}

demo/package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"nativescript": {
33
"id": "org.nativescript.plugindemo.AppSync",
44
"tns-ios": {
5-
"version": "5.4.2"
5+
"version": "6.0.1"
66
},
77
"tns-android": {
8-
"version": "5.4.0"
8+
"version": "6.0.0"
99
}
1010
},
1111
"scripts": {
@@ -33,23 +33,23 @@
3333
"dependencies": {
3434
"nativescript-app-sync": "file:../publish/package/nativescript-app-sync-1.0.4.tgz",
3535
"nativescript-theme-core": "~1.0.4",
36-
"nativescript-unit-test-runner": "^0.3.4",
37-
"tns-core-modules": "~5.4.2"
36+
"nativescript-unit-test-runner": "0.7.0",
37+
"tns-core-modules": "6.0.1"
3838
},
3939
"devDependencies": {
4040
"babel-traverse": "6.26.0",
4141
"babel-types": "6.26.0",
4242
"babylon": "6.18.0",
4343
"filewalker": "0.1.2",
4444
"jasmine-core": "^2.5.2",
45-
"karma": "^1.7.1",
46-
"karma-jasmine": "^1.1.0",
45+
"karma": "4.1.0",
46+
"karma-jasmine": "2.0.1",
4747
"karma-nativescript-launcher": "^0.4.0",
4848
"lazy": "1.0.11",
49-
"nativescript-dev-typescript": "~0.9.0",
50-
"nativescript-dev-webpack": "^0.21.2",
51-
"tns-platform-declarations": "~5.4.2",
49+
"nativescript-dev-webpack": "1.0.1",
50+
"tns-platform-declarations": "6.0.1",
5251
"tslint": "~5.4.3",
53-
"typescript": "~3.3.0"
52+
"typescript": "3.4.5",
53+
"karma-webpack": "3.0.5"
5454
}
5555
}

0 commit comments

Comments
 (0)