@fto-consult/expo-ui 7.5.43 → 7.5.44
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 +1 -2
- package/electron/index.js +17 -16
- package/electron/preload.js +3 -0
- package/package.json +1 -1
package/bin/index.js
CHANGED
@@ -60,7 +60,6 @@ program.command('electron')
|
|
60
60
|
const electronProjectRoot = path.resolve(projectRoot,"electron");
|
61
61
|
const opts = Object.assign({},typeof options.opts =='function'? options.opts() : options);
|
62
62
|
let {out,arch,url,build,platform,import:packageImport,icon} = opts;
|
63
|
-
//let {projectRoot} = opts;
|
64
63
|
if(projectRoot == dir){
|
65
64
|
throwError(`Invalid project root ${projectRoot}; project root must be different to ${dir}`);
|
66
65
|
}
|
@@ -105,7 +104,7 @@ program.command('electron')
|
|
105
104
|
}
|
106
105
|
const start = x=>{
|
107
106
|
return new Promise((resolve,reject)=>{
|
108
|
-
cmd = `electron "${electronProjectRoot}"
|
107
|
+
cmd = `electron "${electronProjectRoot}" ${icon ? `--icon ${path.resolve(icon)}`:""} ${isValidUrl(url)? ` --url ${url}`:''}`; //--root ${electronProjectRoot}
|
109
108
|
exec({
|
110
109
|
cmd,
|
111
110
|
projectRoot : electronProjectRoot,
|
package/electron/index.js
CHANGED
@@ -16,7 +16,7 @@ const iconName = process.platform =="win32" ? "icon.ico" : process.platform =='d
|
|
16
16
|
|
17
17
|
program
|
18
18
|
.option('-u, --url <url>', 'L\'adresse url à ouvrir au lancement de l\'application')
|
19
|
-
|
19
|
+
//.option('-r, --root <projectRoot>', 'le chemin du project root de l\'application')
|
20
20
|
.option('-l, --icon [iconPath]', 'le chemin vers le dossier des icones de l\'application : (Dans ce dossier, doit contenir une image icon.ico pour window, icon.incs pour mac et icon.png pour linux)')
|
21
21
|
.parse();
|
22
22
|
|
@@ -27,16 +27,12 @@ if(iconPath && fs.existsSync(path.resolve(iconPath,iconName))){
|
|
27
27
|
iconPath = path.resolve(iconPath,iconName);
|
28
28
|
}
|
29
29
|
|
30
|
-
const isAsar = (typeof require.main =="string" && require.main ||"").indexOf('app.asar') !== -1;
|
31
30
|
const distPath = path.join("dist",'index.html');
|
32
|
-
|
33
31
|
const processCWD = process.cwd();
|
34
32
|
const appPath = app.getAppPath();
|
35
|
-
const
|
36
|
-
const
|
37
|
-
const
|
38
|
-
const packageJSONPath = fs.existsSync(processCWD,"package.json")? path.resolve(processCWD,"package.json") : path.resolve(projectRoot,"package.json");
|
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")) : {};
|
33
|
+
const isAsar = appPath.indexOf('app.asar') !== -1;
|
34
|
+
const packageJSONPath = fs.existsSync(processCWD,"package.json")? path.resolve(processCWD,"package.json") : fs.existsSync(path.resolve(appPath,"package.app.json")) ? path.resolve(appPath,"package.app.json") : path.resolve(appPath,"package.json") ;
|
35
|
+
const packageJSON = fs.existsSync(packageJSONPath) ? Object.assign({},require(`${packageJSONPath}`)) : {};
|
40
36
|
const appName = typeof packageJSON.realAppName =='string' && packageJSON.realAppName || typeof packageJSON.name =="string" && packageJSON.name || "";
|
41
37
|
|
42
38
|
// fermee automatiquement quand l'objet JavaScript sera garbage collected.
|
@@ -44,17 +40,17 @@ let mainWindow = undefined;
|
|
44
40
|
|
45
41
|
Menu.setApplicationMenu(null);
|
46
42
|
|
47
|
-
const indexFilePath = path.resolve(path.join(
|
43
|
+
const indexFilePath = path.resolve(path.join(appPath,distPath));
|
48
44
|
const mainProcessPath = path.resolve('processes',"main","index.js");
|
49
|
-
const mainProcessIndex =
|
45
|
+
const mainProcessIndex = fs.existsSync(path.resolve(appPath,mainProcessPath)) && path.resolve(appPath,mainProcessPath);
|
50
46
|
const mainProcessRequired = mainProcessIndex && require(`${mainProcessIndex}`);
|
51
|
-
//pour étendre les fonctionnalités au niveau du main proceess, bien vouloir écrire dans le fichier
|
47
|
+
//pour étendre les fonctionnalités au niveau du main proceess, bien vouloir écrire dans le fichier ../electron/main/index.js
|
52
48
|
const mainProcess = mainProcessRequired && typeof mainProcessRequired =='object'? mainProcessRequired : {};
|
53
49
|
const execPath = app.getPath ('exe') || process.execPath;
|
54
50
|
|
55
51
|
// Gardez une reference globale de l'objet window, si vous ne le faites pas, la fenetre sera
|
56
|
-
if(
|
57
|
-
throw {message:`Unable to start the application: index file located at [${indexFilePath}] does not exists : appPath = [${appPath}]
|
52
|
+
if(!isValidUrl(pUrl) && !fs.existsSync(indexFilePath)){
|
53
|
+
throw {message:`Unable to start the application: index file located at [${indexFilePath}] does not exists : appPath = [${appPath}], exec path is ${execPath}`}
|
58
54
|
}
|
59
55
|
|
60
56
|
const quit = ()=>{
|
@@ -351,12 +347,17 @@ function createWindow () {
|
|
351
347
|
event.returnValue = p;
|
352
348
|
return p;
|
353
349
|
});
|
350
|
+
ipcMain.on("get-app-path",(event,pathName)=>{
|
351
|
+
event.returnValue = appPath;
|
352
|
+
return appPath;
|
353
|
+
});
|
354
354
|
ipcMain.on("get-project-root",(event)=>{
|
355
|
-
event.returnValue =
|
355
|
+
event.returnValue = appPath;
|
356
356
|
return event.returnValue;
|
357
357
|
});
|
358
|
-
|
359
|
-
|
358
|
+
|
359
|
+
ipcMain.on("get-process-cwd",(event)=>{
|
360
|
+
event.returnValue = processCWD;
|
360
361
|
return event.returnValue ;
|
361
362
|
});
|
362
363
|
|
package/electron/preload.js
CHANGED