@fto-consult/expo-ui 6.19.4 → 6.19.5

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/create-app.js CHANGED
@@ -1,13 +1,14 @@
1
1
  const {exec,thowError,copy,writeFile,createDirSync} = require("./utils");
2
2
  const fs = require("fs"), path = require("path");
3
3
  const createAppDir = path.resolve(__dirname,"create-app");
4
+ const argv = process.argv[2];
4
5
  module.exports = function(parsedArgs,{projectRoot}){
5
6
  const packageObj = require("../package.json");
6
7
  let root = process.cwd(), mainPackagePath = path.resolve(root,"package.json");
7
8
  let mainPackage = fs.existsSync(mainPackagePath) && require(`${mainPackagePath}`) || null;
8
9
  const name = String(parsedArgs.name||parsedArgs.appName || mainPackage?.name).trim();
9
10
  if(!name){
10
- return thowError(name," nom de l'application invalide, veuillez spécifier un nom d'application valide");
11
+ return thowError(name," nom de l'application invalide, veuillez spécifier un nom d'application valide",argv);
11
12
  }
12
13
  let hasPackage = !!mainPackage && typeof mainPackage =='object';
13
14
  if(!hasPackage){
package/bin/index.js CHANGED
@@ -20,9 +20,6 @@ const path= require("path");
20
20
  const fs = require("fs");
21
21
  const dir = path.resolve(__dirname);
22
22
  const projectRoot = path.resolve(process.cwd());
23
- if(projectRoot == dir){
24
- throwError(`Invalid project root ${projectRoot}; project root must be different to ${dir}`);
25
- }
26
23
  const parsedArgs = require("../electron/utils/parseArgs")(null,supportedScript);
27
24
  parsedArgs.script = typeof parsedArgs.script =='string' && parsedArgs.script && parsedArgs.script.toLowerCase().trim() || "";
28
25
  if(!parsedArgs.script || !(parsedArgs.script in supportedScript)){
@@ -38,6 +35,9 @@ const script = parsedArgs.script;
38
35
  * url = [url-to-start-electron-to]
39
36
  * */
40
37
  if(parsedArgs.electron){
38
+ if(projectRoot == dir){
39
+ throwError(`Invalid project root ${projectRoot}; project root must be different to ${dir}`);
40
+ }
41
41
  const pathsJSON = path.resolve(electronDir,"paths.json");
42
42
  if(!fs.existsSync(pathsJSON)){
43
43
  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.");
@@ -1,12 +1,22 @@
1
- const exec = require('child_process').exec;
1
+ const {exec,execSync} = require('child_process');
2
2
  const fs = require("fs");
3
- const _exec = (cmd,cmdOpts,logMessages)=>{
3
+ const _exec = (cmd,cmdOpts,logMessages,sync)=>{
4
4
  cmdOpts = typeof cmdOpts =='object' && cmdOpts || {};
5
5
  cmdOpts.env = typeof cmdOpts.env =="object" && cmdOpts.env || {};
6
6
  cmdOpts.env = {...process.env,...cmdOpts.env};
7
7
  cmdOpts.env.platform = cmdOpts.env.platform || "electron";
8
+ cmdOpts.stdio = cmdOpts.stdio || "inherit";
9
+ const timer = cmdOpts.loader !==false ? loaderTimer(cmd) : null;
10
+ if(sync){
11
+ try {
12
+ return execSync(cmd,cmdOpts);
13
+ } catch(e){
14
+ clearInterval(timer);
15
+ throw e;
16
+ }
17
+ return null;
18
+ }
8
19
  return new Promise((resolve,reject)=>{
9
- const timer = cmdOpts.loader !==false ? loaderTimer(cmd) : null;
10
20
  exec(cmd,cmdOpts, (error, stdout, stderr) => {
11
21
  if (error) {
12
22
  logMessages !== false && console.log(`error: ${error.message}`);;
@@ -38,7 +48,8 @@ const loaderTimer = function(timout) {
38
48
  x &= 3;
39
49
  }, timout);
40
50
  };
41
- module.exports = function(cmdOpts,options){
51
+
52
+ const runExec = function(cmdOpts,options,sync){
42
53
  if(typeof cmdOpts =='string'){
43
54
  cmdOpts = {cmd:cmdOpts};
44
55
  }
@@ -57,5 +68,12 @@ module.exports = function(cmdOpts,options){
57
68
  return _exec(cmd,cmdOpts,logMessages);
58
69
  })
59
70
  }
60
- return _exec(cmd,cmdOpts,logMessages);
61
- }
71
+ return _exec(cmd,cmdOpts,logMessages,sync);
72
+ }
73
+ module.exports = function(cmdOpts,options){
74
+ return runExec(cmdOpts,options,false);
75
+ }
76
+
77
+ module.exports.execSync = module.exports.sync = function(cmdOpts,options){
78
+ return runExec(cmdOpts,options,true);
79
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "6.19.4",
3
+ "version": "6.19.5",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {