@fto-consult/expo-ui 7.4.2 → 7.4.4
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/babel.config.alias.js +2 -1
- package/bin/index.js +3 -2
- package/bin/init.js +7 -1
- package/bin/package.js +1 -0
- package/electron/index.js +3 -2
- package/electron/init/main.js +8 -3
- package/electron/is-initialized.js +1 -0
- package/electron/utils/index.js +2 -1
- package/electron/utils/paths.js +13 -0
- package/package.json +1 -1
package/babel.config.alias.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
const path = require("path");
|
2
2
|
const fs = require("fs");
|
3
3
|
const writeFile = require("./electron/utils/writeFile");
|
4
|
+
const paths = require("./electron/utils/paths");
|
4
5
|
module.exports = (opts)=>{
|
5
6
|
const isLocalDev = require("./is-local-dev")();
|
6
7
|
const dir = path.resolve(__dirname);
|
@@ -114,7 +115,7 @@ module.exports = (opts)=>{
|
|
114
115
|
} catch{}
|
115
116
|
}
|
116
117
|
///on sauvegarde les chemins des fichiers utiles, qui seront utilisées par la variable electron plus tard
|
117
|
-
writeFile(
|
118
|
+
writeFile(paths(projectRoot),JSON.stringify(electronPaths, null, "\t"));
|
118
119
|
r["$erealm"] = path.resolve(expo,'realm');
|
119
120
|
if(!r.$realm){
|
120
121
|
r.$realm = r.$erealm;
|
package/bin/index.js
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
const { program } = require('commander');
|
11
11
|
const path= require("path");
|
12
12
|
const fs = require("fs");
|
13
|
-
const {createDir,electronDir,copy,exec,throwError} = require("./utils");
|
13
|
+
const {createDir,electronDir,copy,exec,throwError,paths:getPaths} = require("./utils");
|
14
14
|
|
15
15
|
|
16
16
|
const dir = path.resolve(__dirname);
|
@@ -59,7 +59,7 @@ program.command('electron')
|
|
59
59
|
if(projectRoot == dir){
|
60
60
|
throwError(`Invalid project root ${projectRoot}; project root must be different to ${dir}`);
|
61
61
|
}
|
62
|
-
const pathsJSON = path.resolve(electronDir,
|
62
|
+
const pathsJSON = path.resolve(electronDir,getPaths(projectRoot));
|
63
63
|
if(!fs.existsSync(pathsJSON)){
|
64
64
|
throwError("Le fichier des chemins d'accès à l'application est innexistant, rassurez vous de tester l'application en environnement web, via la cmde <npx expo start>, avant l'exécution du script electron.");
|
65
65
|
}
|
@@ -85,6 +85,7 @@ program.command('electron')
|
|
85
85
|
electronDir,
|
86
86
|
electronProjectRoot,
|
87
87
|
paths,
|
88
|
+
pathsJSON
|
88
89
|
});
|
89
90
|
}
|
90
91
|
require("../electron/create-index-file")(electronProjectRoot);
|
package/bin/init.js
CHANGED
@@ -4,13 +4,14 @@ const exec = require("../electron/utils/exec");
|
|
4
4
|
const createDir = require("../electron/utils/createDir");
|
5
5
|
const writeFile = require("../electron/utils/writeFile");
|
6
6
|
const copy = require("../electron/utils/copy");
|
7
|
+
const paths = require("../electron/utils/paths");
|
7
8
|
const electronDir = path.resolve(__dirname,"..","electron");
|
8
9
|
const createIndexFile = require("../electron/create-index-file");
|
9
10
|
const appSuffix = " Desktop";
|
10
11
|
const mainPackage = require("../package.json");
|
11
12
|
const mainPackageName = mainPackage.name;
|
12
13
|
|
13
|
-
module.exports = ({projectRoot,electronProjectRoot})=>{
|
14
|
+
module.exports = ({projectRoot,electronProjectRoot,paths,pathsJSON})=>{
|
14
15
|
return new Promise((resolve,reject)=>{
|
15
16
|
//make shure electron project root exists
|
16
17
|
if(!createDir(electronProjectRoot)){
|
@@ -57,6 +58,11 @@ module.exports = ({projectRoot,electronProjectRoot})=>{
|
|
57
58
|
/**** copying all electron utils files */
|
58
59
|
const utilsPath = path.resolve(electronProjectRoot,"utils");
|
59
60
|
copy(path.resolve(electronDir,"utils"),utilsPath);
|
61
|
+
if(pathsJSON && fs.existsSync(pathsJSON)){
|
62
|
+
try {
|
63
|
+
copy(pathsJSON,path.resolve(electronProjectRoot,"paths.json"));
|
64
|
+
} catch(e){}
|
65
|
+
}
|
60
66
|
console.log("installing package dependencies ...");
|
61
67
|
return exec({
|
62
68
|
cmd : "npm install",// --prefix "+electronProjectRoot,
|
package/bin/package.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
const getIcon = require("../electron/utils/getIcon");
|
2
2
|
const path = require("path");
|
3
|
+
const path = require("../electron/utils/paths");
|
3
4
|
const defaultFunc = (cb,cb2) => typeof cb =='function' ? cb : typeof cb2 ==='function'? cb2 : x=> x;
|
4
5
|
const paths = require("../electron/paths.json");
|
5
6
|
const images = paths.$images, assets = paths.$assets, logo = paths.logo;
|
package/electron/index.js
CHANGED
@@ -276,10 +276,11 @@ ipcMain.on("electron-toggle-dev-tools",function(event,value) {
|
|
276
276
|
|
277
277
|
|
278
278
|
app.whenReady().then(() => {
|
279
|
+
const readOpts = {toggleDevTools,window:win,win};
|
279
280
|
if(typeof mainProcess.whenReady =='function'){
|
280
|
-
mainProcess.whenReady();
|
281
|
+
mainProcess.whenReady(readOpts);
|
281
282
|
} else if(typeof mainProcess.appOnReady =='function'){
|
282
|
-
mainProcess.appOnReady();
|
283
|
+
mainProcess.appOnReady(readOpts);
|
283
284
|
}
|
284
285
|
globalShortcut.register('CommandOrControl+F12', () => {
|
285
286
|
toggleDevTools();
|
package/electron/init/main.js
CHANGED
@@ -10,12 +10,17 @@
|
|
10
10
|
module.exports = {
|
11
11
|
/*****
|
12
12
|
@must return Instance of Browser window
|
13
|
+
width: 500, height: 400, transparent: true, frame: false,
|
14
|
+
alwaysOnTop: true
|
13
15
|
*/
|
14
|
-
splashScreen : function(){
|
16
|
+
splashScreen : function({width, height, transparent, frame, alwaysOnTop}){
|
15
17
|
return null;
|
16
18
|
},
|
17
|
-
/*** this function is called when app is ready
|
18
|
-
|
19
|
+
/*** this function is called when app is ready
|
20
|
+
toggleDevTools : {function},la fonction permettant de toggle les outils de developements
|
21
|
+
window : {BrowserWindow}, le browser window principal de l'application
|
22
|
+
*/
|
23
|
+
whenReady : function({toggleDevTools,window,win}){
|
19
24
|
|
20
25
|
}
|
21
26
|
}
|
@@ -7,6 +7,7 @@ module.exports = (projectRoot)=>{
|
|
7
7
|
&& fs.existsSync(path.resolve(projectRoot,"package.json"))
|
8
8
|
&& fs.existsSync(path.resolve(projectRoot,'processes',"main","index.js"))
|
9
9
|
&& fs.existsSync(path.resolve(projectRoot,'processes',"renderer","index.js"))
|
10
|
+
&& fs.existsSync(path.resolve(projectRoot,"paths.json"))
|
10
11
|
|
11
12
|
&& true || false;
|
12
13
|
}
|
package/electron/utils/index.js
CHANGED
@@ -4,8 +4,9 @@ module.exports = {
|
|
4
4
|
writeFile : require("./writeFile"),
|
5
5
|
copy : require("./copy"),
|
6
6
|
electronDir : path.resolve(__dirname, ".."),
|
7
|
+
paths : require("./paths"),
|
7
8
|
exec : require("./exec"),
|
8
|
-
|
9
|
+
throwError : (...args)=>{
|
9
10
|
console.error(...args);
|
10
11
|
process.exit(-1);
|
11
12
|
},
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
/**** permet de retourner le chemin des fichier, généré via les alias paths.json
|
3
|
+
contenant la liste des fichiers de l'application
|
4
|
+
*/
|
5
|
+
const fs = require("fs");
|
6
|
+
const path = requrie("path");
|
7
|
+
|
8
|
+
|
9
|
+
export default function (projectRoot){
|
10
|
+
projectRoot = projectRoot && fs.existsSync(projectRoot) && projectRoot || process.cwd();
|
11
|
+
const mainPackage = require("../../package.json");
|
12
|
+
return path.resolve(projectRoot,"node_modules",mainPackage.name,"paths.json");
|
13
|
+
}
|