Skip to content

Commit

Permalink
Bump demo to NativeScript 6
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed Aug 13, 2019
1 parent 794c78b commit 71bc9e9
Show file tree
Hide file tree
Showing 27 changed files with 50 additions and 20 deletions.
File renamed without changes.
File renamed without changes.
47 changes: 39 additions & 8 deletions demo/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = function(config) {
config.set({
module.exports = function (config) {
const options = {

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


// list of files / patterns to load in the browser
files: [
'demoapp/**/*.js',
],
files: ['demoapp/tests/**/*.*'],


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

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true
});
};
singleRun: false
};

setWebpackPreprocessor(config, options);
setWebpack(config, options);

config.set(options);
}

function setWebpackPreprocessor(config, options) {
if (config && config.bundle) {
if (!options.preprocessors) {
options.preprocessors = {};
}

options.files.forEach(file => {
if (!options.preprocessors[file]) {
options.preprocessors[file] = [];
}
options.preprocessors[file].push('webpack');
});
}
}

function setWebpack(config, options) {
if (config && config.bundle) {
const env = {};
env[config.platform] = true;
env.sourceMap = config.debugBrk;
options.webpack = require('./webpack.config')(env);
delete options.webpack.entry;
delete options.webpack.output.libraryTarget;
const invalidPluginsForUnitTesting = ["GenerateBundleStarterPlugin", "GenerateNativeScriptEntryPointsPlugin"];
options.webpack.plugins = options.webpack.plugins.filter(p => !invalidPluginsForUnitTesting.includes(p.constructor.name));
}
}
3 changes: 1 addition & 2 deletions demo/nsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"appPath": "demoapp",
"appResourcesPath": "appresources",
"useLegacyWorkflow": true
"appResourcesPath": "appresources"
}
20 changes: 10 additions & 10 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"nativescript": {
"id": "org.nativescript.plugindemo.AppSync",
"tns-ios": {
"version": "5.4.2"
"version": "6.0.1"
},
"tns-android": {
"version": "5.4.0"
"version": "6.0.0"
}
},
"scripts": {
Expand Down Expand Up @@ -33,23 +33,23 @@
"dependencies": {
"nativescript-app-sync": "file:../publish/package/nativescript-app-sync-1.0.4.tgz",
"nativescript-theme-core": "~1.0.4",
"nativescript-unit-test-runner": "^0.3.4",
"tns-core-modules": "~5.4.2"
"nativescript-unit-test-runner": "0.7.0",
"tns-core-modules": "6.0.1"
},
"devDependencies": {
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"filewalker": "0.1.2",
"jasmine-core": "^2.5.2",
"karma": "^1.7.1",
"karma-jasmine": "^1.1.0",
"karma": "4.1.0",
"karma-jasmine": "2.0.1",
"karma-nativescript-launcher": "^0.4.0",
"lazy": "1.0.11",
"nativescript-dev-typescript": "~0.9.0",
"nativescript-dev-webpack": "^0.21.2",
"tns-platform-declarations": "~5.4.2",
"nativescript-dev-webpack": "1.0.1",
"tns-platform-declarations": "6.0.1",
"tslint": "~5.4.3",
"typescript": "~3.3.0"
"typescript": "3.4.5",
"karma-webpack": "3.0.5"
}
}

0 comments on commit 71bc9e9

Please sign in to comment.