@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 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}" --root ${electronProjectRoot} ${icon ? `--icon ${path.resolve(icon)}`:""} ${isValidUrl(url)? ` --url ${url}`:''}`;
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
- .option('-r, --root <projectRoot>', 'le chemin du project root de l\'application')
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 asarPath = path.resolve(processCWD,"resources","app.asar");
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(appPath,distPath)) && appPath || fs.existsSync(asarPath) && fs.existsSync(path.relative(asarPath,"dist")) && asarPath || appPath;
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(projectRoot,distPath));
43
+ const indexFilePath = path.resolve(path.join(appPath,distPath));
48
44
  const mainProcessPath = path.resolve('processes',"main","index.js");
49
- const mainProcessIndex = projectRoot && fs.existsSync(path.resolve(projectRoot,mainProcessPath)) && path.resolve(projectRoot,mainProcessPath);
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 projectRoot/electron/main/index.js
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(true || !isValidUrl(pUrl) && !fs.existsSync(indexFilePath)){
57
- throw {message:`Unable to start the application: index file located at [${indexFilePath}] does not exists : appPath = [${appPath}] projectRoot = [${projectRoot}], exec path is ${execPath}`}
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 = projectRoot;
355
+ event.returnValue = appPath;
356
356
  return event.returnValue;
357
357
  });
358
- ipcMain.on("get-electron-project-root",(event)=>{
359
- event.returnValue = projectRoot;
358
+
359
+ ipcMain.on("get-process-cwd",(event)=>{
360
+ event.returnValue = processCWD;
360
361
  return event.returnValue ;
361
362
  });
362
363
 
@@ -419,6 +419,9 @@ const ELECTRON = {
419
419
  return ipcRenderer.invoke('set-system-theme:light-mode');
420
420
  }
421
421
  },
422
+ get appPath(){
423
+ return ipcRenderer.sendSync("get-app-path");
424
+ }
422
425
  };
423
426
 
424
427
  require("./pload")(ELECTRON,{projectRoot});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "7.5.43",
3
+ "version": "7.5.44",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "scripts": {
6
6
  "clear-npx-cache": "npx clear-npx-cache",