@fto-consult/expo-ui 1.1.29 → 1.1.31

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.
@@ -1,7 +1,6 @@
1
1
  const path = require("path");
2
2
  module.exports = (opts)=>{
3
3
  const dir = path.resolve(__dirname);
4
- const expo = path.resolve(dir,"src");
5
4
  const assets = path.resolve(dir,"assets");
6
5
  opts = typeof opts =='object' && opts ? opts : {};
7
6
  opts.platform = "expo";
@@ -9,7 +8,10 @@ module.exports = (opts)=>{
9
8
  opts.base = opts.base || dir;
10
9
  opts.withPouchDB = opts.withPouchDB !== false && opts.withPouchdb !== false ? true : false;
11
10
  delete opts.withPouchdb;
12
- const r = require("@fto-consult/common/babel.config.alias")(opts);
11
+ const src = path.resolve(opts.base);
12
+ const expo = require("./lookup-expo-ui-path")()?path.resolve(src,"..","expo-ui") : path.resolve(dir,"src");
13
+ console.log(expo," is expo heee ",`${expo/node_modules}/babel.config.alias`);
14
+ const r = require(`${expo/node_modules}/babel.config.alias`)(opts);
13
15
  r["$eauth"] = path.resolve(expo,"auth");
14
16
  r["$ecomponents"] = r["$expo-components"] = path.resolve(expo,"components");
15
17
  r["$components"] = r["$components"] || r["$ecomponents"];
@@ -67,7 +69,6 @@ module.exports = (opts)=>{
67
69
  if(!r["$logoComponent"]){
68
70
  r["$logoComponent"] = r["$elogoComponent"];
69
71
  }
70
-
71
72
  if(typeof opts.mutator =='function'){
72
73
  opts.mutator(r);
73
74
  }
package/expo-ui-path.js CHANGED
@@ -4,49 +4,18 @@
4
4
 
5
5
  const fs = require("fs");
6
6
  const path = require("path");
7
- const dir = path.resolve(__dirname)
8
7
  ///retourne le chemin vers le package @expo-ui
9
8
  module.exports = function (...args){
10
9
  const suffix = path.join(...args);
11
- const p = lookupForExpoUIPath();
10
+ const p = require("./lookup-expo-ui-path")();
12
11
  const sep = path.sep;
13
12
  if(p && fs.existsSync(p)){
14
13
  const rootPath = path.resolve(p,"..");
15
14
  const src = path.resolve(rootPath,"src");
16
15
  if(fs.existsSync(src) && fs.existsSync((path.resolve(rootPath,"babel.config.js")))){
17
- const expoUIPath = path.resolve(rootPath,"expo-ui-build-path.js");
18
- try {
19
- var writeStream = fs.createWriteStream(expoUIPath);
20
- writeStream.write("module.exports=\"./expo-ui/\";");
21
- writeStream.end();
22
- return path.resolve(p,suffix).replace(sep,(sep+sep));
23
- } catch{
24
- if(fs.existsSync(expoUIPath)){
25
- try {
26
- fs.rmSync(expoUIPath);
27
- } catch{}
28
- }
29
- }
16
+ return path.resolve(p,suffix).replace(sep,(sep+sep));
30
17
  }
31
18
  }
32
19
  return suffix ? path.join("@fto-consult/expo-ui",suffix).replace(sep,"/"):"@fto-consult/expo-ui";
33
20
  };
34
21
 
35
- const lookupForExpoUIPath = ()=>{
36
- let level = 4; //jusqu'à 4 niveaux
37
- let expoUIPath= null;
38
- let rootPath = path.resolve(dir);
39
- while(level>0 && !expoUIPath){
40
- const p = path.resolve(rootPath,"expo-ui");
41
- const nPath = path.resolve(rootPath,"node_modules");
42
- const srcPath = path.resolve(rootPath,"src");
43
- const babelPath = path.resolve(rootPath,"babel.config.js");
44
- if(fs.existsSync(p) && fs.existsSync(nPath) && fs.existsSync(srcPath) && fs.existsSync(babelPath)){
45
- expoUIPath = p;
46
- return expoUIPath;
47
- }
48
- rootPath = path.resolve(rootPath,"..");
49
- level = level-1;
50
- }
51
- return expoUIPath;
52
- }
@@ -0,0 +1,24 @@
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
+ const fs = require("fs");
5
+ const path = require("path");
6
+ const dir = path.resolve(__dirname)
7
+ module.exports = function lookupForExpoUIPath (){
8
+ let level = 4; //jusqu'à 4 niveaux
9
+ let expoUIPath= null;
10
+ let rootPath = path.resolve(dir);
11
+ while(level>0 && !expoUIPath){
12
+ const p = path.resolve(rootPath,"expo-ui");
13
+ const nPath = path.resolve(rootPath,"node_modules");
14
+ const srcPath = path.resolve(rootPath,"src");
15
+ const babelPath = path.resolve(rootPath,"babel.config.js");
16
+ if(fs.existsSync(p) && fs.existsSync(nPath) && fs.existsSync(srcPath) && fs.existsSync(babelPath)){
17
+ expoUIPath = p;
18
+ return expoUIPath;
19
+ }
20
+ rootPath = path.resolve(rootPath,"..");
21
+ level = level-1;
22
+ }
23
+ return expoUIPath;
24
+ }
package/metro.config.js CHANGED
@@ -1,7 +1,6 @@
1
1
  const { getDefaultConfig } = require('@expo/metro-config');
2
2
  const path = require("path");
3
3
  const isCaseSensitive = require("./is-os-case-sensitive");
4
- const fs = require("fs");
5
4
  module.exports = (opts)=>{
6
5
  opts = opts && typeof opts =='object'? opts : {};
7
6
  let {dir,nodeModulesPaths,assetExts,sourceExts} = opts;
@@ -9,7 +8,6 @@ module.exports = (opts)=>{
9
8
  assetExts = Array.isArray(assetExts)? assetExts: [];
10
9
  sourceExts= Array.isArray(sourceExts)?sourceExts : [];
11
10
  dir = dir || path.resolve(__dirname);
12
- require("./expo-ui-path")(path.basename(__filename));
13
11
  const projectRoot = path.resolve(dir);
14
12
  const localDir = path.resolve(__dirname);
15
13
  const config = getDefaultConfig(projectRoot);
@@ -17,16 +15,6 @@ module.exports = (opts)=>{
17
15
  if(projectRoot !== localDir){
18
16
  config.watchFolders.push(localDir);
19
17
  }
20
- const eUI = path.resolve(projectRoot,"expo-ui-build-path.js");
21
- //si le fichier n'existe pas alors on le crèèe
22
- if(!fs.existsSync(eUI)){
23
- try {
24
- const writeStream = fs.createWriteStream(eUI);
25
- writeStream.write("module.exports=\"@fto-consult/expo-ui/\";");
26
- writeStream.end();
27
- return path.resolve(p,suffix).replace(sep,(sep+sep));
28
- }catch{}
29
- }
30
18
  config.resolver.assetExts = [
31
19
  ...config.resolver.assetExts,
32
20
  ...assetExts,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "1.1.29",
3
+ "version": "1.1.31",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {