@fto-consult/expo-ui 7.4.18 → 7.4.19

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
@@ -111,7 +111,7 @@ program.command('electron')
111
111
  let cmd = undefined;
112
112
  const start = x=>{
113
113
  return new Promise((resolve,reject)=>{
114
- cmd = `electron "${electronProjectRoot}"${url? ` url="${url}"`:''}`;
114
+ cmd = `electron "${electronProjectRoot}"${url? ` --url ${url}`:''} --path ${pathsJSON} --root ${projectRoot}`;
115
115
  exec({
116
116
  cmd,
117
117
  projectRoot : electronProjectRoot,
package/electron/index.js CHANGED
@@ -2,13 +2,34 @@ const {app, BrowserWindow,Tray,Menu,MenuItem,globalShortcut,systemPreferences,po
2
2
  const session = require("./utils/session");
3
3
  const path = require("path");
4
4
  const fs = require("fs");
5
- const ePath = path.resolve(__dirname);
6
- if(!fs.existsSync(path.resolve(ePath,"paths.json"))){
7
- throw {message : 'Chemin de noms, fichier paths.json introuvable!! Exécutez l\'application en enviornnement web|mobile|android|ios puis re-essayez'}
8
- }
9
- const paths = require("./paths.json");
10
- const projectRoot = paths.projectRoot || '';
5
+ const { program } = require('commander');
6
+ const getPaths = require("../electron/utils/paths");
7
+
8
+ program
9
+ .option('-u, --url <url>', 'the loading url')
10
+ .option('-r, --root <projectRoot>', 'the project root path')
11
+ .option('-p, --paths <paths>', 'le chemin vers le fichiers paths.json')
12
+ .parse();
13
+
14
+ const programOptions = program.opts();
15
+ const {url:pUrl,paths:pathsJSON,root:mainProjectRoot} = programOptions
16
+
17
+ const pathsJ = pathsJSON && fs.existsSync(pathsJSON) && pathsJSON.endsWiths("paths.json")? pathsJSON : null;
18
+ let paths = pathsJ ? require(`${pathsJ}`) : fs.existsSync(path.resolve("./paths.json")) ? require("./paths.json") : null;
19
+ const projectRoot = mainProjectRoot && fs.existsSync(mainProjectRoot) ? mainProjectRoot : paths.projectRoot || '';
11
20
  const electronProjectRoot = projectRoot && fs.existsSync(path.resolve(projectRoot,"electron")) && path.resolve(projectRoot,"electron") || null;
21
+ const ePathsJSON = path.resolve(electronProjectRoot,"paths.json");
22
+ const eePaths = path.resolve(getPaths(projectRoot));
23
+ if(!paths){
24
+ if(fs.existsSync(ePathsJSON)){
25
+ paths = require(ePathsJSON);
26
+ } else if(fs.existsSync(eePaths)){
27
+ path = require(eePaths);
28
+ } else {
29
+ throw {message : 'Chemin de noms, fichier paths.json introuvable!! Exécutez l\'application en enviornnement web|mobile|android|ios puis re-essayez'}
30
+ }
31
+ }
32
+
12
33
  const mainProcessPath = path.resolve('processes',"main","index.js");
13
34
  const mainProcessIndex = electronProjectRoot && fs.existsSync(path.resolve(electronProjectRoot,mainProcessPath)) && path.resolve(electronProjectRoot,mainProcessPath);
14
35
  const mainProcessRequired = mainProcessIndex && require(`${mainProcessIndex}`);
@@ -92,7 +113,7 @@ function createBrowserWindow (options){
92
113
  _win.setMenuBarVisibility(false)
93
114
  _win.setAutoHideMenuBar(true)
94
115
  }
95
- let url = options.loadURL && typeof options.loadURL ==='string'? options.loadURL : undefined;
116
+ const url = options.loadURL && typeof options.loadURL ==='string'? options.loadURL : pUrl || undefined;
96
117
  if(url){
97
118
  _win.loadURL(url);
98
119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "7.4.18",
3
+ "version": "7.4.19",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "main",
6
6
  "scripts": {