@fto-consult/expo-ui 2.49.5 → 2.49.6
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/electron/webpack.config.js +80 -41
- package/electron/webpack.config.old.js +45 -0
- package/metro.config.js +3 -4
- package/package.json +2 -3
- package/webpack.config.js +24 -3
|
@@ -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/metro.config.js
CHANGED
|
@@ -2,11 +2,10 @@ const { getDefaultConfig } = require('@expo/metro-config');
|
|
|
2
2
|
const path = require("path");
|
|
3
3
|
module.exports = (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,7 @@ module.exports = (opts)=>{
|
|
|
23
22
|
...config.resolver.sourceExts,
|
|
24
23
|
...sourceExts,"txt",
|
|
25
24
|
'jsx', 'js','tsx',
|
|
26
|
-
|
|
25
|
+
"mjs","cjs",
|
|
27
26
|
]
|
|
28
27
|
// Remove all console logs in production...
|
|
29
28
|
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.
|
|
3
|
+
"version": "2.49.6",
|
|
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",
|
package/webpack.config.js
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
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
|
-
const path = require("path");
|
|
6
7
|
const dir = path.resolve(__dirname);
|
|
8
|
+
env = env || {};
|
|
7
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
|
+
}
|
|
8
17
|
const transpileModules = Array.isArray(opts.transpileModules)? opts.transpileModules : [];
|
|
9
18
|
const config = await createExpoWebpackConfigAsync(
|
|
10
19
|
{
|
|
11
20
|
...env,
|
|
12
21
|
babel: {
|
|
22
|
+
...babel,
|
|
13
23
|
dangerouslyAddModulePathsToTranspile: [
|
|
14
24
|
// Ensure that all packages starting with @fto-consult are transpiled.
|
|
15
25
|
'@fto-consult',
|
|
@@ -28,7 +38,7 @@ module.exports = async function(env, argv,opts) {
|
|
|
28
38
|
use: {loader: 'babel-loader'}
|
|
29
39
|
});
|
|
30
40
|
//config.resolve.alias['moduleA'] = 'moduleB';
|
|
31
|
-
config.mode = config.mode =="development" || config.mode =='production' ? config.mode : "development";
|
|
41
|
+
config.mode = (config.mode =="development" || config.mode =='production') ? config.mode : "development";
|
|
32
42
|
// Maybe you want to turn off compression in dev mode.
|
|
33
43
|
if (config.mode === 'development') {
|
|
34
44
|
config.devServer.compress = false;
|
|
@@ -37,6 +47,17 @@ module.exports = async function(env, argv,opts) {
|
|
|
37
47
|
if (config.mode === 'production') {
|
|
38
48
|
config.optimization.minimize = true;
|
|
39
49
|
}
|
|
40
|
-
|
|
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
|
+
}
|
|
41
62
|
return config;
|
|
42
63
|
};
|