@fto-consult/expo-ui 2.7.12 → 2.7.13

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.
Files changed (2) hide show
  1. package/expo-ui-path.js +19 -8
  2. package/package.json +1 -1
package/expo-ui-path.js CHANGED
@@ -6,26 +6,34 @@ const fs = require("fs");
6
6
  const path = require("path");
7
7
  const { hideBin } = require('yargs/helpers')
8
8
  const yargs = require('yargs/yargs');
9
+ let pathRef = {current:null};
10
+ const metroConfig = "metro.config";
9
11
  ///retourne le chemin vers le package @expo-ui
10
12
  module.exports = function (...args){
11
- const argv = yargs(hideBin(process.argv)).argv
12
- let isBuild = false;
13
- const expoUIPath = "@fto-consult/expo-ui";
14
- if(typeof argv == 'object' && argv && !Array.isArray(argv)){
13
+ const argv = yargs(hideBin(process.argv)).argv;
14
+ const suffix = path.join(...args);
15
+ const isMetroConfig = suffix && suffix.toLowerCase().includes(metroConfig);
16
+ let isBuild = isMetroConfig ? false : pathRef.current ? true : false;
17
+ let expoUIPath = isBuild ? pathRef.current : "@fto-consult/expo-ui";
18
+ if(isMetroConfig && typeof argv == 'object' && argv && !Array.isArray(argv)){
15
19
  for(let i in argv){
16
20
  let v = argv[i];
17
21
  if(typeof v !='string' || !v) continue;
18
22
  v = v.toLowerCase();
19
23
  i = (i+'').toLocaleLowerCase();
20
- if(i.includes("export") || v.includes('build') || v.includes('production') || v.includes('export') || v.includes('android')){
21
- isBuild = true;
22
- break;
24
+ if(i != '$0'){
25
+ if(v.includes('production') || v.includes('export') || v.includes('android')){
26
+ isBuild = true;
27
+ break;
28
+ }
23
29
  }
24
30
  }
25
31
  }
26
- const suffix = path.join(...args);
27
32
  const sep = path.sep;
28
33
  if(isBuild){
34
+ if(isMetroConfig){
35
+ pathRef.current = expoUIPath;
36
+ }
29
37
  const pp = suffix ? path.join(expoUIPath,suffix).replace(sep,"/") : expoUIPath;
30
38
  return pp;
31
39
  }
@@ -34,6 +42,9 @@ module.exports = function (...args){
34
42
  const rootPath = path.resolve(p,"..");
35
43
  const src = path.resolve(rootPath,"src");
36
44
  if(fs.existsSync(src) && fs.existsSync((path.resolve(rootPath,"babel.config.js")))){
45
+ if(isMetroConfig){
46
+ pathRef.current = path.resolve(p);
47
+ }
37
48
  return path.resolve(p,suffix).replace(sep,(sep+sep));
38
49
  }
39
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "2.7.12",
3
+ "version": "2.7.13",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "resolutions": {