@fto-consult/expo-ui 2.49.5 → 3.0.0
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.alias.js +3 -2
- package/babel.config.js +2 -1
- package/bin/electron/index.js +48 -0
- package/bin/electron/scripts/customize.js +21 -0
- package/bin/electron/scripts/start.js +8 -0
- package/compiler.config.js +7 -8
- package/electron/webpack.config.js +80 -41
- package/electron/webpack.config.old.js +45 -0
- package/expo-ui-path.js +13 -9
- package/metro.config.js +3 -5
- package/package.json +5 -3
- package/src/components/HeavyScreen/index.js +2 -1
- package/webpack.config.js +24 -5
- package/expo-ui-current-script.js +0 -21
- package/lookup-expo-ui-path.js +0 -24
- package/parent-package.js +0 -12
package/babel.config.alias.js
CHANGED
|
@@ -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 ||
|
|
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("./
|
|
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
|
+
);
|
package/compiler.config.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
const path = require("path");
|
|
2
|
-
module.exports = function({config,
|
|
3
|
-
const
|
|
4
|
-
|
|
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(
|
|
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(
|
|
12
|
+
path.resolve(expoUi,"node_modules","@fto-consult"),
|
|
14
13
|
/(common)/
|
|
15
14
|
],
|
|
16
15
|
exclude:[
|
|
17
|
-
path.resolve(
|
|
18
|
-
path.resolve(
|
|
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
|
],
|
|
@@ -1,45 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const addons = require("@expo/webpack-config/addons");
|
|
4
|
-
const jsonfile = require('jsonfile');
|
|
1
|
+
/**@see : https://www.npmjs.com/package/@expo/webpack-config/v/0.11.4 */
|
|
2
|
+
const createExpoWebpackConfigAsync = require('@expo/webpack-config')
|
|
5
3
|
const path = require("path");
|
|
6
|
-
const mode = 'development';
|
|
7
4
|
const isObj = x => x && typeof x =='object' && !Array.isArray(x);
|
|
8
|
-
|
|
9
|
-
module.exports = async function(env, argv) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
5
|
+
// Expo CLI will await this method so you can optionally return a promise.
|
|
6
|
+
module.exports = async function(env, argv,opts) {
|
|
7
|
+
const dir = path.resolve(__dirname);
|
|
8
|
+
env = env || {};
|
|
9
|
+
opts = typeof opts =="object" && opts ? opts : {};
|
|
10
|
+
const babel = isObj(opts.babel)? opts.babel : {};
|
|
11
|
+
const isElectron = typeof env.platform =="string" && env.platform.toLowerCase().trim() ==='electron';
|
|
12
|
+
if(isElectron){
|
|
13
|
+
env.platform = "electron";
|
|
14
|
+
env.mode = env.mode =="production" && "production" || "development";
|
|
15
|
+
env.pwa = false;
|
|
16
|
+
}
|
|
17
|
+
const transpileModules = Array.isArray(opts.transpileModules)? opts.transpileModules : [];
|
|
18
|
+
const config = await createExpoWebpackConfigAsync(
|
|
19
|
+
{
|
|
20
|
+
...env,
|
|
21
|
+
babel: {
|
|
22
|
+
...babel,
|
|
23
|
+
dangerouslyAddModulePathsToTranspile: [
|
|
24
|
+
// Ensure that all packages starting with @fto-consult are transpiled.
|
|
25
|
+
'@fto-consult',
|
|
26
|
+
...transpileModules,
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
argv
|
|
31
|
+
);
|
|
32
|
+
config.module.rules.push(
|
|
33
|
+
{
|
|
34
|
+
test: /.mjs$/,
|
|
35
|
+
include: /node_modules/,
|
|
36
|
+
include: /node_modules/,
|
|
37
|
+
type: "javascript/auto",
|
|
38
|
+
use: {loader: 'babel-loader'}
|
|
39
|
+
});
|
|
40
|
+
//config.resolve.alias['moduleA'] = 'moduleB';
|
|
41
|
+
config.mode = (config.mode =="development" || config.mode =='production') ? config.mode : "development";
|
|
42
|
+
// Maybe you want to turn off compression in dev mode.
|
|
43
|
+
if (config.mode === 'development') {
|
|
44
|
+
config.devServer.compress = false;
|
|
45
|
+
}
|
|
46
|
+
// Or prevent minimizing the bundle when you build.
|
|
47
|
+
if (config.mode === 'production') {
|
|
48
|
+
config.optimization.minimize = true;
|
|
49
|
+
}
|
|
50
|
+
config.performance = typeof config.performance =="object" && config.performance ? config.performance : {};
|
|
51
|
+
config.performance.hints = "hints" in config.performance ? config.performance.hints : false;
|
|
52
|
+
config.performance.maxEntrypointSize = typeof config.performance.maxEntrypointSize =='number'? config.performance.maxEntrypointSize : 512000;
|
|
53
|
+
config.performance.maxAssetSize = typeof config.performance.maxAssetSize =='number'? config.performance.maxAssetSize : 512000;
|
|
54
|
+
config.devtool = (config.mode === 'development') ? 'inline-source-map' : false;
|
|
55
|
+
require("./compiler.config.js")({config,...opts,dir});
|
|
56
|
+
if(isElectron){
|
|
57
|
+
const electronPath = process.cwd();
|
|
58
|
+
config.output = config.output || {};
|
|
59
|
+
config.output.publicPath = "./";
|
|
60
|
+
config.output.path = path.join(electronPath,"dist");
|
|
61
|
+
if(isObj(config.node)){
|
|
62
|
+
config.resolve.fallback = isObj(config.resolve.fallback)? config.resolve.fallback : {};
|
|
63
|
+
for(let i in config.node){
|
|
64
|
+
if(config.node[i] =="empty"){
|
|
65
|
+
config.resolve.fallback[i] = false;
|
|
66
|
+
} else config.resolve.fallback[i] = config.node[i];
|
|
67
|
+
delete config.node[i];
|
|
68
|
+
}
|
|
69
|
+
config.resolve.byDependency = {
|
|
70
|
+
// ...
|
|
71
|
+
esm: {
|
|
72
|
+
mainFields: ['browser', 'module'],
|
|
73
|
+
},
|
|
74
|
+
commonjs: {
|
|
75
|
+
aliasFields: ['browser'],
|
|
76
|
+
},
|
|
77
|
+
url: {
|
|
78
|
+
preferRelative: true,
|
|
79
|
+
},
|
|
80
|
+
}
|
|
38
81
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
config.resolve.extensions = (0, envManager.getModuleFileExtensions)('electron', 'web');
|
|
42
|
-
//jsonfile.writeFileSync("electron/config.back.json", config, {spaces: 4});
|
|
43
|
-
console.log("******electron config file generated**********");
|
|
44
|
-
return config;
|
|
82
|
+
}
|
|
83
|
+
return config;
|
|
45
84
|
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const createExpoWebpackConfigAsync = require('@expo/webpack-config');
|
|
2
|
+
const envManager = require("@expo/webpack-config/env");
|
|
3
|
+
const addons = require("@expo/webpack-config/addons");
|
|
4
|
+
const jsonfile = require('jsonfile');
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const mode = 'development';
|
|
7
|
+
const isObj = x => x && typeof x =='object' && !Array.isArray(x);
|
|
8
|
+
/***@see : https://www.npmjs.com/package/@expo/webpack-config */
|
|
9
|
+
module.exports = async function(env, argv) {
|
|
10
|
+
const projectRoot = process.cwd()
|
|
11
|
+
const electronPath = path.join(projectRoot,'electron');
|
|
12
|
+
env = env || {};
|
|
13
|
+
env.projectRoot = projectRoot;
|
|
14
|
+
env.platform = "electron";//isObj(env.platform)? env.platform : {};//'web'///electron;
|
|
15
|
+
//env.platform.type = "electron";
|
|
16
|
+
env.locations = (0, envManager.getPaths)(projectRoot)
|
|
17
|
+
env.pwa = false;
|
|
18
|
+
let config = (0, addons.withAlias)({}, (0, envManager.getAliases)(projectRoot));
|
|
19
|
+
if(argv && typeof argv =='object' && (argv.mode =='production' || argv.mode =="development")){
|
|
20
|
+
env.mode = argv.mode;
|
|
21
|
+
} else {
|
|
22
|
+
env.mode = mode;
|
|
23
|
+
}
|
|
24
|
+
config = await createExpoWebpackConfigAsync(env, argv);
|
|
25
|
+
config.output = config.output || {};
|
|
26
|
+
config.output.publicPath = "./";
|
|
27
|
+
config.output.path = path.join(electronPath,"dist");
|
|
28
|
+
if (!config.plugins) config.plugins = [];
|
|
29
|
+
if (!config.resolve) config.resolve = {};
|
|
30
|
+
for(let i in config.plugins){
|
|
31
|
+
let pl = config.plugins[i];
|
|
32
|
+
//on recherche le fichier html build de webpack
|
|
33
|
+
if(pl && typeof pl =='object' && pl.options && typeof pl.options =='object'){
|
|
34
|
+
if(typeof pl.options.filename =="string" && pl.options.filename.toLowerCase().includes("index.html")){
|
|
35
|
+
pl.options.filename = path.join(config.output.path,"index.html");
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//console.log(config.resolve.extensions, "is r extensions")
|
|
41
|
+
config.resolve.extensions = (0, envManager.getModuleFileExtensions)('electron', 'web');
|
|
42
|
+
//jsonfile.writeFileSync("electron/config.back.json", config, {spaces: 4});
|
|
43
|
+
console.log("******electron config file generated**********");
|
|
44
|
+
return config;
|
|
45
|
+
};
|
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 (
|
|
9
|
-
const
|
|
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);
|
|
14
|
+
}
|
|
15
|
+
})
|
|
10
16
|
const expoUIPath = "@fto-consult/expo-ui";
|
|
11
17
|
const sep = path.sep;
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return path.resolve(p,suffix).replace(sep,(sep+sep));
|
|
18
|
-
}
|
|
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,12 +1,11 @@
|
|
|
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
|
-
let {
|
|
5
|
+
let {assetExts,sourceExts} = opts;
|
|
6
6
|
assetExts = Array.isArray(assetExts)? assetExts: [];
|
|
7
7
|
sourceExts= Array.isArray(sourceExts)?sourceExts : [];
|
|
8
|
-
|
|
9
|
-
const projectRoot = path.resolve(dir);
|
|
8
|
+
const projectRoot = process.cwd();
|
|
10
9
|
const localDir = path.resolve(__dirname);
|
|
11
10
|
const config = getDefaultConfig(projectRoot);
|
|
12
11
|
config.watchFolders = [projectRoot];
|
|
@@ -23,7 +22,6 @@ module.exports = (opts)=>{
|
|
|
23
22
|
...config.resolver.sourceExts,
|
|
24
23
|
...sourceExts,"txt",
|
|
25
24
|
'jsx', 'js','tsx',
|
|
26
|
-
//"mjs","cjs",
|
|
27
25
|
]
|
|
28
26
|
// Remove all console logs in production...
|
|
29
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": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -28,9 +28,8 @@
|
|
|
28
28
|
"install-apk": "adb -s emulator-5554 install myapp.apk",
|
|
29
29
|
"android-emulator": "emulator -avd EMULATOR",
|
|
30
30
|
"flipper": "npx cross-env METRO_SERVER_PORT=19000 E:\\Studies\\react-native\\debugger\\Flipper-win\\Flipper.exe",
|
|
31
|
-
"build-electron": "electron-webpack && electron-builder --dir -c.compression=store",
|
|
32
31
|
"test:build": "electron-webpack && electron-builder --dir -c.compression=store -c.mac.identity=null",
|
|
33
|
-
"compile-electron": "webpack --
|
|
32
|
+
"compile-electron": "webpack --env platform=electron",
|
|
34
33
|
"compile-electron-p": "webpack --config ./electron/webpack.config.js --mode=production",
|
|
35
34
|
"electron": "electron ./electron",
|
|
36
35
|
"logcat": "adb -d logcat com.ftc.apps.salite1:E > errors.txt",
|
|
@@ -43,6 +42,9 @@
|
|
|
43
42
|
"delete-node-modules": "rimraf ./**/node_modules",
|
|
44
43
|
"modifier-url-remote-git": "git remote set-url origin 'https://borispipo@github.com/borispipo/smart-eneo.git'"
|
|
45
44
|
},
|
|
45
|
+
"bin": {
|
|
46
|
+
"electron": "bin/electron/index.js"
|
|
47
|
+
},
|
|
46
48
|
"repository": {
|
|
47
49
|
"type": "git",
|
|
48
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
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
/**@see : https://www.npmjs.com/package/@expo/webpack-config/v/0.11.4 */
|
|
2
2
|
const createExpoWebpackConfigAsync = require('@expo/webpack-config')
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const isObj = x => x && typeof x =='object' && !Array.isArray(x);
|
|
3
5
|
// Expo CLI will await this method so you can optionally return a promise.
|
|
4
6
|
module.exports = async function(env, argv,opts) {
|
|
5
|
-
|
|
6
|
-
const dir = path.resolve(__dirname);
|
|
7
|
+
env = env || {};
|
|
7
8
|
opts = typeof opts =="object" && opts ? opts : {};
|
|
9
|
+
const babel = isObj(opts.babel)? opts.babel : {};
|
|
10
|
+
const isElectron = typeof env.platform =="string" && env.platform.toLowerCase().trim() ==='electron';
|
|
11
|
+
if(isElectron){
|
|
12
|
+
env.platform = "electron";
|
|
13
|
+
env.mode = env.mode =="production" && "production" || "development";
|
|
14
|
+
env.pwa = false;
|
|
15
|
+
}
|
|
8
16
|
const transpileModules = Array.isArray(opts.transpileModules)? opts.transpileModules : [];
|
|
9
17
|
const config = await createExpoWebpackConfigAsync(
|
|
10
18
|
{
|
|
11
19
|
...env,
|
|
12
20
|
babel: {
|
|
21
|
+
...babel,
|
|
13
22
|
dangerouslyAddModulePathsToTranspile: [
|
|
14
23
|
// Ensure that all packages starting with @fto-consult are transpiled.
|
|
15
24
|
'@fto-consult',
|
|
@@ -23,12 +32,11 @@ module.exports = async function(env, argv,opts) {
|
|
|
23
32
|
{
|
|
24
33
|
test: /.mjs$/,
|
|
25
34
|
include: /node_modules/,
|
|
26
|
-
include: /node_modules/,
|
|
27
35
|
type: "javascript/auto",
|
|
28
36
|
use: {loader: 'babel-loader'}
|
|
29
37
|
});
|
|
30
38
|
//config.resolve.alias['moduleA'] = 'moduleB';
|
|
31
|
-
config.mode = config.mode =="development" || config.mode =='production' ? config.mode : "development";
|
|
39
|
+
config.mode = (config.mode =="development" || config.mode =='production') ? config.mode : "development";
|
|
32
40
|
// Maybe you want to turn off compression in dev mode.
|
|
33
41
|
if (config.mode === 'development') {
|
|
34
42
|
config.devServer.compress = false;
|
|
@@ -37,6 +45,17 @@ module.exports = async function(env, argv,opts) {
|
|
|
37
45
|
if (config.mode === 'production') {
|
|
38
46
|
config.optimization.minimize = true;
|
|
39
47
|
}
|
|
40
|
-
|
|
48
|
+
config.performance = typeof config.performance =="object" && config.performance ? config.performance : {};
|
|
49
|
+
config.performance.hints = "hints" in config.performance ? config.performance.hints : false;
|
|
50
|
+
config.performance.maxEntrypointSize = typeof config.performance.maxEntrypointSize =='number'? config.performance.maxEntrypointSize : 512000;
|
|
51
|
+
config.performance.maxAssetSize = typeof config.performance.maxAssetSize =='number'? config.performance.maxAssetSize : 512000;
|
|
52
|
+
config.devtool = (config.mode === 'development') ? 'inline-source-map' : false;
|
|
53
|
+
require("./compiler.config.js")({config,...opts});
|
|
54
|
+
if(isElectron){
|
|
55
|
+
const electronPath = process.cwd();
|
|
56
|
+
config.output = config.output || {};
|
|
57
|
+
config.output.publicPath = "./";
|
|
58
|
+
config.output.path = path.join(electronPath,"dist");
|
|
59
|
+
}
|
|
41
60
|
return config;
|
|
42
61
|
};
|
|
@@ -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
|
-
}
|
package/lookup-expo-ui-path.js
DELETED
|
@@ -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
|
-
})();
|