@anmol0493/fullstack-app 1.0.0 → 1.0.2
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/README.md +1 -1
- package/package.json +1 -1
- package/scripts/setup.js +19 -12
package/README.md
CHANGED
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 () => {
|
|
@@ -58,12 +65,12 @@ if (fs.existsSync(targetDir)) {
|
|
|
58
65
|
fs.mkdirSync(backendTargetDir, { recursive: true });
|
|
59
66
|
fs.cpSync(backendSourceDir, backendTargetDir, { recursive: true });
|
|
60
67
|
|
|
61
|
-
// Step 3: Install dependencies for frontend and backend
|
|
62
|
-
console.log('Installing dependencies...');
|
|
63
|
-
process.chdir(targetDir); // Navigate to the new project directory
|
|
68
|
+
// // Step 3: Install dependencies for frontend and backend
|
|
69
|
+
// console.log('Installing dependencies...');
|
|
70
|
+
// process.chdir(targetDir); // Navigate to the new project directory
|
|
64
71
|
|
|
65
|
-
await execa('npm', ['install'], { cwd: path.join(targetDir, 'frontend'), stdio: 'inherit' });
|
|
66
|
-
await execa('npm', ['install'], { cwd: backendTargetDir, stdio: 'inherit' });
|
|
72
|
+
// await execa('npm', ['install'], { cwd: path.join(targetDir, 'frontend'), stdio: 'inherit' });
|
|
73
|
+
// await execa('npm', ['install'], { cwd: backendTargetDir, stdio: 'inherit' });
|
|
67
74
|
|
|
68
75
|
console.log(`Project ${projectName} created successfully!`);
|
|
69
76
|
} catch (error) {
|