diff --git a/.gitignore b/.gitignore index f86aed5..9e3f0db 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ seed-tests/seed-copy/**/*.* seed-tests/seed-copy-new-git-repo/**/*.* !demo/karma.conf.js !demo/app/tests/*.js +!demo/webpack.config.js demo/*.d.ts !demo/references.d.ts demo/platforms diff --git a/demo/app/app.css b/demo/app/app.css index 4129ee8..ce9a817 100644 --- a/demo/app/app.css +++ b/demo/app/app.css @@ -1,5 +1,5 @@ -@import "~@nativescript/theme/css/core.css"; -@import "~@nativescript/theme/css/default.css"; +@import "@nativescript/theme/css/core.css"; +@import "@nativescript/theme/css/default.css"; .h3 { margin-top: 18; diff --git a/demo/karma.conf.js b/demo/karma.conf.js index 7974602..15d2374 100644 --- a/demo/karma.conf.js +++ b/demo/karma.conf.js @@ -1,8 +1,9 @@ +const filePatterns = ['app/tests/**/*.*']; module.exports = function (config) { const options = { // base path that will be used to resolve all patterns (eg. files, exclude) - basePath: '', + basePath: 'app', // frameworks to use @@ -11,7 +12,7 @@ module.exports = function (config) { // list of files / patterns to load in the browser - files: ['app/tests/**/*.*'], + files: filePatterns, // list of files to exclude @@ -78,6 +79,9 @@ module.exports = function (config) { config.set(options); } +module.exports.filePatterns = filePatterns; +// You can also use RegEx if you'd like: +// module.exports.filesRegex = /\.\/tests\/.*\.ts$/; function setWebpackPreprocessor(config, options) { if (config && config.bundle) { @@ -99,6 +103,8 @@ function setWebpack(config, options) { const env = {}; env[config.platform] = true; env.sourceMap = config.debugBrk; + env.appPath = config.appPath; + env.karmaWebpack = true; options.webpack = require('./webpack.config')(env); delete options.webpack.entry; delete options.webpack.output.libraryTarget; diff --git a/demo/package.json b/demo/package.json index ab2fad6..ce9bf67 100644 --- a/demo/package.json +++ b/demo/package.json @@ -2,23 +2,24 @@ "dependencies": { "nativescript-barcodescanner": "file:../src", "@nativescript/theme": "~2.5.0", - "nativescript-unit-test-runner": "~0.7.0", - "@nativescript/core": "~8.0.0" + "@nativescript/core": "~8.1.1", + "@nativescript/unit-test-runner": "~2.0.5" }, "devDependencies": { - "@nativescript/android": "8.0.0", - "@nativescript/ios": "8.0.0", - "@nativescript/types": "~8.0.0", - "@nativescript/webpack": "^3.0.4", + "@nativescript/android": "~8.1.1", + "@nativescript/ios": "~8.1.0", + "@nativescript/types": "~8.1.0", + "@nativescript/webpack": "~5.0.0", "jasmine-core": "^2.5.2", - "karma": "4.1.0", - "karma-jasmine": "2.0.1", + "karma": "~6.3.4", + "karma-jasmine": "~4.0.1", "karma-nativescript-launcher": "^0.4.0", - "karma-webpack": "3.0.5", + "karma-webpack": "~5.0.0", "tslint": "~5.11.0", - "typescript": "~4.0.7" + "typescript": "~4.3.5" }, "scripts": { "build.plugin": "cd ../src && npm run build" - } + }, + "main": "./app/app.ts" } diff --git a/demo/references.d.ts b/demo/references.d.ts index 39ec3e2..17821a3 100644 --- a/demo/references.d.ts +++ b/demo/references.d.ts @@ -1,4 +1,2 @@ -/// -/// - +/// /// diff --git a/demo/tsconfig.json b/demo/tsconfig.json index bac388d..4499ae3 100644 --- a/demo/tsconfig.json +++ b/demo/tsconfig.json @@ -4,7 +4,7 @@ "target": "es2017", "moduleResolution": "node", "declaration": false, - "removeComments": true, + "removeComments": false, "noLib": false, "skipLibCheck": true, "emitDecoratorMetadata": true, diff --git a/demo/webpack.config.js b/demo/webpack.config.js new file mode 100644 index 0000000..a561e0e --- /dev/null +++ b/demo/webpack.config.js @@ -0,0 +1,12 @@ +const webpack = require("@nativescript/webpack"); + +module.exports = (env) => { + webpack.init(env); + + // Learn how to customize: + // https://docs.nativescript.org/webpack + + return webpack.resolveConfig(); +}; + + diff --git a/src/barcodescanner.ios.ts b/src/barcodescanner.ios.ts index cd30c76..8f05bcf 100644 --- a/src/barcodescanner.ios.ts +++ b/src/barcodescanner.ios.ts @@ -110,7 +110,7 @@ export class BarcodeScanner { this._device = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo); if (this._device && this._device.hasTorch && this._device.hasFlash) { - this._observer = VolumeObserverClass.alloc(); + this._observer = VolumeObserverClass.alloc().init(); this._observer["_owner"] = this; } } diff --git a/src/package.json b/src/package.json index b8416b2..1f52062 100644 --- a/src/package.json +++ b/src/package.json @@ -69,8 +69,8 @@ "devDependencies": { "@nativescript/core": "^8.0.0", "@nativescript/types": "^8.0.0", - "@nativescript/webpack": "^3.0.0", - "typescript": "~4.0.7", + "@nativescript/webpack": "^5.0.0", + "typescript": "~4.3.5", "prompt": "^1.0.0", "rimraf": "^2.6.3", "tslint": "^5.12.1", diff --git a/src/tsconfig.json b/src/tsconfig.json index e4234ae..c4decef 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -1,35 +1,33 @@ { - "compilerOptions": { - "target": "ES2017", - "module": "esnext", - "moduleResolution": "node", - "declaration": true, - "removeComments": true, - "noLib": false, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "skipLibCheck": true, - "lib": ["es2017", "dom"], - "sourceMap": true, - "pretty": true, - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "noEmitHelpers": true, - "noEmitOnError": false, - "noImplicitAny": false, - "noImplicitReturns": true, - "noImplicitUseStrict": false, - "noFallthroughCasesInSwitch": true, - "baseUrl": ".", - "plugins": [ - { - "transform": "@nativescript/webpack/transformers/ns-transform-native-classes", - "type": "raw" - } - ] - }, - "exclude": [ - "node_modules" - ], - "compileOnSave": false + "compilerOptions": { + "target": "ES2017", + "module": "esnext", + "moduleResolution": "node", + "declaration": true, + "removeComments": true, + "noLib": false, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "skipLibCheck": true, + "lib": ["es2017", "dom"], + "sourceMap": true, + "pretty": true, + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "noEmitHelpers": true, + "noEmitOnError": false, + "noImplicitAny": false, + "noImplicitReturns": true, + "noImplicitUseStrict": false, + "noFallthroughCasesInSwitch": true, + "baseUrl": ".", + "plugins": [ + { + "transform": "@nativescript/webpack/dist/transformers/NativeClass", + "type": "raw" + } + ] + }, + "exclude": ["node_modules"], + "compileOnSave": false }