@anmol0493/fullstack-app 1.0.0 → 1.0.1
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/package.json +1 -1
- package/scripts/setup.js +14 -7
package/package.json
CHANGED
package/scripts/setup.js
CHANGED
|
@@ -16,19 +16,26 @@ const __dirname = dirname(__filename);
|
|
|
16
16
|
const projectName = process.argv[2];
|
|
17
17
|
|
|
18
18
|
if (!projectName) {
|
|
19
|
-
console.error('Please provide a project name
|
|
20
|
-
console.error(' npx @anmol040903/fullstack-app <project-name>');
|
|
19
|
+
console.error('Please provide a project name');
|
|
21
20
|
process.exit(1);
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
// Define paths
|
|
25
24
|
const templateDir = path.join(__dirname, '..'); // Root directory of your template
|
|
26
|
-
|
|
25
|
+
let targetDir;
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
if
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
if (projectName === '.') {
|
|
28
|
+
// Use the current working directory if "." is provided
|
|
29
|
+
targetDir = process.cwd();
|
|
30
|
+
} else {
|
|
31
|
+
// Otherwise, create a new directory with the given project name
|
|
32
|
+
targetDir = path.resolve(process.cwd(), projectName);
|
|
33
|
+
|
|
34
|
+
// Ensure the target directory doesn't already exist
|
|
35
|
+
if (fs.existsSync(targetDir)) {
|
|
36
|
+
console.error(`Directory "${projectName}" already exists.`);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
(async () => {
|