@fto-consult/expo-ui 6.18.39 → 6.19.0
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.
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import registerApp from "$expo-ui-root-path";
|
|
2
2
|
import screens from "./src/screens";
|
|
3
|
+
import drawerItems from "./src/navigation/drawerItems";
|
|
4
|
+
|
|
3
5
|
registerApp({
|
|
4
6
|
/**** application navigation */
|
|
5
7
|
navigation : {
|
|
6
8
|
//all application screeens
|
|
7
9
|
screens,
|
|
8
|
-
drawerItems
|
|
10
|
+
drawerItems, //application main drawer items
|
|
9
11
|
},
|
|
10
12
|
/**application components */
|
|
11
13
|
components : {
|
|
@@ -24,14 +26,11 @@ registerApp({
|
|
|
24
26
|
/**
|
|
25
27
|
* //when main application component is mounted
|
|
26
28
|
*/
|
|
27
|
-
onMount : function(){
|
|
28
|
-
},
|
|
29
|
+
onMount : function(){},
|
|
29
30
|
/****when main application component is unmounted*/
|
|
30
|
-
onUnmount : function(){
|
|
31
|
-
},
|
|
31
|
+
onUnmount : function(){},
|
|
32
32
|
/**** called any time main application's component is rendered */
|
|
33
|
-
onRender : function(){
|
|
34
|
-
},
|
|
33
|
+
onRender : function(){},
|
|
35
34
|
/*** if you need to wrap main application content with some custom react Provider */
|
|
36
35
|
render : ({children})=>{
|
|
37
36
|
return children;
|
package/bin/create-app.js
CHANGED
|
@@ -4,33 +4,49 @@ const createAppDir = path.resolve(__dirname,"create-app");
|
|
|
4
4
|
module.exports = function(parsedArgs,{projectRoot}){
|
|
5
5
|
const packageObj = require("../package.json");
|
|
6
6
|
const root = process.cwd(), mainPackagePath = path.resolve(root,"package.json");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
thowError("Nom de l'application invalide. Rassurez vous d'exécuter l'application dans un répertoire valide."," package : ",mainPackage);
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
const name = String(parsedArgs.name||mainPackage.name).trim();
|
|
7
|
+
let mainPackage = fs.existsSync(mainPackagePath) && require(`${mainPackagePath}`) || null;
|
|
8
|
+
const name = String(parsedArgs.name||parsedArgs.appName || mainPackage?.name).trim();
|
|
13
9
|
if(!name){
|
|
14
10
|
return thowError(name," nom de l'application invalide, veuillez spécifier un nom d'application valide");
|
|
15
11
|
}
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
const cb = (pkg,)=>{
|
|
13
|
+
mainPackage = pkg && typeof pkg =='object' && pkg || mainPackage;
|
|
14
|
+
const devDpendencies = packageObj.devDependencies;
|
|
15
|
+
const deps = devDpendencies && typeof devDpendencies =="object" && Object.keys(devDpendencies).join(" ") || "";
|
|
16
|
+
new Promise((resolve,reject)=>{
|
|
17
|
+
console.log("installing dev dependencies ....");
|
|
18
|
+
return exec(`npm i -D @expo/webpack-config @expo/metro-config ${typeof deps=="string" && deps||""}`).then(resolve).catch(reject);
|
|
19
|
+
}).then(()=>{}).finally(()=>{
|
|
20
|
+
console.log("creating application .....");
|
|
21
|
+
createEntryFile(projectRoot);
|
|
22
|
+
[path.join(projectRoot,"babel.config.js"),path.join(projectRoot,"metro.config.js"),path.join(projectRoot,"webpack.config.js")].map((p)=>{
|
|
23
|
+
if(!fs.existsSync(p)){
|
|
24
|
+
const file = path.basename(p);
|
|
25
|
+
writeFile(p,fs.readFileSync(`${path.join(createAppDir,file)}`));
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
createAPPJSONFile(projectRoot,{...mainPackage,name});
|
|
29
|
+
copy(path.resolve(createAppDir,"src"),path.resolve(projectRoot,"src"),{recursive:true,overwrite:false});
|
|
30
|
+
process.exit();
|
|
29
31
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
}
|
|
33
|
+
if(!mainPackage){
|
|
34
|
+
mainPackage = {
|
|
35
|
+
name,
|
|
36
|
+
version : "1.0.0",
|
|
37
|
+
"description": "",
|
|
38
|
+
"main": "index.js",
|
|
39
|
+
scripts : {
|
|
40
|
+
start : "npx expo start -c",
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
writeFile(mainPackagePath,JSON.stringify(mainPackage,null,2));
|
|
44
|
+
exec("npm i @fto-consult/expo-ui").finally(()=>{
|
|
45
|
+
return cb(mainPackage);
|
|
46
|
+
});
|
|
47
|
+
} else {
|
|
48
|
+
return cb();
|
|
49
|
+
}
|
|
34
50
|
}
|
|
35
51
|
|
|
36
52
|
const createEntryFile = (projectRoot)=>{
|
package/bin/index.js
CHANGED