Created
November 19, 2018 03:31
-
-
Save Williammer/4c57a83a38165e228e348d9742dba70a to your computer and use it in GitHub Desktop.
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
const fs = require('fs'); | |
function addSchemaName(basePath) { | |
const result = fs.readdirSync(basePath); | |
// console.log(result); | |
result.forEach((path) => { | |
if (path.startsWith('_') || path.endsWith('Schema.js')) { return; } | |
if (path.endsWith('.js')) { | |
const prefix = path.split('.')[0]; | |
fs.renameSync(`${basePath}/${path}`, `${basePath}/${prefix}Schema.js`); | |
} else { | |
addSchemaName(`${basePath}/${path}`); | |
} | |
}) | |
} | |
addSchemaName('.'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment