From 7156a05f4240e660d4719f4f0e5be19c408a9b2e Mon Sep 17 00:00:00 2001 From: Gary Gambill Date: Mon, 9 Sep 2019 07:43:48 -0500 Subject: [PATCH 1/8] manually integrate PR24 with 0.2.0 release --- index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 80891d3..1b638d8 100644 --- a/index.js +++ b/index.js @@ -118,11 +118,14 @@ module.exports = (api, projectOptions) => { 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; From e13ae2c02b66d8ac68daddc27782374163be7f01 Mon Sep 17 00:00:00 2001 From: Gary Gambill Date: Mon, 9 Sep 2019 07:43:57 -0500 Subject: [PATCH 2/8] build 0.2.1 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 417c895..abbae95 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.2.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4c5a07d..0c8e63c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-cli-plugin-nativescript-vue", - "version": "0.2.0", + "version": "0.2.1", "description": "A vue cli 3.x plugin for NativeScript-Vue", "main": "index.js", "files": [ From 898d72287f8d5fb9c0a73ca7b2cd616da80a93b7 Mon Sep 17 00:00:00 2001 From: Peter Date: Fri, 3 Jan 2020 20:24:47 +0100 Subject: [PATCH 3/8] Update template path for router.js --- generator/templates/nvw/src/router.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 %> From a63f54c27c14583bdb8d4aa54baac468f5a7f9c3 Mon Sep 17 00:00:00 2001 From: Peter Date: Fri, 3 Jan 2020 20:26:08 +0100 Subject: [PATCH 4/8] Update template path for router.js --- generator/templates/simple/src/router.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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'/ From b617042ecd03d2140505250a930efaadd321a2a8 Mon Sep 17 00:00:00 2001 From: Gary Gambill Date: Tue, 7 Jan 2020 08:01:06 -0600 Subject: [PATCH 5/8] fixes for env variables when using 'tns prepare' --- index.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 1b638d8..aae4590 100644 --- a/index.js +++ b/index.js @@ -106,12 +106,30 @@ 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 From d21578a3e832f254663d12854c276bd61acd9e93 Mon Sep 17 00:00:00 2001 From: Gary Gambill Date: Tue, 7 Jan 2020 08:01:35 -0600 Subject: [PATCH 6/8] build 0.3.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index abbae95..2f4a84e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "vue-cli-plugin-nativescript-vue", - "version": "0.2.1", + "version": "0.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 0c8e63c..58ee527 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-cli-plugin-nativescript-vue", - "version": "0.2.1", + "version": "0.3.0", "description": "A vue cli 3.x plugin for NativeScript-Vue", "main": "index.js", "files": [ From 3cc5ea89d504603a51856aa7b5b9ef8533c33946 Mon Sep 17 00:00:00 2001 From: Gary Gambill Date: Tue, 7 Jan 2020 09:24:21 -0600 Subject: [PATCH 7/8] NS 6.3 Compatible Bugfix: webpack-chain config to v6.0 --- generator/index.js | 20 ++++++++--------- index.js | 53 +++++++++++++++++++++++----------------------- 2 files changed, 36 insertions(+), 37 deletions(-) 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/index.js b/index.js index aae4590..a6d66bc 100644 --- a/index.js +++ b/index.js @@ -343,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 @@ -591,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 + ';' } ) ) @@ -609,8 +608,8 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => { .get('options'), { // minimize: false, - url: false, - data: '$PLATFORM: ' + platform + ';' + // url: false, + prependData: '$PLATFORM: ' + platform + ';' } ) ) @@ -655,7 +654,7 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => { { // minimize: false, url: false, - data: '$PLATFORM: ' + platform + // data: '$PLATFORM: ' + platform } ) ) @@ -671,8 +670,8 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => { .get('options'), { minimize: false, - url: false, - data: '$PLATFORM: ' + platform + // url: false, + prependData: '$PLATFORM: ' + platform } ) ) From 5b04c4c7cb2197303839237482803eaf81067179 Mon Sep 17 00:00:00 2001 From: Gary Gambill Date: Tue, 7 Jan 2020 09:24:46 -0600 Subject: [PATCH 8/8] build 0.3.1 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2f4a84e..58bbce5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "vue-cli-plugin-nativescript-vue", - "version": "0.3.0", + "version": "0.3.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 58ee527..d71e9ef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-cli-plugin-nativescript-vue", - "version": "0.3.0", + "version": "0.3.1", "description": "A vue cli 3.x plugin for NativeScript-Vue", "main": "index.js", "files": [