@fto-consult/expo-ui 1.1.11 → 1.1.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.
- package/babel.config.js +5 -1
- package/expo-ui-current-script.js +21 -0
- package/expo-ui-path.js +3 -13
- package/expo.metro.config.js +5 -0
- package/index.js +5 -2
- package/package.json +1 -1
- package/webpack.config.js +15 -0
package/babel.config.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
require("./expo-ui-path");
|
|
2
1
|
module.exports = function(api,opts) {
|
|
2
|
+
const script = require("./expo-ui-current-script")(__filename);
|
|
3
|
+
if(script){
|
|
4
|
+
console.log("found local babel.config.js on expo-ui dev path at ",script);
|
|
5
|
+
return require(script)(api,opts);
|
|
6
|
+
}
|
|
3
7
|
opts = typeof opts =='object' && opts ? opts : {};
|
|
4
8
|
///les chemin vers la variable d'environnement, le chemin du fichier .env,@see : https://github.com/brysgo/babel-plugin-inline-dotenv
|
|
5
9
|
let environmentPath = opts.environmentPath || opts.envPath;
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
/*** permet de vérifier si le dossier expo-ui existe à la racine du projet si oui,
|
|
6
|
+
* en mode développement, c'est le contenu de ce dossier qui sera chargé pour faire référence au module
|
|
7
|
+
* @fto-consult/expo-ui, afin de faciliter le développement dudit package
|
|
8
|
+
* @param {string} currentScriptFilePath - le chemin complet du script node en cours d'exécution
|
|
9
|
+
* @return {boolean} qui détermine si le dossier local expo-ui est présent où non
|
|
10
|
+
*/
|
|
11
|
+
module.exports = (currentScriptFilePath)=>{
|
|
12
|
+
const fs = require("fs");
|
|
13
|
+
const path = require("path");
|
|
14
|
+
const fileName = path.basename(currentScriptFilePath);
|
|
15
|
+
const expoUIPath = require("./expo-ui-path");
|
|
16
|
+
if(expoUIPath){
|
|
17
|
+
const eP = path.resolve(expoUIPath,fileName);
|
|
18
|
+
return fs.existsSync(eP) && eP != currentScriptFilePath ? eP : null;
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
}
|
package/expo-ui-path.js
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
const fs = require("fs");
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const dir = path.resolve(__dirname)
|
|
8
|
-
let devExpoUIPath = path.resolve(dir);
|
|
9
8
|
const lookupForExpoUIPath = ()=>{
|
|
10
9
|
let level = 4; //jusqu'à 4 niveaux
|
|
11
10
|
let expoUIPath= null;
|
|
@@ -24,23 +23,14 @@ const lookupForExpoUIPath = ()=>{
|
|
|
24
23
|
}
|
|
25
24
|
return expoUIPath;
|
|
26
25
|
}
|
|
27
|
-
console.log(lookupForExpoUIPath()," is lookup path");
|
|
28
26
|
///retourne le chemin vers le package @expo-ui
|
|
29
27
|
module.exports = (()=>{
|
|
30
|
-
const isDev = fs.existsSync(devExpoUIPath) && fs.existsSync(path.resolve(devExpoUIPath,"babel.config.alias.js"))
|
|
31
|
-
&& fs.existsSync(path.resolve(devExpoUIPath,"src"));
|
|
32
28
|
const isDevFile = path.resolve(dir,"expo-ui-production-path.js");
|
|
33
|
-
const expoUIPath =
|
|
29
|
+
const expoUIPath = lookupForExpoUIPath();
|
|
34
30
|
try {
|
|
35
31
|
var writeStream = fs.createWriteStream(isDevFile);
|
|
36
|
-
writeStream.write("module.exports=\""+expoUIPath+"\";");
|
|
32
|
+
writeStream.write("module.exports=\""+(expoUIPath||"@fto-consult/expo-ui")+"\";");
|
|
37
33
|
writeStream.end();
|
|
38
|
-
} catch{
|
|
39
|
-
if(fs.existsSync(isDevFile)){
|
|
40
|
-
try {
|
|
41
|
-
fs.rmSync(isDevFile);
|
|
42
|
-
} catch{}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
34
|
+
} catch{}
|
|
45
35
|
return expoUIPath;
|
|
46
36
|
})();
|
package/expo.metro.config.js
CHANGED
|
@@ -2,6 +2,11 @@ const { getDefaultConfig } = require('@expo/metro-config');
|
|
|
2
2
|
const path = require("path");
|
|
3
3
|
const isCaseSensitive = require("./is-os-case-sensitive");
|
|
4
4
|
module.exports = (opts)=>{
|
|
5
|
+
const script = require("./expo-ui-current-script")(__filename);
|
|
6
|
+
if(script){
|
|
7
|
+
console.log("found local metro-config dev file path at ",script);
|
|
8
|
+
return require(script)(opts);
|
|
9
|
+
}
|
|
5
10
|
opts = opts && typeof opts =='object'? opts : {};
|
|
6
11
|
let {dir,nodeModulesPaths,assetExts,sourceExts} = opts;
|
|
7
12
|
nodeModulesPaths = Array.isArray(nodeModulesPaths)? nodeModulesPaths : [];
|
package/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { registerRootComponent } from 'expo';
|
|
2
|
-
|
|
2
|
+
const expoPath = (require("./expo-ui-production-path")+"/").replace("//","/");
|
|
3
|
+
const appConfigPath = expoPath+"node_modules/@fto-consult/common/src/app/config";
|
|
4
|
+
console.log(expoPath," is expo path found heinnnnn ",appConfigPath," and expo app is ",expoPath+'src/App');
|
|
5
|
+
const appConfig = require (appConfigPath);
|
|
3
6
|
|
|
4
7
|
const isObj = x=>typeof x =='object' && x && !Array.isArray(x);
|
|
5
8
|
const defaultObj = x=> isObj(x)? x : {};
|
|
@@ -14,5 +17,5 @@ export default function registerExpoUIApp (options){
|
|
|
14
17
|
options = defaultObj(options);
|
|
15
18
|
const config = defaultObj(options.config);
|
|
16
19
|
appConfig.current = config;
|
|
17
|
-
registerRootComponent(require('
|
|
20
|
+
registerRootComponent(require(expoPath+'src/App').default(options));
|
|
18
21
|
}
|
package/package.json
CHANGED
package/webpack.config.js
CHANGED
|
@@ -2,8 +2,23 @@
|
|
|
2
2
|
const createExpoWebpackConfigAsync = require('@expo/webpack-config')
|
|
3
3
|
// Expo CLI will await this method so you can optionally return a promise.
|
|
4
4
|
module.exports = async function(env, argv,opts) {
|
|
5
|
+
const script = require("./expo-ui-current-script")(__filename);
|
|
6
|
+
if(script){
|
|
7
|
+
console.log("found local webpack.config.js on expo-ui dev path at ",script);
|
|
8
|
+
return require(script)(env, argv,opts);
|
|
9
|
+
}
|
|
5
10
|
const path = require("path");
|
|
6
11
|
const dir = path.resolve(__dirname);
|
|
12
|
+
const fs = require("fs");
|
|
13
|
+
const fileName = path.basename(__filename);
|
|
14
|
+
const expoUIPath = require("./expo-ui-path");;
|
|
15
|
+
if(expoUIPath){
|
|
16
|
+
const eP = path.resolve(expoUIPath,fileName);
|
|
17
|
+
if(fs.existsSync(eP) && eP != __filename){
|
|
18
|
+
console.log("***** loading webpack config",eP,"babel config file")
|
|
19
|
+
return require(ep)(env,argv,opts);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
7
22
|
opts = typeof opts =="object" && opts ? opts : {};
|
|
8
23
|
const transpileModules = Array.isArray(opts.transpileModules)? opts.transpileModules : [];
|
|
9
24
|
const config = await createExpoWebpackConfigAsync(
|