From 3899b4f17e2178ee50ee8fbec1a5d823759dd857 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Thu, 7 May 2020 16:48:22 +0200 Subject: [PATCH 01/10] getNSConfigPaths function --- index.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 39e3bb96..0aeffb83 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ const path = require("path"); -const { existsSync } = require("fs"); +const { existsSync, readFileSync } = require("fs"); const { ANDROID_APP_PATH } = require("./androidProjectHelpers"); const { getPackageJson, @@ -53,6 +53,22 @@ exports.getAppPath = (platform, projectDir) => { } }; +exports.getNSConfigPaths = (platform, projectDir) => { + let appPath = "app"; + let appResourcesPath = "app/App_Resources"; + const nsConfigPath = path.join(projectDir, 'nsconfig.json'); + if (existsSync(nsConfigPath)) { + const nsConfig = readFileSync(nsConfigPath).toJSON(); + if (nsConfig.appPath) { + appPath = nsConfig.appPath; + } + if (nsConfig.appResourcesPath) { + appResourcesPath = nsConfig.appResourcesPath; + } + } + return { appPath, appResourcesPath }; +}; + exports.getEntryPathRegExp = (appFullPath, entryModule) => { const entryModuleFullPath = path.join(appFullPath, entryModule); // Windows paths contain `\`, so we need to convert each of the `\` to `\\`, so it will be correct inside RegExp From b6cd1191c1e5ebaf8bc701f1afe12b3e63f21b52 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Thu, 7 May 2020 16:49:48 +0200 Subject: [PATCH 02/10] vue support for nsconfig --- templates/webpack.vue.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/templates/webpack.vue.js b/templates/webpack.vue.js index 3361cc3d..ce1ba2ef 100644 --- a/templates/webpack.vue.js +++ b/templates/webpack.vue.js @@ -37,8 +37,7 @@ module.exports = env => { // The 'appPath' and 'appResourcesPath' values are fetched from // the nsconfig.json configuration file // when bundling with `tns run android|ios --bundle`. - appPath = "app", - appResourcesPath = "app/App_Resources", + ...nsWebpack.getNSConfigPaths(), // You can provide the following flags when running 'tns run android|ios' snapshot, // --env.snapshot From 6628393742048edd1b4dced9236e7380e61bdfe0 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Thu, 7 May 2020 16:50:18 +0200 Subject: [PATCH 03/10] javascript support for nsconfig --- templates/webpack.javascript.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/templates/webpack.javascript.js b/templates/webpack.javascript.js index a927d9bf..e1ca625b 100644 --- a/templates/webpack.javascript.js +++ b/templates/webpack.javascript.js @@ -33,8 +33,7 @@ module.exports = env => { // The 'appPath' and 'appResourcesPath' values are fetched from // the nsconfig.json configuration file // when bundling with `tns run android|ios --bundle`. - appPath = "app", - appResourcesPath = "app/App_Resources", + ...nsWebpack.getNSConfigPaths(), // You can provide the following flags when running 'tns run android|ios' snapshot, // --env.snapshot From 47f8d76ad6971141240c484d4dc2e96e666cd64d Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Thu, 7 May 2020 16:51:14 +0200 Subject: [PATCH 04/10] typescript support for nsconfig --- templates/webpack.typescript.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/templates/webpack.typescript.js b/templates/webpack.typescript.js index 730c38ee..0a13da33 100644 --- a/templates/webpack.typescript.js +++ b/templates/webpack.typescript.js @@ -33,8 +33,7 @@ module.exports = env => { // The 'appPath' and 'appResourcesPath' values are fetched from // the nsconfig.json configuration file // when bundling with `tns run android|ios --bundle`. - appPath = "app", - appResourcesPath = "app/App_Resources", + ...nsWebpack.getNSConfigPaths(), // You can provide the following flags when running 'tns run android|ios' snapshot, // --env.snapshot From f0effd05850e02a92983c15232e15e1990eb45e9 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Thu, 7 May 2020 16:52:23 +0200 Subject: [PATCH 05/10] optional args to getNSConfigPaths --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 0aeffb83..302d3c21 100644 --- a/index.js +++ b/index.js @@ -53,9 +53,9 @@ exports.getAppPath = (platform, projectDir) => { } }; -exports.getNSConfigPaths = (platform, projectDir) => { - let appPath = "app"; - let appResourcesPath = "app/App_Resources"; +exports.getNSConfigPaths = (projectDir, defaultAppPath, defaultAppResourcePath) => { + let appPath = defaultAppPath | "app"; + let appResourcesPath = defaultAppResourcePath | "app/App_Resources"; const nsConfigPath = path.join(projectDir, 'nsconfig.json'); if (existsSync(nsConfigPath)) { const nsConfig = readFileSync(nsConfigPath).toJSON(); From ada6dfd1617dabb3ca5227cff9f152c7dffb405e Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Thu, 7 May 2020 17:17:50 +0200 Subject: [PATCH 06/10] fix javascript template --- templates/webpack.javascript.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/webpack.javascript.js b/templates/webpack.javascript.js index e1ca625b..39cb850e 100644 --- a/templates/webpack.javascript.js +++ b/templates/webpack.javascript.js @@ -33,7 +33,7 @@ module.exports = env => { // The 'appPath' and 'appResourcesPath' values are fetched from // the nsconfig.json configuration file // when bundling with `tns run android|ios --bundle`. - ...nsWebpack.getNSConfigPaths(), + ...nsWebpack.getNSConfigPaths(projectRoot), // You can provide the following flags when running 'tns run android|ios' snapshot, // --env.snapshot From 7574ae6ea7525e9aba6cee263d2ebe780de534a0 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Thu, 7 May 2020 17:20:11 +0200 Subject: [PATCH 07/10] fix typescript template --- templates/webpack.typescript.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/webpack.typescript.js b/templates/webpack.typescript.js index 0a13da33..dc646dcb 100644 --- a/templates/webpack.typescript.js +++ b/templates/webpack.typescript.js @@ -33,7 +33,7 @@ module.exports = env => { // The 'appPath' and 'appResourcesPath' values are fetched from // the nsconfig.json configuration file // when bundling with `tns run android|ios --bundle`. - ...nsWebpack.getNSConfigPaths(), + ...nsWebpack.getNSConfigPaths(projectRoot), // You can provide the following flags when running 'tns run android|ios' snapshot, // --env.snapshot From 9853df95ba02c9a5f1f9108bd4a40c3a3775904f Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Thu, 7 May 2020 17:20:31 +0200 Subject: [PATCH 08/10] fix vue template --- templates/webpack.vue.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/webpack.vue.js b/templates/webpack.vue.js index ce1ba2ef..486e120f 100644 --- a/templates/webpack.vue.js +++ b/templates/webpack.vue.js @@ -37,7 +37,7 @@ module.exports = env => { // The 'appPath' and 'appResourcesPath' values are fetched from // the nsconfig.json configuration file // when bundling with `tns run android|ios --bundle`. - ...nsWebpack.getNSConfigPaths(), + ...nsWebpack.getNSConfigPaths(projectRoot), // You can provide the following flags when running 'tns run android|ios' snapshot, // --env.snapshot From 5e414dbdb0dd6f15753019fdfe63a253d8f34682 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Thu, 7 May 2020 17:21:01 +0200 Subject: [PATCH 09/10] angular support for nsconfig --- templates/webpack.angular.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/templates/webpack.angular.js b/templates/webpack.angular.js index 2f196cb2..d72a492e 100644 --- a/templates/webpack.angular.js +++ b/templates/webpack.angular.js @@ -37,8 +37,7 @@ module.exports = env => { // The 'appPath' and 'appResourcesPath' values are fetched from // the nsconfig.json configuration file // when bundling with `tns run android|ios --bundle`. - appPath = "src", - appResourcesPath = "App_Resources", + ...nsWebpack.getNSConfigPaths(projectRoot, "src"), // You can provide the following flags when running 'tns run android|ios' aot, // --env.aot From 57ab1eab7acfc5ee028a3a2b6b61061c183ebfbf Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Fri, 8 May 2020 10:20:44 +0200 Subject: [PATCH 10/10] fix: fixed getNSConfigPaths --- index.js | 4 ++-- templates/webpack.angular.js | 7 +++++-- templates/webpack.config.spec.ts | 1 + templates/webpack.javascript.js | 6 ++++-- templates/webpack.typescript.js | 6 ++++-- templates/webpack.vue.js | 6 ++++-- 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 302d3c21..465fba82 100644 --- a/index.js +++ b/index.js @@ -54,8 +54,8 @@ exports.getAppPath = (platform, projectDir) => { }; exports.getNSConfigPaths = (projectDir, defaultAppPath, defaultAppResourcePath) => { - let appPath = defaultAppPath | "app"; - let appResourcesPath = defaultAppResourcePath | "app/App_Resources"; + let appPath = defaultAppPath || "app"; + let appResourcesPath = defaultAppResourcePath || "app/App_Resources"; const nsConfigPath = path.join(projectDir, 'nsconfig.json'); if (existsSync(nsConfigPath)) { const nsConfig = readFileSync(nsConfigPath).toJSON(); diff --git a/templates/webpack.angular.js b/templates/webpack.angular.js index d72a492e..a8d49b9c 100644 --- a/templates/webpack.angular.js +++ b/templates/webpack.angular.js @@ -33,12 +33,15 @@ module.exports = env => { const dist = resolve(projectRoot, nsWebpack.getAppPath(platform, projectRoot)); const appResourcesPlatformDir = platform === "android" ? "Android" : "iOS"; + const { // The 'appPath' and 'appResourcesPath' values are fetched from // the nsconfig.json configuration file // when bundling with `tns run android|ios --bundle`. - ...nsWebpack.getNSConfigPaths(projectRoot, "src"), - + appPath, + appResourcesPath + } = nsWebpack.getNSConfigPaths(projectRoot, "src") + const { // You can provide the following flags when running 'tns run android|ios' aot, // --env.aot snapshot, // --env.snapshot diff --git a/templates/webpack.config.spec.ts b/templates/webpack.config.spec.ts index 8a17cb6f..fd95c2fe 100644 --- a/templates/webpack.config.spec.ts +++ b/templates/webpack.config.spec.ts @@ -19,6 +19,7 @@ const nativeScriptDevWebpack = { WatchStateLoggerPlugin: EmptyClass, PlatformFSPlugin: EmptyClass, getAppPath: () => 'app', + getNSConfigPaths: () => ({ appPath: 'app', appResourcesPath: 'app/App_Resources' }), getEntryModule: () => 'EntryModule', getResolver: () => null, getEntryPathRegExp: () => null, diff --git a/templates/webpack.javascript.js b/templates/webpack.javascript.js index 39cb850e..9c7938c2 100644 --- a/templates/webpack.javascript.js +++ b/templates/webpack.javascript.js @@ -33,8 +33,10 @@ module.exports = env => { // The 'appPath' and 'appResourcesPath' values are fetched from // the nsconfig.json configuration file // when bundling with `tns run android|ios --bundle`. - ...nsWebpack.getNSConfigPaths(projectRoot), - + appPath, + appResourcesPath + } = nsWebpack.getNSConfigPaths(projectRoot) + const { // You can provide the following flags when running 'tns run android|ios' snapshot, // --env.snapshot uglify, // --env.uglify diff --git a/templates/webpack.typescript.js b/templates/webpack.typescript.js index dc646dcb..70b86ee4 100644 --- a/templates/webpack.typescript.js +++ b/templates/webpack.typescript.js @@ -33,8 +33,10 @@ module.exports = env => { // The 'appPath' and 'appResourcesPath' values are fetched from // the nsconfig.json configuration file // when bundling with `tns run android|ios --bundle`. - ...nsWebpack.getNSConfigPaths(projectRoot), - + appPath, + appResourcesPath + } = nsWebpack.getNSConfigPaths(projectRoot) + const { // You can provide the following flags when running 'tns run android|ios' snapshot, // --env.snapshot uglify, // --env.uglify diff --git a/templates/webpack.vue.js b/templates/webpack.vue.js index 486e120f..169bc768 100644 --- a/templates/webpack.vue.js +++ b/templates/webpack.vue.js @@ -37,8 +37,10 @@ module.exports = env => { // The 'appPath' and 'appResourcesPath' values are fetched from // the nsconfig.json configuration file // when bundling with `tns run android|ios --bundle`. - ...nsWebpack.getNSConfigPaths(projectRoot), - + appPath, + appResourcesPath + } = nsWebpack.getNSConfigPaths(projectRoot) + const { // You can provide the following flags when running 'tns run android|ios' snapshot, // --env.snapshot production, // --env.production 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