@fto-consult/expo-ui 2.49.6 → 3.0.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.
@@ -1,15 +1,16 @@
1
1
  const path = require("path");
2
2
  module.exports = (opts)=>{
3
3
  const dir = path.resolve(__dirname);
4
+ const base = opts.base || process.cwd();
4
5
  const assets = path.resolve(dir,"assets");
5
6
  opts = typeof opts =='object' && opts ? opts : {};
6
7
  opts.platform = "expo";
7
8
  opts.assets = opts.assets || opts.alias && typeof opts.alias =='object' && opts.alias.$assets || assets;
8
- opts.base = opts.base || dir;
9
+ opts.base = opts.base || base;
9
10
  opts.withPouchDB = opts.withPouchDB !== false && opts.withPouchdb !== false ? true : false;
10
11
  delete opts.withPouchdb;
11
12
  const r = require(`@fto-consult/common/babel.config.alias`)(opts);
12
- const expo = require("./lookup-expo-ui-path")()?path.resolve(r.$src,"..","expo-ui","src") : path.resolve(dir,"src");
13
+ const expo = path.resolve(require("./expo-ui-path")(),"src");
13
14
  r["$eauth"] = path.resolve(expo,"auth");
14
15
  r["$ecomponents"] = r["$expo-components"] = path.resolve(expo,"components");
15
16
  r["$etableLink"] = r["$eTableLink"] = path.resolve(r["$ecomponents"],"TableLink");
package/babel.config.js CHANGED
@@ -1,12 +1,13 @@
1
1
  module.exports = function(api,opts) {
2
2
  opts = typeof opts =='object' && opts ? opts : {};
3
+ api = api && typeof api =='object'? api : {};
3
4
  ///les chemin vers la variable d'environnement, le chemin du fichier .env,@see : https://github.com/brysgo/babel-plugin-inline-dotenv
4
5
  let environmentPath = opts.environmentPath || opts.envPath;
5
6
  //console.log(environmentPath," is envvv ",opts);
6
7
  const path = require("path");
7
8
  const fs = require("fs");
8
9
  const dir = path.resolve(__dirname);
9
- api.cache(true);
10
+ typeof api.cache =='function' && api.cache(true);
10
11
  const inlineDovOptions = {};
11
12
  const options = {base:dir,...opts,platform:"expo"};
12
13
  /*** 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 */
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env node
2
+ /**@see : https://blog.shahednasser.com/how-to-create-a-npx-tool/ */
3
+ 'use strict';
4
+ process.on('unhandledRejection', err => {
5
+ throw err;
6
+ });
7
+ const spawnAsync = require('cross-spawn').spawn;
8
+ const { realpathSync } = require('fs-extra');
9
+
10
+ //const { ensureMinProjectSetupAsync } = require('../build/Config');
11
+
12
+ const args = process.argv.slice(2);
13
+
14
+ const scriptIndex = args.findIndex(x => x === 'start' || x === 'customize');
15
+ const script = scriptIndex === -1 ? args[0] : args[scriptIndex];
16
+ const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];
17
+ console.log(args," is argggggg",script);
18
+ if (['start', 'customize'].includes(script)) {
19
+ spawnAsync(
20
+ 'node',
21
+ nodeArgs.concat(require.resolve('./scripts/' + script)).concat(args.slice(scriptIndex + 1)),
22
+ { stdio: 'inherit' }
23
+ ).then(result => {
24
+ if (result.signal) {
25
+ if (result.signal === 'SIGKILL') {
26
+ console.log(
27
+ 'The build failed because the process exited too early. ' +
28
+ 'This probably means the system ran out of memory or someone called ' +
29
+ '`kill -9` on the process.'
30
+ );
31
+ } else if (result.signal === 'SIGTERM') {
32
+ console.log(
33
+ 'The build failed because the process exited too early. ' +
34
+ 'Someone might have called `kill` or `killall`, or the system could ' +
35
+ 'be shutting down.'
36
+ );
37
+ }
38
+ process.exit(1);
39
+ }
40
+ process.exit(result.status);
41
+ });
42
+ } else if (script === undefined) {
43
+ const projectRoot = realpathSync(process.cwd());
44
+
45
+ //ensureMinProjectSetupAsync(projectRoot);
46
+ } else {
47
+ console.log('Invalid command "' + script + '".');
48
+ }
@@ -0,0 +1,21 @@
1
+ const chalk = require('chalk');
2
+ const fs = require('fs-extra');
3
+
4
+ const { copyTemplateToProject, ensureMinProjectSetupAsync } = require('..');
5
+ process.on('unhandledRejection', err => {
6
+ throw err;
7
+ });
8
+
9
+ const projectRoot = fs.realpathSync(process.cwd());
10
+
11
+ console.log();
12
+ console.log(chalk.magenta('\u203A Copying Expo Electron main process to local project...'));
13
+
14
+ copyTemplateToProject(projectRoot);
15
+ ensureMinProjectSetupAsync(projectRoot);
16
+
17
+ console.log(
18
+ chalk.magenta(
19
+ '\u203A You can now edit the Electron main process in the `electron/main` folder of your project...'
20
+ )
21
+ );
@@ -0,0 +1,8 @@
1
+ const { ensureElectronConfig } = require('..');
2
+
3
+ ensureElectronConfig(process.cwd());
4
+
5
+ process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 1;
6
+ process.env.platform = "electron";
7
+
8
+ require('electron-webpack/out/dev/dev-runner');
@@ -1,21 +1,20 @@
1
1
  const path = require("path");
2
- module.exports = function({config,isNext,nodeModulesPath,base,dir}){
3
- const root = path.resolve(dir,"..");
4
- base = base || dir;
2
+ module.exports = function({config,nodeModulesPath}){
3
+ const base = process.cwd();
4
+ const expoUi = path.resolve(require("./expo-ui-path")());
5
5
  nodeModulesPath = Array.isArray(nodeModulesPath)? nodeModulesPath : [];
6
6
  config.resolve.modules = Array.isArray(config.resolve.modules)? config.resolve.modules:[]
7
- config.resolve.modules = [path.resolve(dir, 'node_modules'),path.resolve(root, 'node_modules'), 'node_modules',...nodeModulesPath,...config.resolve.modules];
7
+ config.resolve.modules = [path.resolve(base, 'node_modules'), 'node_modules',...nodeModulesPath,...config.resolve.modules];
8
8
  config.module.rules.push({
9
9
  test: /\.(js|jsx|ts|tsx)$/,
10
10
  include: [
11
- dir,
12
11
  base,
13
- path.resolve(dir,"node_modules","@fto-consult"),
12
+ path.resolve(expoUi,"node_modules","@fto-consult"),
14
13
  /(common)/
15
14
  ],
16
15
  exclude:[
17
- path.resolve(dir,"node_modules"),
18
- path.resolve(root,"node_modules"),
16
+ path.resolve(base,"nodes_modules"),
17
+ path.resolve(expoUi,"node_modules"),
19
18
  /node_modules[/\\](?!react-native-paper|react-native|react-native-vector-icons|react-native-safe-area-view)/,
20
19
  /(node_modules)/
21
20
  ],
package/expo-ui-path.js CHANGED
@@ -5,17 +5,21 @@
5
5
  const fs = require("fs");
6
6
  const path = require("path");
7
7
  ///retourne le chemin vers le package @expo-ui
8
- module.exports = function (...args){
9
- const suffix = path.join(...args);
10
- const expoUIPath = "@fto-consult/expo-ui";
11
- const sep = path.sep;
12
- const p = require("./lookup-expo-ui-path")();
13
- if(p && fs.existsSync(p)){
14
- const rootPath = path.resolve(p,"..");
15
- const src = path.resolve(rootPath,"src");
16
- if(fs.existsSync(src) && fs.existsSync((path.resolve(rootPath,"babel.config.js")))){
17
- return path.resolve(p,suffix).replace(sep,(sep+sep));
8
+ module.exports = function (){
9
+ const ag = Array.prototype.slice.call(arguments,0);
10
+ let suffix ="";
11
+ ag.map(p=>{
12
+ if(typeof p ==='string' && p){
13
+ suffix = path.join(suffix,p);
18
14
  }
15
+ })
16
+ const expoUIPath = path.resolve(process.cwd(),"node_modules","@fto-consult","expo-ui");
17
+ const sep = path.sep;
18
+ const rootPath = process.cwd();
19
+ const src = path.resolve(rootPath,"src");
20
+ const expoUi = path.resolve(rootPath,"expo-ui");
21
+ if(fs.existsSync(src) && fs.existsSync(expoUi) && fs.existsSync(path.resolve(expoUi,"webpack.config.js"))){
22
+ return path.resolve(expoUi,suffix).replace(sep,(sep+sep));
19
23
  }
20
24
  return suffix ? path.join(expoUIPath,suffix).replace(sep,"/"): expoUIPath;
21
25
  };
package/metro.config.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const { getDefaultConfig } = require('@expo/metro-config');
2
2
  const path = require("path");
3
- module.exports = (opts)=>{
3
+ module.exports = function(opts){
4
4
  opts = opts && typeof opts =='object'? opts : {};
5
5
  let {assetExts,sourceExts} = opts;
6
6
  assetExts = Array.isArray(assetExts)? assetExts: [];
@@ -22,7 +22,6 @@ module.exports = (opts)=>{
22
22
  ...config.resolver.sourceExts,
23
23
  ...sourceExts,"txt",
24
24
  'jsx', 'js','tsx',
25
- "mjs","cjs",
26
25
  ]
27
26
  // Remove all console logs in production...
28
27
  config.transformer.minifierConfig.compress.drop_console = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "2.49.6",
3
+ "version": "3.0.1",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -42,6 +42,9 @@
42
42
  "delete-node-modules": "rimraf ./**/node_modules",
43
43
  "modifier-url-remote-git": "git remote set-url origin 'https://borispipo@github.com/borispipo/smart-eneo.git'"
44
44
  },
45
+ "bin": {
46
+ "electron": "bin/electron/index.js"
47
+ },
45
48
  "repository": {
46
49
  "type": "git",
47
50
  "url": "git+https://github.com/borispipo/expo-ui.git"
@@ -13,7 +13,7 @@ const OptimizedHeavyScreen = React.forwardRef(({
13
13
  </Transition.Together>
14
14
  ),
15
15
  style,
16
- children,
16
+ children:cChildren,
17
17
  isLoading,
18
18
  timeout,
19
19
  testID,
@@ -23,6 +23,7 @@ const OptimizedHeavyScreen = React.forwardRef(({
23
23
  timeout = isNumber(timeout)? timeout : isNumber(transitionTimeout)? transitionTimeout : undefined;
24
24
  const { transitionRef, areInteractionsComplete } = useAfterInteractions(timeout);
25
25
  let Placeholder = placeholder;
26
+ const children = React.useStableMemo(()=>cChildren,[cChildren])
26
27
  placeholder = React.isComponent(Placeholder)? <Placeholder /> : React.isValidElement(Placeholder)? Placeholder : null;
27
28
  return (
28
29
  <Transitioning.View
package/webpack.config.js CHANGED
@@ -4,7 +4,6 @@ const path = require("path");
4
4
  const isObj = x => x && typeof x =='object' && !Array.isArray(x);
5
5
  // Expo CLI will await this method so you can optionally return a promise.
6
6
  module.exports = async function(env, argv,opts) {
7
- const dir = path.resolve(__dirname);
8
7
  env = env || {};
9
8
  opts = typeof opts =="object" && opts ? opts : {};
10
9
  const babel = isObj(opts.babel)? opts.babel : {};
@@ -33,7 +32,6 @@ module.exports = async function(env, argv,opts) {
33
32
  {
34
33
  test: /.mjs$/,
35
34
  include: /node_modules/,
36
- include: /node_modules/,
37
35
  type: "javascript/auto",
38
36
  use: {loader: 'babel-loader'}
39
37
  });
@@ -52,7 +50,7 @@ module.exports = async function(env, argv,opts) {
52
50
  config.performance.maxEntrypointSize = typeof config.performance.maxEntrypointSize =='number'? config.performance.maxEntrypointSize : 512000;
53
51
  config.performance.maxAssetSize = typeof config.performance.maxAssetSize =='number'? config.performance.maxAssetSize : 512000;
54
52
  config.devtool = (config.mode === 'development') ? 'inline-source-map' : false;
55
- require("./compiler.config.js")({config,...opts,dir});
53
+ require("./compiler.config.js")({config,...opts});
56
54
  if(isElectron){
57
55
  const electronPath = process.cwd();
58
56
  config.output = config.output || {};
@@ -1,21 +0,0 @@
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
- }
@@ -1,24 +0,0 @@
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 metroPath = path.resolve(rootPath,"metro.config.js");
16
- if(fs.existsSync(p) && fs.existsSync(nPath) && fs.existsSync(srcPath) && fs.existsSync(metroPath)){
17
- expoUIPath = p;
18
- return expoUIPath;
19
- }
20
- rootPath = path.resolve(rootPath,"..");
21
- level = level-1;
22
- }
23
- return expoUIPath;
24
- }
package/parent-package.js DELETED
@@ -1,12 +0,0 @@
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
- /**** cette fonction a pour rôle de retourner le package parent à celui ci */
6
- module.exports = (()=>{
7
- const pathToParent = require("parent-package-json")(); // Will return false if no parent exists
8
- if (pathToParent !== false) {
9
- return pathToParent.path;
10
- }
11
- return "";
12
- })();