@fto-consult/expo-ui 6.18.39 → 6.19.1

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 : [], //application main drawer items
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;
@@ -0,0 +1,8 @@
1
+
2
+ export default {
3
+ dashboard : {
4
+ label : "Dashboard",
5
+ routeName : "Home",
6
+ icon : "home",
7
+ }
8
+ }
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
- const mainPackage = fs.existsSync(mainPackagePath) && require(`${mainPackagePath}`) || null;
8
- if(!mainPackage || !mainPackage.name){
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 devDpendencies = packageObj.devDependencies;
17
- const deps = devDpendencies && typeof devDpendencies =="object" && Object.keys(devDpendencies).join(" ") || "";
18
- new Promise((resolve,reject)=>{
19
- console.log("installing dev dependencies ....");
20
- return exec(`npm i -D @expo/webpack-config @expo/metro-config ${typeof deps=="string" && deps||""}`).then(resolve).catch(reject);
21
- }).then(()=>{}).finally(()=>{
22
- console.log("creating application .....");
23
- createEntryFile(projectRoot);
24
- [path.join(projectRoot,"babel.config.js"),path.join(projectRoot,"metro.config.js"),path.join(projectRoot,"webpack.config.js")].map((p)=>{
25
- if(!fs.existsSync(p)){
26
- const file = path.basename(p);
27
- writeFile(p,fs.readFileSync(`${path.join(createAppDir,file)}`));
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
- createAPPJSONFile(projectRoot,{...mainPackage,name});
31
- copy(path.resolve(createAppDir,"src"),path.resolve(projectRoot,"src"),{recursive:true,overwrite:false});
32
- process.exit();
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
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+
2
3
  /**
3
4
  toujours ajouter l'instruction ci-dessus à la première ligne de chaque script npx
4
5
  @see : https://blog.shahednasser.com/how-to-create-a-npx-tool/ */
@@ -148,7 +149,7 @@ if(parsedArgs.electron){
148
149
  process.exit();
149
150
  });
150
151
  } else {
151
- if(script ===createAppScript){
152
+ if(script ===createAppScript || script ==="init"){
152
153
  return require("./create-app")(parsedArgs,{projectRoot});
153
154
  }
154
155
  process.exit();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "6.18.39",
3
+ "version": "6.19.1",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {