diff --git a/generator/index.js b/generator/index.js index c17046b..9948d31 100644 --- a/generator/index.js +++ b/generator/index.js @@ -53,11 +53,11 @@ module.exports = async (api, options, rootOptions) => { api.extendPackage({ nativescript: { id: 'org.nativescript.application', - 'tns-ios': { - version: '6.1.0' - }, 'tns-android': { - version: '6.1.0' + version: '6.3.1' + }, + 'tns-ios': { + version: '6.3.0' } }, scripts: { @@ -78,12 +78,12 @@ module.exports = async (api, options, rootOptions) => { 'clean:ios': 'rimraf platforms/ios' }, dependencies: { - 'nativescript-vue': '^2.4.0', - 'tns-core-modules': '^6.1.0' + 'nativescript-vue': '^2.5.0-alpha.3', + 'tns-core-modules': '^6.3.2' }, devDependencies: { - 'nativescript-dev-webpack': '^1.2.0', - 'nativescript-vue-template-compiler': '^2.4.0', + 'nativescript-dev-webpack': '^1.4.0', + 'nativescript-vue-template-compiler': '^2.5.0-alpha.3', 'nativescript-worker-loader': '~0.9.5', 'node-sass': '^4.12.0', 'string-replace-loader': '^2.2.0', @@ -128,8 +128,8 @@ module.exports = async (api, options, rootOptions) => { dependencies: {}, devDependencies: { 'fork-ts-checker-webpack-plugin': '^1.5.0', - 'terser-webpack-plugin': '^2.0.1', - 'tns-platform-declarations': '^6.1.0' + 'terser-webpack-plugin': '^2.1.3', + 'tns-platform-declarations': '^6.3.2' } }); diff --git a/generator/templates/nvw/src/router.js b/generator/templates/nvw/src/router.js index 6830956..2b66ba4 100644 --- a/generator/templates/nvw/src/router.js +++ b/generator/templates/nvw/src/router.js @@ -1,5 +1,5 @@ --- -extend: '@vue/cli-service/generator/router/template/src/router.js' +extend: '@vue/cli-service/generator/router.js' replace: - !!js/regexp /import Vue from 'vue'/ - !!js/regexp /import Router from 'vue-router'/ @@ -31,4 +31,4 @@ import Home from '~/views/Home.vue'; <%# REPLACE %> }); -<%# END_REPLACE %> \ No newline at end of file +<%# END_REPLACE %> diff --git a/generator/templates/simple/src/router.js b/generator/templates/simple/src/router.js index b222319..e11a842 100644 --- a/generator/templates/simple/src/router.js +++ b/generator/templates/simple/src/router.js @@ -1,5 +1,5 @@ --- -extend: '@vue/cli-service/generator/router/template/src/router.js' +extend: '@vue/cli-service/generator/router.js' replace: - !!js/regexp /import Vue from 'vue'/ - !!js/regexp /import Router from 'vue-router'/ diff --git a/index.js b/index.js index 80891d3..a6d66bc 100644 --- a/index.js +++ b/index.js @@ -106,23 +106,44 @@ module.exports = (api, projectOptions) => { // get the --env command line options and put them in the env variable const [, , ...processArgs] = process.argv; flags = [...processArgs].filter((f) => f.startsWith('--env.')).map((f) => f.substring(6)); + + // in the rare event that tns and vue-cli get things mixed up and try and load the production + // environment and development environment at the same time, we will default to loading + // the development environment. you will generally see this when using something like + // fastlane and having it do a 'tns prepare' as you are prepping to package and upload + // your app to the app store. For internal testing you may want to package a development + // version of the app, but `tns prepare` will try and load the production environmental variables + if(flags.includes('development') && flags.includes('production')) { + const index = flags.findIndex((obj) => obj === 'production') + if(index > -1) { + flags.splice(index, 1); + } + } + // console.log('tns cli - flags - ', flags); // take advantage of the vue cli api to load the --env items into process.env. // we are filtering out the items, by catching the '=' sign, brought in from nsconfig.json as those don't need loaded into process.env - // we are also filtering out 'sourceMap' which will appear with 'tns debug' - api.service.loadEnv(flags.filter((o) => !o.includes('=') && !o.includes('sourceMap') && !o.includes('hmr')).join('.')); + // we are also filtering out 'sourceMap' which will appear with 'tns debug' as well as 'hmr' and 'uglify' + // the goal here is to figure out exactly what environmental variables to load + const mode = flags.filter((o) => !o.includes('=') && !o.includes('sourceMap') && !o.includes('hmr') && !o.includes('uglify')).join('.'); + // console.log('loadEnv - ', mode); + api.service.loadEnv(mode); + } // setup the traditional {N} webpack 'env' variable env = flags.reduce(addOption, {}); // console.log('env - ', env); - const platform = env && ((env.android && 'android') || (env.ios && 'ios') || (env.web && 'web')); + let platform = env && ((env.android && 'android') || (env.ios && 'ios') || (env.web && 'web')); // console.log('platform - ', platform); if (!platform) { - throw new Error('You need to provide a target platform!'); + // TNS (iOS/Android) always sets platform, so assume platform = 'web' & Vue-CLI glitch of loosing .env options in the UI + platform = 'web'; + // --> TO BE DELETED SOON + // throw new Error('You need to provide a target platform!'); } const projectRoot = api.service.context; @@ -322,26 +343,25 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => { config.optimization.minimize(Boolean(production)); config.optimization - .minimizer([ - new TerserPlugin({ - parallel: true, - cache: true, - sourceMap: isAnySourceMapEnabled, - terserOptions: { - output: { - comments: false, - semicolons: !isAnySourceMapEnabled - }, - compress: { - // The Android SBG has problems parsing the output - // when these options are enabled - collapse_vars: platform !== 'android', - sequences: platform !== 'android' - }, - keep_fnames: true - } - }) - ]) + .minimizer('terser') + .use(TerserPlugin, [{ + parallel: true, + cache: true, + sourceMap: isAnySourceMapEnabled, + terserOptions: { + output: { + comments: false, + semicolons: !isAnySourceMapEnabled + }, + compress: { + // The Android SBG has problems parsing the output + // when these options are enabled + collapse_vars: platform !== 'android', + sequences: platform !== 'android' + }, + keep_fnames: true + } + }]) .end(); config.module @@ -570,9 +590,9 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => { .uses.get('css-loader') .get('options'), { - minimize: false, + // minimize: false, url: false, - data: '$PLATFORM: ' + platform + ';' + // data: '$PLATFORM: ' + platform + ';' } ) ) @@ -588,8 +608,8 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => { .get('options'), { // minimize: false, - url: false, - data: '$PLATFORM: ' + platform + ';' + // url: false, + prependData: '$PLATFORM: ' + platform + ';' } ) ) @@ -634,7 +654,7 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => { { // minimize: false, url: false, - data: '$PLATFORM: ' + platform + // data: '$PLATFORM: ' + platform } ) ) @@ -650,8 +670,8 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => { .get('options'), { minimize: false, - url: false, - data: '$PLATFORM: ' + platform + // url: false, + prependData: '$PLATFORM: ' + platform } ) ) diff --git a/package-lock.json b/package-lock.json index 417c895..58bbce5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "vue-cli-plugin-nativescript-vue", - "version": "0.2.0", + "version": "0.3.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4c5a07d..d71e9ef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-cli-plugin-nativescript-vue", - "version": "0.2.0", + "version": "0.3.1", "description": "A vue cli 3.x plugin for NativeScript-Vue", "main": "index.js", "files": [ pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy