From 37d4972998ab60454290c2f4e2407094daa8b557 Mon Sep 17 00:00:00 2001 From: EddyVerbruggen Date: Thu, 4 Jul 2019 11:09:18 +0200 Subject: [PATCH] bump plugin version & updated demo app to {N} 6 RC --- CHANGELOG.md | 3 ++ demo/app/app.css | 2 +- demo/app/app.ts | 5 ++- demo/app/bundle-config.ts | 5 --- demo/app/vendor-platform.android.ts | 9 ------ demo/app/vendor-platform.ios.ts | 3 -- demo/app/vendor.ts | 10 ------ demo/karma.conf.js | 47 ++++++++++++++++++++++++----- demo/package.json | 20 ++++++------ src/package.json | 10 +++--- 10 files changed, 60 insertions(+), 54 deletions(-) delete mode 100644 demo/app/bundle-config.ts delete mode 100644 demo/app/vendor-platform.android.ts delete mode 100644 demo/app/vendor-platform.ios.ts delete mode 100644 demo/app/vendor.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 3701652..e316363 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## [3.2.1](https://github.com/EddyVerbruggen/nativescript-barcodescanner/tree/3.2.1) (2019-07-04) +[Full Changelog](https://github.com/EddyVerbruggen/nativescript-barcodescanner/milestone/41?closed=1) + ## [3.2.0](https://github.com/EddyVerbruggen/nativescript-barcodescanner/tree/3.2.0) (2019-06-07) [Full Changelog](https://github.com/EddyVerbruggen/nativescript-barcodescanner/milestone/40?closed=1) diff --git a/demo/app/app.css b/demo/app/app.css index e566761..707e3fd 100644 --- a/demo/app/app.css +++ b/demo/app/app.css @@ -1,4 +1,4 @@ -@import '~/css/core.light.css'; +@import '~nativescript-theme-core/css/core.light.css'; .h3 { margin-top: 18; diff --git a/demo/app/app.ts b/demo/app/app.ts index 8986233..d0c8cd9 100644 --- a/demo/app/app.ts +++ b/demo/app/app.ts @@ -1,3 +1,2 @@ -import "./bundle-config"; -import * as application from 'tns-core-modules/application'; -application.start({ moduleName: "main-page" }); +import * as application from "tns-core-modules/application"; +application.run({ moduleName: "main-page" }); diff --git a/demo/app/bundle-config.ts b/demo/app/bundle-config.ts deleted file mode 100644 index c11cf86..0000000 --- a/demo/app/bundle-config.ts +++ /dev/null @@ -1,5 +0,0 @@ -if ((global).TNS_WEBPACK) { - require("tns-core-modules/bundle-entry-points"); - - global.registerModule("main-page", () => require("./main-page")); -} \ No newline at end of file diff --git a/demo/app/vendor-platform.android.ts b/demo/app/vendor-platform.android.ts deleted file mode 100644 index 1635222..0000000 --- a/demo/app/vendor-platform.android.ts +++ /dev/null @@ -1,9 +0,0 @@ -require("application"); -if (!global["__snapshot"]) { - // In case snapshot generation is enabled these modules will get into the bundle - // but will not be required/evaluated. - // The snapshot webpack plugin will add them to the tns-java-classes.js bundle file. - // This way, they will be evaluated on app start as early as possible. - require("ui/frame"); - require("ui/frame/activity"); -} diff --git a/demo/app/vendor-platform.ios.ts b/demo/app/vendor-platform.ios.ts deleted file mode 100644 index 5ce49d8..0000000 --- a/demo/app/vendor-platform.ios.ts +++ /dev/null @@ -1,3 +0,0 @@ -// There is a bug in angular: https://github.com/angular/angular-cli/pull/8589/files -// Legendary stuff, its webpack plugin pretty much doesn't work with empty TypeScript files in v1.8.3 -void 0; diff --git a/demo/app/vendor.ts b/demo/app/vendor.ts deleted file mode 100644 index 8a38137..0000000 --- a/demo/app/vendor.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Snapshot the ~/app.css and the theme -const application = require("application"); -require("ui/styling/style-scope"); -const appCssContext = require.context("~/", false, /^\.\/app\.(css|scss|less|sass)$/); -global.registerWebpackModules(appCssContext); -application.loadAppCss(); - -require("./vendor-platform"); - -require("bundle-entry-points"); diff --git a/demo/karma.conf.js b/demo/karma.conf.js index 5d2286a..7974602 100644 --- a/demo/karma.conf.js +++ b/demo/karma.conf.js @@ -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: '', @@ -11,9 +11,7 @@ module.exports = function(config) { // list of files / patterns to load in the browser - files: [ - 'app/**/*.js' - ], + files: ['app/tests/**/*.*'], // list of files to exclude @@ -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)); + } +} diff --git a/demo/package.json b/demo/package.json index 9ba054a..da22b4f 100644 --- a/demo/package.json +++ b/demo/package.json @@ -2,29 +2,29 @@ "nativescript": { "id": "org.nativescript.plugindemo.barcodescanner", "tns-ios": { - "version": "5.0.0" + "version": "6.0.0-rc-2019-06-28-105002-01" }, "tns-android": { - "version": "5.0.0" + "version": "6.0.0-rc-2019-06-27-172817-03" } }, "dependencies": { "nativescript-barcodescanner": "file:../src", "nativescript-theme-core": "^1.0.4", - "nativescript-unit-test-runner": "^0.3.4", - "tns-core-modules": "~5.1.2" + "nativescript-unit-test-runner": "0.6.3", + "tns-core-modules": "6.0.0-rc-2019-06-28-175837-02" }, "devDependencies": { "jasmine-core": "^2.5.2", - "karma": "^1.3.0", - "karma-jasmine": "^1.0.2", + "karma": "4.1.0", + "karma-jasmine": "2.0.1", "karma-nativescript-launcher": "^0.4.0", "nativescript-css-loader": "~0.26.1", - "nativescript-dev-typescript": "~0.7.4", - "nativescript-dev-webpack": "~0.17.0", - "tns-platform-declarations": "^5.0.0", + "nativescript-dev-webpack": "1.0.0-rc-2019-07-02-161545-02", + "tns-platform-declarations": "6.0.0-rc-2019-06-28-175837-02", "tslint": "~5.11.0", - "typescript": "~3.1.2" + "typescript": "3.4.1", + "karma-webpack": "3.0.5" }, "scripts": { "build.plugin": "cd ../src && npm run build" diff --git a/src/package.json b/src/package.json index 957e90f..545c44a 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-barcodescanner", - "version": "3.2.0", + "version": "3.2.1", "description": "Scan QR/barcodes with your NativeScript app.", "main": "barcodescanner", "typings": "index.d.ts", @@ -21,12 +21,12 @@ "plugin.link": "npm link && cd ../demo && npm link nativescript-barcodescanner && cd ../src", "plugin.link.ng": "npm link && cd ../demo-ng && npm link nativescript-barcodescanner && cd ../src", "plugin.tscwatch": "npm run tsc -- -w", - "demo.ios": "npm run build && cd ../demo && tns run ios --syncAllFiles", + "demo.ios": "npm run build && cd ../demo && tns run ios", "demo.reset": "cd ../demo && rimraf platforms", "demo-ng.ios": "npm run build && cd ../demo-ng && tns run ios", - "demo.android": "npm run build && cd ../demo && tns run android --syncAllFiles", - "demo-vue.ios": "npm run tsc && cd ../demo-vue && tns run ios --bundle --syncAllFiles", - "demo-vue.android": "npm run tsc && cd ../demo-vue && tns run android --bundle --syncAllFiles", + "demo.android": "npm run build && cd ../demo && tns run android", + "demo-vue.ios": "npm run tsc && cd ../demo-vue && tns run ios --bundle", + "demo-vue.android": "npm run tsc && cd ../demo-vue && tns run android --bundle", "plugin.prepare": "npm run tsc && cd ../demo && tns plugin remove nativescript-barcodescanner && tns plugin add ../src", "clean": "cd ../demo && rimraf hooks node_modules platforms && cd ../src && rimraf node_modules && npm run plugin.link", "ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**' --exclude '**/typings/**'"