simplified
This commit is contained in:
parent
66946f7b2e
commit
87b3031793
@ -11,29 +11,11 @@ import fs from "fs";
|
|||||||
import process from "process";
|
import process from "process";
|
||||||
import childProcess from "child_process";
|
import childProcess from "child_process";
|
||||||
|
|
||||||
|
|
||||||
const mkdirSync = function (dirPath) {
|
|
||||||
try {
|
|
||||||
fs.mkdirSync(dirPath);
|
|
||||||
console.log("Folder Ensured: " + dirPath);
|
|
||||||
} catch (err) {
|
|
||||||
if (err.code !== "EEXIST") throw err;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const mkdirpSync = function (dirPath) {
|
|
||||||
const parts = dirPath.split(path.sep);
|
|
||||||
for (let i = 1; i <= parts.length; i++) {
|
|
||||||
mkdirSync(path.join.apply(null, parts.slice(0, i)));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const dir = process.cwd();
|
const dir = process.cwd();
|
||||||
const newPath = path.join(dir, "src/core/config/modules");
|
const newPath = path.join(dir, "src/core/config/modules");
|
||||||
|
|
||||||
//Create the Destination Folder
|
//Create the Destination Folder
|
||||||
mkdirpSync(newPath);
|
fs.mkdirSync(newPath, { recursive: true });
|
||||||
|
|
||||||
//Create the default files
|
//Create the default files
|
||||||
fs.writeFileSync(path.join(newPath, "OpModules.mjs"), "export default{};\n");
|
fs.writeFileSync(path.join(newPath, "OpModules.mjs"), "export default{};\n");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user