-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
1,741 additions
and
1,726 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const { getCwd } = require("./utils"); | ||
const fs = require('fs') | ||
const path = require('path') | ||
const { getCwd } = require('./utils') | ||
|
||
function init(directories) { | ||
const pageImport = []; | ||
const pageExport = []; | ||
const pageImport = [] | ||
const pageExport = [] | ||
|
||
directories.forEach(e => { | ||
pageImport.push(`import ${e} from '../pages/${e}';`); | ||
pageExport.push(`\t${e}: ${e},`); | ||
}); | ||
pageImport.push(`import ${e} from '../pages/${e}';`) | ||
pageExport.push(`\t${e}: ${e},`) | ||
}) | ||
|
||
const writeToFile = [ | ||
"// this file is created by './scripts/get-pages.js' and used in App.js\n", | ||
pageImport.join("\n"), | ||
"\nconst pages = {", | ||
pageExport.join("\n"), | ||
"}\n", | ||
"export default pages\n" | ||
pageImport.join('\n'), | ||
'\nconst pages = {', | ||
pageExport.join('\n'), | ||
'}\n', | ||
'export default pages\n', | ||
].join('\n') | ||
|
||
fs.writeFileSync(path.join(__dirname, "../", "src/data/pages.js"), writeToFile); | ||
fs.writeFileSync(path.join(__dirname, '../', 'src/data/pages.js'), writeToFile) | ||
} | ||
|
||
const [, , ...args] = process.argv; | ||
const directories = getCwd(args[0]).dirs; | ||
const [, , ...args] = process.argv | ||
const directories = getCwd(args[0]).dirs | ||
|
||
init(directories); | ||
init(directories) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const fs = require('fs') | ||
const path = require('path') | ||
|
||
exports.getCwd = function(filePath = ".") { | ||
const $path = path.join(process.cwd(), String(filePath)); | ||
exports.getCwd = function (filePath = '.') { | ||
const $path = path.join(process.cwd(), String(filePath)) | ||
|
||
const types = { | ||
path: path.resolve($path), | ||
files: [], | ||
dirs: [] | ||
}; | ||
dirs: [], | ||
} | ||
|
||
fs.readdirSync($path).forEach(e => { | ||
const stats = fs.statSync(path.join($path, e)); | ||
if (stats.isDirectory()) types.dirs.push(e); | ||
if (stats.isFile()) types.files.push(e); | ||
}); | ||
const stats = fs.statSync(path.join($path, e)) | ||
if (stats.isDirectory()) types.dirs.push(e) | ||
if (stats.isFile()) types.files.push(e) | ||
}) | ||
|
||
return types; | ||
}; | ||
return types | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.