@fto-consult/expo-ui 8.20.7 → 8.21.1

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.
@@ -11,7 +11,7 @@ module.exports = (opts)=>{
11
11
  opts.projectRoot = opts.projectRoot || projectRoot;
12
12
  opts.withPouchDB = opts.withPouchDB !== false && opts.withPouchdb !== false ? true : false;
13
13
  delete opts.withPouchdb;
14
- const expoUI = require("./expo-ui-path")();
14
+ const expoUI = opts.isWeb === true ? require("./expo-ui-path")() : path.resolve(projectRoot,"node_modules","@fto-consult","expo-ui");
15
15
  const r = require("@fto-consult/common/babel.config.alias")(opts);
16
16
  const expo = path.resolve(expoUI,"src");
17
17
  r["$ecomponents"] = r["$expo-components"] = path.resolve(expo,"components");
@@ -64,9 +64,7 @@ module.exports = (opts)=>{
64
64
  }
65
65
  r.$eutils = path.resolve(expo,"utils");
66
66
  r.$ehooks = path.resolve(expo,"context","hooks");
67
- ///le chemin racine du projet expo-ui
68
67
  r["$expo-ui-root-path"] = r["$expo-ui-root"]= path.resolve(expo,"..");
69
-
70
68
  const $electron = path.resolve(dir,"electron");
71
69
  //le chemin ver le repertoire electron
72
70
  r.$eelectron = r["$e-electron"] = $electron;
package/babel.config.js CHANGED
@@ -1,19 +1,22 @@
1
+ const path = require("path");
2
+ const fs = require("fs");
3
+
1
4
  module.exports = function(api,opts) {
5
+ api.cache(true);
2
6
  opts = typeof opts =='object' && opts ? opts : {};
3
- api = api && typeof api =='object'? api : {};
4
- ///les chemin vers la variable d'environnement, le chemin du fichier .env,@see : https://github.com/brysgo/babel-plugin-inline-dotenv
5
- //console.log(environmentPath," is envvv ",opts);
6
- const path = require("path");
7
- const fs = require("fs");
8
- typeof api.cache =='function' && api.cache(true);
9
7
  const inlineDovOptions = { unsafe: true};
10
- const options = {...opts,platform:"expo"};
8
+ const platform = api.caller(caller => caller && caller.platform);
9
+ const isWeb = platform === 'web';
10
+ const options = {...opts,isWeb,isAndroid:platform==="android",isIos : platform==="ios",platform:"expo"};
11
11
  const environmentPath = require("./copy-env-file")();
12
12
  if(environmentPath && fs.existsSync(environmentPath)){
13
13
  inlineDovOptions.path ='./.env';
14
14
  }
15
15
  /*** par défaut, les variables d'environnements sont stockés dans le fichier .env situé à la racine du projet, référencée par la prop base */
16
16
  const alias = require("./babel.config.alias")(options);
17
+ if(typeof options.aliasMutator =="function"){
18
+ options.aliasMutator(alias);
19
+ }
17
20
  require(`${path.resolve(__dirname,"bin","generate-tables")}`)();//génère les tables des bases de données
18
21
  const plugins = (Array.isArray(opts.plugins) ? options.plugins : []);
19
22
  let reanimated = "react-native-reanimated/plugin";
@@ -1,22 +1,22 @@
1
- {
2
- "expo": {
3
- "name": "expo-ui",
4
- "slug": "fto-consult-expo-ui",
5
- "scheme": "fto-consult-expo-ui",
6
- "version": "1.0.0",
7
- "orientation": "portrait",
8
- "expoSdkVersion" : "50",
9
- "web": {
10
- "bundler": "webpack"
11
- },
12
- "android": {
13
- "package": "com.borispipo.ftoconsultexpoui"
14
- },
15
- "extra": {
16
- "eas": {
17
- "projectId": "b895ce11-4941-4ea9-80da-b24d5abb4483"
18
- }
19
- }
20
- },
21
- "userInterfaceStyle": "automatic"
22
- }
1
+ {
2
+ "expo": {
3
+ "name": "expo-ui",
4
+ "slug": "fto-consult-expo-ui",
5
+ "scheme": "fto-consult-expo-ui",
6
+ "version": "1.0.0",
7
+ "orientation": "portrait",
8
+ "expoSdkVersion" : "50",
9
+ "web": {
10
+ "bundler": "webpack"
11
+ },
12
+ "android": {
13
+ "package": "com.borispipo.ftoconsultexpoui"
14
+ },
15
+ "extra": {
16
+ "eas": {
17
+ "projectId": "b895ce11-4941-4ea9-80da-b24d5abb4483"
18
+ }
19
+ }
20
+ },
21
+ "userInterfaceStyle": "automatic"
22
+ }
package/bin/create-app.js CHANGED
@@ -207,7 +207,7 @@ const createAPPJSONFile = (projectRoot,{name,version})=>{
207
207
  appJSONManager.save();
208
208
  }
209
209
  const eas = path.resolve(projectRoot,"eas.json");
210
- const cEas = path.resolve(__dirname,"..","eas.json");
210
+ const cEas = path.resolve(__dirname,"create-app","eas.json");
211
211
  if(!fs.existsSync(eas) && fs.existsSync(cEas)){
212
212
  try {
213
213
  copy(cEas,eas,{overwrite:false})
package/metro.config.js CHANGED
@@ -6,8 +6,7 @@ module.exports = function(opts){
6
6
  let {assetExts,sourceExts} = opts;
7
7
  assetExts = Array.isArray(assetExts)? assetExts: [];
8
8
  sourceExts= Array.isArray(sourceExts)?sourceExts : [];
9
- const projectRoot = path.resolve(process.cwd());
10
- const localDir = path.resolve(__dirname);
9
+ const projectRoot = typeof opts.projectRoot =="string" && opts.projectRoot && fs.existsSync(path.resolve(opts.projectRoot))? path.resolve(opts.projectRoot) : path.resolve(process.cwd());
11
10
  const transpilePath = null;//require("./create-transpile-module-transformer")(opts);
12
11
  const hasTranspilePath = typeof transpilePath =='string' && transpilePath && fs.existsSync(transpilePath);
13
12
  //@see : https://docs.expo.dev/versions/latest/config/metro/
@@ -38,15 +37,21 @@ module.exports = function(opts){
38
37
  ...sourceExts,"txt",
39
38
  'jsx', 'js','tsx',
40
39
  ]
41
-
40
+ config.watchFolders = Array.isArray(config.watchFolders)? config.watchFolders : [];
41
+ let hasFTO = false;
42
+ for(let i in config.watchFolders){
43
+ if(typeof config.watchFolders[i] ==="string" && config.watchFolders[i].includes("@fto-consult")){
44
+ hasFTO = true;
45
+ }
46
+ }
47
+ if(!hasFTO){
48
+ config.watchFolders.push(path.resolve(projectRoot,"node_modules","@fto-consult"))
49
+ }
42
50
  // 3. Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths`
43
51
  config.resolver.disableHierarchicalLookup = true;
44
52
 
45
53
  // Remove all console logs in production...
46
54
  config.transformer.minifierConfig.compress.drop_console = false;
47
55
 
48
- // 3. Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths`, @see : https://docs.expo.dev/guides/monorepos/
49
- config.resolver.disableHierarchicalLookup = true;
50
-
51
56
  return config;
52
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "8.20.7",
3
+ "version": "8.21.1",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "scripts": {
6
6
  "clear-npx-cache": "npx clear-npx-cache",
@@ -37,8 +37,7 @@
37
37
  "logcat-export": "adb -d logcat com.ftc.apps.salite1 *:S > logcat.txt",
38
38
  "electron-c": "npm run compile-electron && npm run electron",
39
39
  "electron-p": "npm run compile-electron-p && npm run electron",
40
- "update-app-version": "node ./update-app-version.js",
41
- "find-licenses": "node ./find-licenses.js",
40
+ "find-licenses": "node ./bin/find-licenses.js",
42
41
  "fix-dependencies": "expo-cli doctor --fix-dependencies",
43
42
  "expo-fix": "npx expo install --fix",
44
43
  "update-apexchart": "node ./bin/update-appex-chart.js",
package/edit-json-file.js DELETED
@@ -1,41 +0,0 @@
1
- /*** met à jour dynamiquement la version de l'application */
2
- const jsonfile = require('jsonfile');
3
- const fs = require('fs')
4
-
5
- function recursiveUpdate(initial, update,recursiveArray){
6
- initial = initial && typeof initial == 'object'? initial : {};
7
- for(prop in update){
8
- if({}.hasOwnProperty.call(update, prop)){
9
- if(update[prop] && typeof update[prop] === 'object'){
10
- if(Array.isArray(update[prop]) && recursiveArray !==false){
11
- initial[prop] = update[prop];
12
- } else {
13
- recursiveUpdate(initial[prop], update[prop],recursiveArray);
14
- }
15
- } else if(typeof update[prop] == 'string' && update[prop] ) {
16
- initial[prop] = update[prop].toString().replace(/\+/g, ' ');
17
- }
18
- }
19
- }
20
- return initial;
21
- }
22
-
23
- function editJsonFile(packagePath,config){
24
- if(!fs.existsSync(packagePath)) return;
25
- try {
26
- let packaged = jsonfile.readFileSync(packagePath);
27
- if(!config || typeof config != 'object') return false;
28
- recursiveUpdate(packaged,config);
29
- jsonfile.writeFileSync(packagePath, packaged, {spaces: 4})
30
- return true;
31
- }
32
- catch (e) {
33
- process.stdout.write('An exception occurred:\n')
34
- process.stdout.write(' ' + e.message)
35
- process.stdout.write('\n')
36
- process.exit(1)
37
- }
38
- }
39
-
40
-
41
- module.exports = editJsonFile;
package/env.js DELETED
@@ -1,11 +0,0 @@
1
-
2
- //permet de retourner le contenu de la variable d'environnement .env de l'application//
3
- module.exports = function(){
4
- const fs = require("fs");
5
- const path = require("path");
6
- try {
7
- const envPath = path.resolve(process.cwd(),".env");
8
- return fs.existsSync(envPath)? require("./parse-env")(fs.readFileSync(envPath,'utf8')) : {};
9
- } catch{}
10
- return {};
11
- }
@@ -1,16 +0,0 @@
1
- if(isDevEnv){
2
- const rootPath = process.cwd();
3
- const src = path.resolve(rootPath,"src");
4
- try {
5
- const envObj = require("./parse-env")();
6
- const euPathm = typeof envObj.EXPO_UI_ROOT_PATH =="string" && envObj.EXPO_UI_ROOT_PATH && path.resolve(envObj.EXPO_UI_ROOT_PATH)||'';
7
- const eu = euPathm && fs.existsSync(euPathm)? euPathm : null;
8
- if(eu && fs.existsSync(path.resolve(eu,"src")) && fs.existsSync(path.resolve(eu,"webpack.config.js"))){
9
- return path.resolve(eu,suffix).replace(sep,(sep+sep));
10
- }
11
- } catch{}
12
- const expoUi = path.resolve(rootPath,"expo-ui");
13
- if(fs.existsSync(src) && fs.existsSync(expoUi) && fs.existsSync(path.resolve(expoUi,"webpack.config.js"))){
14
- return path.resolve(expoUi,suffix).replace(sep,(sep+sep));
15
- }
16
- }
package/main.js DELETED
@@ -1,4 +0,0 @@
1
- import { registerRootComponent } from 'expo';
2
- import App from "./App";
3
-
4
- registerRootComponent(App);
package/parse-env.js DELETED
@@ -1,47 +0,0 @@
1
- const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg
2
- const fs = require("fs");
3
- const path = require("path");
4
- // Parser src into an Object
5
- module.exports = function parse (src) {
6
- if(typeof src !=='string' || !src.trim()){
7
- try {
8
- const envPath = path.resolve(process.cwd(),".env");
9
- src = fs.existsSync(envPath)? fs.readFileSync(envPath,'utf8') :"";
10
- } catch{}
11
- }
12
- if(typeof src !=='string' || !src) return {};
13
- const obj = {}
14
- // Convert buffer to string
15
- let lines = src.toString()
16
-
17
- // Convert line breaks to same format
18
- lines = lines.replace(/\r\n?/mg, '\n')
19
-
20
- let match
21
- while ((match = LINE.exec(lines)) != null) {
22
- const key = match[1]
23
-
24
- // Default undefined or null to empty string
25
- let value = (match[2] || '')
26
-
27
- // Remove whitespace
28
- value = value.trim()
29
-
30
- // Check if double quoted
31
- const maybeQuote = value[0]
32
-
33
- // Remove surrounding quotes
34
- value = value.replace(/^(['"`])([\s\S]*)\1$/mg, '$2')
35
-
36
- // Expand newlines if double quoted
37
- if (maybeQuote === '"') {
38
- value = value.replace(/\\n/g, '\n')
39
- value = value.replace(/\\r/g, '\r')
40
- }
41
-
42
- // Add to object
43
- obj[key] = value
44
- }
45
-
46
- return obj
47
- }
@@ -1,19 +0,0 @@
1
- const editJsonFile = require("./edit-json-file.js");
2
- const fs = require("fs");
3
- /***** le fichier de configuration doit être stocké dans le repertoire /src/config.js où src est le repertoire source du projet parent qui a installé l'application */
4
- const run = () => {
5
- const parentPackage = require("./parent-package");
6
- if(!parentPackage) return;
7
- console.log("before updating parent package version ",parentPackage)
8
- const srcParent = path.dirname(parentPackage,"src","config.js");
9
- if(fs.existsSync(srcParent)){
10
- const appConfig = require(srcParent);
11
- if(appConfig && typeof appConfig =='object'){
12
- console.log("updating parent package version ",parentPackage)
13
- let config = {version:appConfig.version};
14
- editJsonFile(parentPackage,config);
15
- }
16
- }
17
- }
18
-
19
- run();
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes