@fto-consult/expo-ui 7.5.42 → 7.5.43
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/bin/index.js +10 -1
- package/bin/init.js +2 -2
- package/electron/index.js +2 -4
- package/package.json +1 -1
package/bin/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/usr/bin/env node
|
1
|
+
#!/usr/bin/env node
|
2
2
|
|
3
3
|
/**
|
4
4
|
toujours ajouter l'instruction ci-dessus à la première ligne de chaque script npx
|
@@ -80,6 +80,14 @@ program.command('electron')
|
|
80
80
|
let cmd = undefined;
|
81
81
|
icon = icon && typeof icon =="string" && fs.existsSync(path.resolve(icon)) && icon || undefined;
|
82
82
|
require("../electron/create-index-file")({electronProjectRoot,appName:packageObj.name,icon});
|
83
|
+
if(fs.existsSync(electronProjectRoot)){
|
84
|
+
const mainPackagePath = path.resolve(electronProjectRoot,"package.app.json");
|
85
|
+
try {
|
86
|
+
const mainPackageAppJSON = fs.existsSync(mainPackagePath)? require(mainPackagePath) : {};
|
87
|
+
writeFile(mainPackagePath,JSON.stringify({...packageObj,...mainPackageAppJSON,icon:icon||mainPackageAppJSON.icon||undefined},null,"\t"));
|
88
|
+
} catch{}
|
89
|
+
}
|
90
|
+
|
83
91
|
if(!isElectionInitialized || script =='init'){
|
84
92
|
if(script !=='init'){
|
85
93
|
console.log("initializing electron application before ....");
|
@@ -88,6 +96,7 @@ program.command('electron')
|
|
88
96
|
projectRoot,
|
89
97
|
electronDir,
|
90
98
|
electronProjectRoot,
|
99
|
+
icon,
|
91
100
|
});
|
92
101
|
}
|
93
102
|
const outDir = out && path.dirname(out) && path.resolve(path.dirname(out),"electron") || path.resolve(electronProjectRoot,"bin")
|
package/bin/init.js
CHANGED
@@ -10,7 +10,7 @@ const appSuffix = "-desk";
|
|
10
10
|
const mainPackage = require("../package.json");
|
11
11
|
const mainPackageName = mainPackage.name;
|
12
12
|
|
13
|
-
module.exports = ({projectRoot,electronProjectRoot})=>{
|
13
|
+
module.exports = ({projectRoot,electronProjectRoot,icon})=>{
|
14
14
|
return new Promise((resolve,reject)=>{
|
15
15
|
//make shure electron project root exists
|
16
16
|
if(!createDir(electronProjectRoot)){
|
@@ -19,7 +19,7 @@ module.exports = ({projectRoot,electronProjectRoot})=>{
|
|
19
19
|
const mPackageJSON = Object.assign({},require(`${path.resolve(projectRoot,'package.json')}`));
|
20
20
|
const electronPackagePath = path.resolve(electronProjectRoot,"package.json");
|
21
21
|
const electronPackageJSON = Object.assign({},fs.existsSync(electronPackagePath)? require(electronPackagePath) : {});
|
22
|
-
const projectRootPackage = {
|
22
|
+
const projectRootPackage = {icon,...mPackageJSON,...electronPackageJSON};
|
23
23
|
const dependencies = require("../electron/dependencies");
|
24
24
|
const electronProjectRootPackage = path.resolve(electronProjectRoot,"package.json");
|
25
25
|
projectRootPackage.main = `index.js`;
|
package/electron/index.js
CHANGED
@@ -34,11 +34,9 @@ const processCWD = process.cwd();
|
|
34
34
|
const appPath = app.getAppPath();
|
35
35
|
const asarPath = path.resolve(processCWD,"resources","app.asar");
|
36
36
|
const electronProjectRoot = mainProjectRoot && typeof mainProjectRoot =='string' && fs.existsSync(path.resolve(mainProjectRoot)) && fs.existsSync(path.resolve(mainProjectRoot,distPath)) && path.resolve(mainProjectRoot) || null;
|
37
|
-
const projectRoot = electronProjectRoot || fs.existsSync(path.resolve(
|
38
|
-
|| fs.existsSync(path.resolve(processCWD,distPath)) && path.resolve(processCWD) || fs.existsSync(asarPath) && fs.existsSync(path.relative(asarPath,"dist")) && asarPath ||
|
39
|
-
processCWD;
|
37
|
+
const projectRoot = electronProjectRoot || fs.existsSync(path.resolve(appPath,distPath)) && appPath || fs.existsSync(asarPath) && fs.existsSync(path.relative(asarPath,"dist")) && asarPath || appPath;
|
40
38
|
const packageJSONPath = fs.existsSync(processCWD,"package.json")? path.resolve(processCWD,"package.json") : path.resolve(projectRoot,"package.json");
|
41
|
-
const packageJSON = fs.existsSync(packageJSONPath) ? Object.assign({},require(`${packageJSONPath}`)) : {};
|
39
|
+
const packageJSON = fs.existsSync(packageJSONPath) ? Object.assign({},require(`${packageJSONPath}`)) : fs.existsSync(path.resolve(projectRoot,"package.app.json")) ? require(path.resolve(projectRoot,"package.app.json")) : {};
|
42
40
|
const appName = typeof packageJSON.realAppName =='string' && packageJSON.realAppName || typeof packageJSON.name =="string" && packageJSON.name || "";
|
43
41
|
|
44
42
|
// fermee automatiquement quand l'objet JavaScript sera garbage collected.
|