@fto-consult/expo-ui 7.5.13 → 7.5.15
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 +19 -10
- package/electron/index.js +9 -4
- package/electron/init/main.js +5 -1
- package/package.json +1 -1
package/bin/index.js
CHANGED
@@ -50,7 +50,7 @@ program.command('electron')
|
|
50
50
|
//.option('-s, --splash [dir]', 'le chemin (relatif au project root) du fichier du splash screen de l\'application')
|
51
51
|
.option('-o, --out [dir]', 'le chemin du répertoire qui contiendra les fichiers build, des fichiers du exporté par le framework expo; commande : build|start')
|
52
52
|
.option('-u, --url [url]', 'le lien url qui sera ouvert par l\'application; commande start')
|
53
|
-
.option('-b, --build [boolean]', 'si ce flag est spécfifié alors l\'application sera compilée; combinée avec la commande start pour indiquer que l\'application sera à nouveau exportée ou pas.')
|
53
|
+
.option('-b, --build [boolean]', 'si ce flag est spécfifié alors l\'application sera compilée; combinée avec la commande start|package pour indiquer que l\'application sera à nouveau exportée ou pas.')
|
54
54
|
.option('-a, --arch [architecture]', 'l\'architecture de la plateforme; Commande package')
|
55
55
|
.option('-p, --platform [platform]', 'la plateforme à utiliser pour la compilation; commande package')
|
56
56
|
.option('-i, --import [boolean]', 'la commande d\'initialisation du package electron forge, utile pour le packaging de l\'application. Elle permet d\'exécuter le cli electron package, pour l\'import d\'un projet existant. Commande package. exemple : expo-ui electron package --import')
|
@@ -151,12 +151,12 @@ program.command('electron')
|
|
151
151
|
try {
|
152
152
|
writeFile(packagePath,JSON.stringify({...packageObj,homepage:"./"},null,"\t"));
|
153
153
|
} catch{}
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
154
|
+
cmd = "npx expo export:web";
|
155
|
+
return exec({cmd,projectRoot}).then(next).catch(reject).finally(()=>{
|
156
|
+
try {
|
157
|
+
writeFile(packagePath,JSON.stringify({...packageObj,homepage},null,"\t"));
|
158
|
+
} catch{}
|
159
|
+
});
|
160
160
|
}
|
161
161
|
next();
|
162
162
|
});
|
@@ -183,9 +183,18 @@ program.command('electron')
|
|
183
183
|
|
184
184
|
} else {
|
185
185
|
cmd = `npx electron-forge package ${platform? `--platform="${platform}"`:""} ${arch?`--arch="${arch}"`:""}`;
|
186
|
-
|
187
|
-
|
188
|
-
|
186
|
+
const electronPackagePath = path.resolve(electronProjectRoot,'package.json');
|
187
|
+
const electronPackageJSON = require(electronPackagePath);
|
188
|
+
try {
|
189
|
+
writeFile(electronPackagePath,JSON.stringify({...electronPackageJSON,name:packageObj.name||electronPackageJSON.realName||electronPackageJSON.name},null,"\t"));
|
190
|
+
} catch{}
|
191
|
+
return exec({cmd,projectRoot:electronProjectRoot}).then(()=>{
|
192
|
+
console.log("application package avec succèss");
|
193
|
+
}).finally(()=>{
|
194
|
+
try {
|
195
|
+
writeFile(electronPackagePath,JSON.stringify(electronPackageJSON,null,"\t"));
|
196
|
+
} catch{}
|
197
|
+
});
|
189
198
|
}
|
190
199
|
break;
|
191
200
|
}
|
package/electron/index.js
CHANGED
@@ -12,12 +12,14 @@ program
|
|
12
12
|
|
13
13
|
const programOptions = program.opts();
|
14
14
|
const {url:pUrl,root:mainProjectRoot} = programOptions
|
15
|
+
|
16
|
+
const isAsar = (typeof require.main =="string" && require.main ||"").indexOf('app.asar') !== -1;
|
15
17
|
const projectRoot = mainProjectRoot && fs.existsSync(mainProjectRoot) ? mainProjectRoot : process.cwd();
|
16
|
-
const electronProjectRoot = projectRoot && fs.existsSync(path.resolve(projectRoot,"electron")) && path.resolve(projectRoot,"electron") ||
|
18
|
+
const electronProjectRoot = projectRoot && fs.existsSync(path.resolve(projectRoot,"electron")) && path.resolve(projectRoot,"electron") || projectRoot;
|
17
19
|
const packageJSONPath = path.resolve(projectRoot,"package.json");
|
18
20
|
const isValidUrl = require("./utils/isValidUrl");
|
19
21
|
const packageJSON = fs.existsSync(packageJSONPath) ? require(`${packageJSONPath}`) : {};
|
20
|
-
|
22
|
+
const indexFilePath = path.resolve(path.join(electronProjectRoot,"dist",'index.html'));
|
21
23
|
const mainProcessPath = path.resolve('processes',"main","index.js");
|
22
24
|
const mainProcessIndex = electronProjectRoot && fs.existsSync(path.resolve(electronProjectRoot,mainProcessPath)) && path.resolve(electronProjectRoot,mainProcessPath);
|
23
25
|
const mainProcessRequired = mainProcessIndex && require(`${mainProcessIndex}`);
|
@@ -85,7 +87,8 @@ function createBrowserWindow (options){
|
|
85
87
|
options.show = false;
|
86
88
|
}
|
87
89
|
if(typeof mainProcess.beforeCreateWindow =='function'){
|
88
|
-
mainProcess.beforeCreateWindow(options);
|
90
|
+
const opts = Object.assign({},mainProcess.beforeCreateWindow(options));
|
91
|
+
options = {...options,...opts};
|
89
92
|
}
|
90
93
|
let _win = new BrowserWindow(options);
|
91
94
|
if(!menu){
|
@@ -185,7 +188,9 @@ function createWindow () {
|
|
185
188
|
if(isValidUrl(pUrl)){
|
186
189
|
win.loadURL(pUrl);
|
187
190
|
} else {
|
188
|
-
|
191
|
+
if(!fs.existsSync(indexFilePath)){
|
192
|
+
throw `Unable to start the application: index file located at [${indexFilePath}] does not exists : projectRoot : [${projectRoot}], electronProjectRoot = [${electronProjectRoot}]`
|
193
|
+
} else win.loadFile(indexFilePath)
|
189
194
|
}
|
190
195
|
|
191
196
|
win.on('unresponsive', async () => {
|
package/electron/init/main.js
CHANGED
@@ -13,8 +13,12 @@ module.exports = {
|
|
13
13
|
Lors de la création de la fenêtre principal, BrowserWindowOptions continent la propriété isMainWindow à true
|
14
14
|
la prop isMainWindow {boolean} spécifie s'il s'agit de la fenêtre principale
|
15
15
|
la prop isPDFWindow {boolean}, spécifie s'il s'agit de la fenêtre destinée à l'affichage d'un fichier pdf
|
16
|
+
l'objet retourné est utilisé pour étendre les options à utiliser pour la création du BrowserWidow
|
17
|
+
@return {object};
|
16
18
|
*/
|
17
|
-
beforeCreateWindow : function({isMainWindow,isPDFWindow,...BrowserWindowOptions}){
|
19
|
+
beforeCreateWindow : function({isMainWindow,isPDFWindow,...BrowserWindowOptions}){
|
20
|
+
return {};
|
21
|
+
},
|
18
22
|
/*** exécutée lorsque l'évènement ready-to-show de la fenêtre principale BrowserWindow est appelée
|
19
23
|
@param {Instance of BrowserWindow} mainBrowserWindow
|
20
24
|
*/
|