react-fs-router 1.0.1 → 1.0.11
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/.idea/modules.xml +8 -0
- package/.idea/react-filesystem-router.iml +12 -0
- package/.idea/vcs.xml +6 -0
- package/README.md +1 -1
- package/genPath.js +10 -18
- package/index.js +1 -18
- package/lib/components/Routes.js +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/react-filesystem-router.iml" filepath="$PROJECT_DIR$/.idea/react-filesystem-router.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$">
|
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
7
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
+
</content>
|
|
9
|
+
<orderEntry type="inheritedJdk" />
|
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
+
</component>
|
|
12
|
+
</module>
|
package/.idea/vcs.xml
ADDED
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ path: // The path of this file in relation to its position in the folder structu
|
|
|
58
58
|
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
Name, icon and index can be written in each file and react-fs-router will read and place them in the output file.
|
|
61
|
+
Name, icon and index can be written in each file as comments and react-fs-router will read and place them in the output file.
|
|
62
62
|
|
|
63
63
|
```javascript
|
|
64
64
|
// name: Home
|
package/genPath.js
CHANGED
|
@@ -4,13 +4,7 @@ const chokidar = require("chokidar");
|
|
|
4
4
|
|
|
5
5
|
let isNotThefirstTimeRunning = true;
|
|
6
6
|
|
|
7
|
-
const genPath = (
|
|
8
|
-
page_directory,
|
|
9
|
-
configs_directory,
|
|
10
|
-
runOnce,
|
|
11
|
-
file_extention,
|
|
12
|
-
dont_output_fileProperties
|
|
13
|
-
) => {
|
|
7
|
+
const genPath = (page_directory, configs_directory, runOnce) => {
|
|
14
8
|
//main function
|
|
15
9
|
const pathMaker = () => {
|
|
16
10
|
//parse parameters in path
|
|
@@ -156,20 +150,18 @@ const genPath = (
|
|
|
156
150
|
else return "." + ext;
|
|
157
151
|
} else return ".js";
|
|
158
152
|
};
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
(err)
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
);
|
|
168
|
-
}
|
|
153
|
+
fs.writeFileSync(
|
|
154
|
+
(configs_directory || page_directory) +
|
|
155
|
+
`/_page-properties${parseFileExtention(".js")}`,
|
|
156
|
+
prettier.format(_config, { semi: false, parser: "babel" }),
|
|
157
|
+
(err) => {
|
|
158
|
+
if (err) return console.error(err);
|
|
159
|
+
}
|
|
160
|
+
);
|
|
169
161
|
|
|
170
162
|
fs.writeFileSync(
|
|
171
163
|
(configs_directory || page_directory) +
|
|
172
|
-
`/_routes${parseFileExtention(
|
|
164
|
+
`/_routes${parseFileExtention(".js")}`,
|
|
173
165
|
prettier.format(_routes, { semi: false, parser: "babel" }),
|
|
174
166
|
(err) => {
|
|
175
167
|
if (err) return console.error(err);
|
package/index.js
CHANGED
|
@@ -10,27 +10,10 @@ program.storeOptionsAsProperties(name);
|
|
|
10
10
|
|
|
11
11
|
program.version(version, "-v --version", "Output the current version");
|
|
12
12
|
program.requiredOption("-i,--input <directory>", "Path to your pages folder");
|
|
13
|
-
program.option("-o,--output <output>", "Path to store generated files");
|
|
14
|
-
program.option(
|
|
15
|
-
"-ext,--extention <extention>",
|
|
16
|
-
"extention on the generated files"
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
program.option(
|
|
20
|
-
"-p,--pageProperties [type]",
|
|
21
|
-
"Boolean option to disable genrating page properties file"
|
|
22
|
-
);
|
|
23
13
|
program.option(
|
|
24
14
|
"-b,--build [type]",
|
|
25
15
|
"Boolean Option to run the program once. Intended to be used with build commands."
|
|
26
16
|
);
|
|
27
|
-
|
|
28
17
|
program.parse();
|
|
29
18
|
|
|
30
|
-
genPath(
|
|
31
|
-
program.input,
|
|
32
|
-
program.output,
|
|
33
|
-
program.build,
|
|
34
|
-
program.extention,
|
|
35
|
-
program.pageProperties
|
|
36
|
-
);
|
|
19
|
+
genPath(program.input, program.build);
|
|
File without changes
|