@fto-consult/expo-ui 6.18.29 → 6.18.31
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/registerApp.js +22 -7
- package/bin/create-app.js +26 -4
- package/package.json +1 -1
|
@@ -1,22 +1,37 @@
|
|
|
1
1
|
import registerApp from "$expo-ui-root-path";
|
|
2
2
|
registerApp({
|
|
3
|
+
/**** application navigation */
|
|
3
4
|
navigation : {
|
|
4
5
|
screens : [],//all application screeens
|
|
5
6
|
drawerItems : [], //application main drawer items
|
|
6
7
|
},
|
|
7
|
-
|
|
8
|
+
/**application components */
|
|
9
|
+
components : {
|
|
8
10
|
logo : null,//logo component's properties
|
|
9
11
|
loginPropsMutator : {},//login props mutator
|
|
10
12
|
},
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
/*** //for application initialization
|
|
14
|
+
@param {
|
|
15
|
+
appConfig : {object}, //application configuration manager imported from $capp/config
|
|
16
|
+
}
|
|
17
|
+
@return {Promise} if rejected, application is suposed to not be started, so we need to display getStarted Screen, il not, application logic is runned
|
|
18
|
+
*/
|
|
19
|
+
init : function({appConfig}){
|
|
20
|
+
return Promise.resolve("app is initialized");
|
|
13
21
|
},
|
|
14
|
-
|
|
15
|
-
|
|
22
|
+
/**
|
|
23
|
+
* //when main application component is mounted
|
|
24
|
+
*/
|
|
25
|
+
onMount : function(){
|
|
16
26
|
},
|
|
17
|
-
|
|
27
|
+
/****when main application component is unmounted*/
|
|
28
|
+
onUnmount : function(){
|
|
18
29
|
},
|
|
30
|
+
/**** called any time main application's component is rendered */
|
|
19
31
|
onRender : function(){
|
|
20
|
-
|
|
32
|
+
},
|
|
33
|
+
/*** if you need to wrap main application content with some custom react Provider */
|
|
34
|
+
render : ({children})=>{
|
|
35
|
+
return children;
|
|
21
36
|
}
|
|
22
37
|
});
|
package/bin/create-app.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const {exec,thowError,writeFile} = require("./utils");
|
|
2
2
|
const fs = require("fs"), path = require("path");
|
|
3
|
+
const createAppDir = path.resolve(__dirname,"create-app");
|
|
3
4
|
module.exports = function(parsedArgs,{projectRoot}){
|
|
4
5
|
const packageObj = require("../package.json");
|
|
5
6
|
const root = process.cwd(), mainPackagePath = path.resolve(root,"package.json");
|
|
@@ -14,7 +15,6 @@ module.exports = function(parsedArgs,{projectRoot}){
|
|
|
14
15
|
}
|
|
15
16
|
const devDpendencies = packageObj.devDependencies;
|
|
16
17
|
const deps = devDpendencies && typeof devDpendencies =="object" && Object.keys(devDpendencies).join(" ");
|
|
17
|
-
console.log(projectRoot," is project root");
|
|
18
18
|
new Promise((resolve,reject)=>{
|
|
19
19
|
if(typeof deps =="string" && deps){
|
|
20
20
|
console.log("installing dev dependencies ....");
|
|
@@ -27,9 +27,10 @@ module.exports = function(parsedArgs,{projectRoot}){
|
|
|
27
27
|
[path.join(projectRoot,"babel.config.js"),path.join(projectRoot,"metro.config.js"),path.join(projectRoot,"webpack.config.js")].map((p)=>{
|
|
28
28
|
if(!fs.existsSync(p)){
|
|
29
29
|
const file = path.basename(p);
|
|
30
|
-
writeFile(p,fs.readFileSync(
|
|
30
|
+
writeFile(p,fs.readFileSync(`${path.join(createAppDir,file)}`));
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
|
+
createAPPJSONFile(projectRoot,{...mainPackage,name});
|
|
33
34
|
process.exit();
|
|
34
35
|
});
|
|
35
36
|
}
|
|
@@ -37,9 +38,30 @@ module.exports = function(parsedArgs,{projectRoot}){
|
|
|
37
38
|
const createEntryFile = (projectRoot)=>{
|
|
38
39
|
const mainEntry = path.join(projectRoot,"index.js");
|
|
39
40
|
if(!fs.existsSync(mainEntry)){
|
|
40
|
-
console.log("creating main entry ... on path",path.
|
|
41
|
-
writeFile(mainEntry,fs.readFileSync(path.
|
|
41
|
+
console.log("creating main entry ... on path",path.join(createAppDir,"registerApp.js"));
|
|
42
|
+
writeFile(mainEntry,fs.readFileSync(path.join(createAppDir,"registerApp.js")));
|
|
42
43
|
return true;
|
|
43
44
|
}
|
|
44
45
|
return false;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const createAPPJSONFile = (projectRoot,{name,version})=>{
|
|
49
|
+
version = version ||"1.0.0";
|
|
50
|
+
const appJSONPath = path.join(projectRoot,"app.json");
|
|
51
|
+
if(!fs.existsSync(appJSONPath)){
|
|
52
|
+
writeFile(appJSONPath,`
|
|
53
|
+
{
|
|
54
|
+
"expo": {
|
|
55
|
+
"name": ${name},
|
|
56
|
+
"slug": ${name.toLowerCase().replace("")},
|
|
57
|
+
"version":${version},
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
`)
|
|
61
|
+
} else {
|
|
62
|
+
const appJSON = require(`${appJSONPath}`);
|
|
63
|
+
appJSON.version = version;
|
|
64
|
+
writeFile(appJSONPath,JSON.stringify(appJSON,null, 2));
|
|
65
|
+
}
|
|
66
|
+
return fs.existsSync(appJSONPath);
|
|
45
67
|
}
|