Skip to content

Commit 9068a80

Browse files
authored
chore: update demos to 6.0 (#281)
* chore: update demos to 6.0 * chore: remove syncAllFiles * fix linking plugin fronm src
1 parent 970aa34 commit 9068a80

File tree

78 files changed

+113
-50
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+113
-50
lines changed

demo-angular/karma.conf.js

Lines changed: 39 additions & 8 deletions
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-
'app/**/*.js',
16-
],
14+
files: ['app/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-angular/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"nativescript": {
33
"id": "org.nativescript.imagepickerdemoangular",
44
"tns-ios": {
5-
"version": "5.4.0"
5+
"version": "6.0.1"
66
},
77
"tns-android": {
8-
"version": "5.4.0"
8+
"version": "6.0.0"
99
}
1010
},
1111
"dependencies": {
@@ -20,23 +20,23 @@
2020
"nativescript-angular": "~8.0.0",
2121
"nativescript-imagepicker": "../src",
2222
"nativescript-theme-core": "^1.0.4",
23-
"nativescript-unit-test-runner": "^0.3.4",
23+
"nativescript-unit-test-runner": "0.7.0",
2424
"reflect-metadata": "~0.1.8",
2525
"rxjs": "^6.3.3",
26-
"tns-core-modules": "^5.0.0",
27-
"typescript": "~3.4.5"
26+
"tns-core-modules": "^6.0.0"
2827
},
2928
"devDependencies": {
3029
"jasmine-core": "^2.5.2",
31-
"karma": "^1.3.0",
32-
"karma-jasmine": "^1.0.2",
30+
"karma": "4.1.0",
31+
"karma-jasmine": "2.0.1",
3332
"karma-nativescript-launcher": "^0.4.0",
3433
"nativescript-css-loader": "~0.26.0",
35-
"nativescript-dev-typescript": "~0.10.0",
36-
"nativescript-dev-webpack": "~0.24.0",
37-
"tns-platform-declarations": "^5.0.0",
34+
"nativescript-dev-webpack": "~1.0.1",
35+
"tns-platform-declarations": "^6.0.0",
3836
"tslint": "~5.11.0",
39-
"zone.js": "^0.8.4"
37+
"zone.js": "^0.8.4",
38+
"typescript": "~3.4.5",
39+
"karma-webpack": "3.0.5"
4040
},
4141
"scripts": {
4242
"build.plugin": "cd ../src && npm run build",

demo-vue/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
"nativescript": {
33
"id": "org.nativescript.demovue",
44
"tns-android": {
5-
"version": "5.4.0"
5+
"version": "6.0.0"
66
},
77
"tns-ios": {
8-
"version": "5.4.0"
8+
"version": "6.0.1"
99
}
1010
},
1111
"dependencies": {
1212
"nativescript-imagepicker": "../src",
1313
"nativescript-theme-core": "~1.0.4",
14-
"nativescript-vue": "~2.2.0",
15-
"tns-core-modules": "^5.0.0"
14+
"nativescript-vue": "~2.3.0",
15+
"tns-core-modules": "^6.0.0"
1616
},
1717
"devDependencies": {
1818
"@types/chai": "^4.1.4",
@@ -28,11 +28,11 @@
2828
"mocha-multi": "^1.0.1",
2929
"mochawesome": "^3.1.1",
3030
"nativescript-dev-appium": "~5.2.0",
31-
"nativescript-dev-webpack": "~0.24.0",
32-
"nativescript-dev-typescript": "~0.10.0",
33-
"nativescript-vue-template-compiler": "~2.2.0",
34-
"node-sass": "~4.9.0",
35-
"vue-loader": "~15.4.0"
31+
"nativescript-dev-webpack": "~1.0.1",
32+
"nativescript-vue-template-compiler": "~2.3.0",
33+
"node-sass": "~4.12.0",
34+
"vue-loader": "~15.4.0",
35+
"typescript": "~3.4.5"
3636
},
3737
"scripts": {
3838
"build.plugin": "cd ../src && npm run build",

demo/karma.conf.js

Lines changed: 39 additions & 8 deletions
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-
'app/**/*.js',
16-
],
14+
files: ['app/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/package.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
"nativescript": {
33
"id": "org.nativescript.imagepickerdemo",
44
"tns-android": {
5-
"version": "5.4.0"
5+
"version": "6.0.0"
66
},
77
"tns-ios": {
8-
"version": "5.4.0"
8+
"version": "6.0.1"
99
}
1010
},
1111
"dependencies": {
1212
"nativescript-imagepicker": "../src",
1313
"nativescript-theme-core": "^1.0.4",
14-
"nativescript-unit-test-runner": "^0.3.4",
15-
"tns-core-modules": "^5.0.0"
14+
"nativescript-unit-test-runner": "0.7.0",
15+
"tns-core-modules": "^6.0.0"
1616
},
1717
"devDependencies": {
1818
"@types/chai": "^4.1.4",
@@ -21,19 +21,20 @@
2121
"chai": "~4.1.2",
2222
"chai-as-promised": "~7.1.1",
2323
"jasmine-core": "^3.2.0",
24-
"karma": "^2.0.5",
25-
"karma-jasmine": "^1.1.2",
24+
"karma": "4.1.0",
25+
"karma-jasmine": "2.0.1",
2626
"karma-nativescript-launcher": "^0.4.0",
2727
"mocha": "^3.3.0",
2828
"mocha-junit-reporter": "^1.18.0",
2929
"mocha-multi": "^1.0.1",
3030
"mochawesome": "^3.1.1",
3131
"nativescript-css-loader": "~0.26.0",
3232
"nativescript-dev-appium": "~5.2.0",
33-
"nativescript-dev-typescript": "~0.10.0",
34-
"nativescript-dev-webpack": "~0.24.0",
35-
"tns-platform-declarations": "^5.0.0",
36-
"tslint": "~5.11.0"
33+
"nativescript-dev-webpack": "~1.0.1",
34+
"tns-platform-declarations": "^6.0.0",
35+
"tslint": "~5.11.0",
36+
"typescript": "~3.4.5",
37+
"karma-webpack": "3.0.5"
3738
},
3839
"scripts": {
3940
"build.plugin": "cd ../src && npm run build",

src/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
"tslint": "cd .. && tslint \"**/*.ts\" --config tslint.json --exclude \"**/node_modules/**\"",
2727
"plugin.link": "npm link && cd ../demo && npm link nativescript-imagepicker && cd ../demo-angular && npm link nativescript-imagepicker",
2828
"plugin.tscwatch": "npm run tsc -- -w",
29-
"demo.ios": "npm i && npm run tsc && cd ../demo && tns run ios --syncAllFiles",
30-
"demo.android": "npm i && npm run tsc && cd ../demo && tns run android --syncAllFiles",
31-
"demo.ng.ios": "npm i && npm run tsc && cd ../demo-angular && tns run ios --syncAllFiles",
32-
"demo.ng.android": "npm i && npm run tsc && cd ../demo-angular && tns run android --syncAllFiles",
29+
"demo.ios": "npm i && npm run tsc && cd ../demo && tns run ios",
30+
"demo.android": "npm i && npm run tsc && cd ../demo && tns run android",
31+
"demo.ng.ios": "npm i && npm run tsc && cd ../demo-angular && tns run ios",
32+
"demo.ng.android": "npm i && npm run tsc && cd ../demo-angular && tns run android",
3333
"clean": "rm -rf node_modules && cd ../demo && rm -rf hooks node_modules platforms && cd ../src && npm run plugin.link"
3434
},
3535
"keywords": [

0 commit comments

Comments
 (0)