create-fs-app 1.1.3 → 1.1.4
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/create-fs-app.js +3 -18
- package/package.json +1 -1
package/create-fs-app.js
CHANGED
|
@@ -12,8 +12,9 @@ import gradient from 'gradient-string';
|
|
|
12
12
|
|
|
13
13
|
let appName = process.argv[2];
|
|
14
14
|
const currentDirectory = process.cwd();
|
|
15
|
-
let custAppName = (appName=='.')?currentDirectory:appName;
|
|
16
15
|
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
+
|
|
17
|
+
// git repository
|
|
17
18
|
const mernGitRepo = "https://github.com/Om-jannu/mern-template.git";
|
|
18
19
|
|
|
19
20
|
//sleep function
|
|
@@ -94,6 +95,7 @@ const buildStructure = async(dirName, dir, repo) => {
|
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
|
|
98
|
+
// function to create a folder
|
|
97
99
|
async function createFolder(folderName) {
|
|
98
100
|
try {
|
|
99
101
|
if (!fs.existsSync(folderName)) {
|
|
@@ -118,24 +120,7 @@ const BuildMernStructure = async() => {
|
|
|
118
120
|
buildStructure('.', currentDirectory, mernGitRepo);
|
|
119
121
|
}
|
|
120
122
|
else {
|
|
121
|
-
// fs.access(currentDirectory, fs.constants.F_OK, (error) => {
|
|
122
|
-
// if (error) {
|
|
123
|
-
// console.error(chalk.bold.red(`Error: Directory "${currentDirectory}" does not exist`));
|
|
124
|
-
// process.exit(1);
|
|
125
|
-
// }
|
|
126
|
-
// process.chdir(currentDirectory);
|
|
127
|
-
// console.log(chalk.bold.yellow(`Current directory : ${process.cwd()}`));
|
|
128
|
-
// if (fs.existsSync(path.join(parentDir, appName))) {
|
|
129
|
-
// console.log(chalk.bold.red("Folder already exists"));
|
|
130
|
-
// process.exit(0);
|
|
131
|
-
// }
|
|
132
|
-
// fs.mkdirSync(appName);
|
|
133
|
-
// const projectdirname = parentDir+'\\'+appName;
|
|
134
|
-
// buildStructure(appName,projectdirname,mernGitRepo);
|
|
135
|
-
// console.log(chalk.bold.green(`Project "${appName}" has been created`));
|
|
136
|
-
// });
|
|
137
123
|
const projDir = path.resolve(path.dirname(__filename),appName);
|
|
138
|
-
// console.log(projDir);
|
|
139
124
|
await createFolder(appName);
|
|
140
125
|
await buildStructure(appName,projDir,mernGitRepo);
|
|
141
126
|
}
|