@fto-consult/expo-ui 6.19.1 → 6.19.2
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 +8 -2
- package/package.json +1 -1
package/bin/create-app.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
const {exec,thowError,copy,writeFile} = require("./utils");
|
|
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
4
|
module.exports = function(parsedArgs,{projectRoot}){
|
|
5
5
|
const packageObj = require("../package.json");
|
|
6
|
-
|
|
6
|
+
let root = process.cwd(), mainPackagePath = path.resolve(root,"package.json");
|
|
7
7
|
let mainPackage = fs.existsSync(mainPackagePath) && require(`${mainPackagePath}`) || null;
|
|
8
8
|
const name = String(parsedArgs.name||parsedArgs.appName || mainPackage?.name).trim();
|
|
9
9
|
if(!name){
|
|
10
10
|
return thowError(name," nom de l'application invalide, veuillez spécifier un nom d'application valide");
|
|
11
11
|
}
|
|
12
|
+
if(!mainPackage){
|
|
13
|
+
const newDir = createDirSync(path.resolve(root,name.trim()));
|
|
14
|
+
projectRoot = newDir || projectRoot;
|
|
15
|
+
mainPackagePath = path.resolve(projectRoot,"package.json");
|
|
16
|
+
console.log(projectRoot," is new project root ",mainPackage);
|
|
17
|
+
}
|
|
12
18
|
const cb = (pkg,)=>{
|
|
13
19
|
mainPackage = pkg && typeof pkg =='object' && pkg || mainPackage;
|
|
14
20
|
const devDpendencies = packageObj.devDependencies;
|