@fto-consult/expo-ui 9.0.3 → 9.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/expo-ui-path.js CHANGED
@@ -1,32 +1,3 @@
1
- // Copyright 2022 @fto-consult/Boris Fouomene. All rights reserved.
2
- // Use of this source code is governed by a BSD-style
3
- // license that can be found in the LICENSE file.
4
-
5
- const fs = require("fs");
6
- const path = require("path");
7
- const {JSONManager} = require("@fto-consult/node-utils");
8
- ///retourne le chemin vers le package @expo-ui
9
1
  module.exports = function (projectRoot){
10
- const sep = path.sep;
11
- if(require("./is-local-dev")()){//le programme s'exécute en environnement fix bugs sur electron
12
- return path.resolve(__dirname).replace(sep,(sep+sep));///pour la résolution du module expo-ui en mode test
13
- }
14
- const isDev = String(process.env.NODE_ENV).toLowerCase().trim() !="production";
15
- projectRoot = typeof projectRoot =='string' && fs.existsSync(path.resolve(projectRoot)) && path.resolve(projectRoot) || process.cwd();
16
- const packageJSON = path.resolve(projectRoot,"package.json");
17
- const expoUIPath = path.resolve(projectRoot,"node_modules","@fto-consult","expo-ui");
18
- if(isDev && fs.existsSync(packageJSON)){
19
- const pM = JSONManager(packageJSON);
20
- if(pM.hasPackage){
21
- const expoUIRootPath = pM.get("expoUIRootPath");
22
- if(typeof expoUIRootPath =="string" && expoUIRootPath){
23
- const p = path.resolve(expoUIRootPath);
24
- const pM2 = JSONManager(path.resolve(expoUIRootPath,"package.json"));
25
- if(pM2.hasPackage && pM2.get("name") =="@fto-consult/expo-ui" && fs.existsSync(p) && fs.existsSync(path.resolve(p,"src"))){
26
- return p;
27
- }
28
- }
29
- }
30
- }
31
- return expoUIPath;
2
+ return require("./fto-consult-path")(projectRoot,"@fto-consult/expo-ui","expoUIRootPath");
32
3
  };
@@ -1,7 +1,33 @@
1
1
  // Copyright 2022 @fto-consult/Boris Fouomene. All rights reserved.
2
2
  // Use of this source code is governed by a BSD-style
3
3
  // license that can be found in the LICENSE file.
4
+
5
+ const fs = require("fs");
6
+ const path = require("path");
7
+ const {JSONManager} = require("@fto-consult/node-utils");
4
8
  ///retourne le chemin vers le package @expo-ui
5
- module.exports = function (projectRoot){
6
- return require("./fto-consult-path")(projectRoot,"@fto-consult/expo-ui","expoUIRootPath");
9
+ /***
10
+ * @param {string} projectRoot, le project root
11
+ * @param {string} moduleName, le module name
12
+ * @param {string} packageKey, la clé dans le package
13
+ */
14
+ module.exports = function (projectRoot,moduleName,packageKey){
15
+ const isDev = String(process.env.NODE_ENV).toLowerCase().trim() !="production";
16
+ projectRoot = typeof projectRoot =='string' && fs.existsSync(path.resolve(projectRoot)) && path.resolve(projectRoot) || process.cwd();
17
+ const packageJSON = path.resolve(projectRoot,"package.json");
18
+ const ftoConsultPath = path.resolve(projectRoot,"node_modules",moduleName);
19
+ if(isDev && fs.existsSync(packageJSON)){
20
+ const pM = JSONManager(packageJSON);
21
+ if(pM.hasPackage){
22
+ const moduleRoutePath = pM.get(packageKey);
23
+ if(typeof moduleRoutePath =="string" && moduleRoutePath){
24
+ const p = path.resolve(moduleRoutePath);
25
+ const pM2 = JSONManager(path.resolve(moduleRoutePath,"package.json"));
26
+ if(pM2.hasPackage && pM2.get("name") == moduleName && fs.existsSync(p)){
27
+ return p;
28
+ }
29
+ }
30
+ }
31
+ }
32
+ return ftoConsultPath;
7
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "9.0.3",
3
+ "version": "9.1.0",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "react-native-paper-doc": "https://github.com/callstack/react-native-paper/tree/main/docs/docs/guides",
6
6
  "scripts": {