sk-test-node-deploy 1.0.5 ā 1.0.6
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/lib/index.js +91 -91
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -85,106 +85,106 @@ async function createProject(projectName) {
|
|
|
85
85
|
const packageManager = await detectPackageManager();
|
|
86
86
|
console.log(chalk.gray(`Using package manager: ${packageManager}\n`));
|
|
87
87
|
|
|
88
|
-
// Step 4: Install production dependencies
|
|
89
|
-
console.log(chalk.blue("š¦ Installing dependencies...\n"));
|
|
90
|
-
const installSpinner = ora("Installing production dependencies...").start();
|
|
91
|
-
|
|
92
|
-
try {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
} catch (error) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Step 5: Install dev dependencies
|
|
123
|
-
const devInstallSpinner = ora("Installing dev dependencies...").start();
|
|
124
|
-
|
|
125
|
-
try {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
} catch (error) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// Step 6: Initialize git (optional)
|
|
156
|
-
const gitSpinner = ora("Initializing git repository...").start();
|
|
157
|
-
try {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
} catch (error) {
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// Step 7: Create .env from .env.example if exists
|
|
168
|
-
const envExamplePath = path.join(targetPath, ".env.example");
|
|
169
|
-
const envPath = path.join(targetPath, ".env");
|
|
170
|
-
|
|
171
|
-
if (fs.existsSync(envExamplePath) && !fs.existsSync(envPath)) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
88
|
+
// // Step 4: Install production dependencies
|
|
89
|
+
// console.log(chalk.blue("š¦ Installing dependencies...\n"));
|
|
90
|
+
// const installSpinner = ora("Installing production dependencies...").start();
|
|
91
|
+
|
|
92
|
+
// try {
|
|
93
|
+
// const prodDeps = [
|
|
94
|
+
// "bcryptjs",
|
|
95
|
+
// "compression",
|
|
96
|
+
// "cors",
|
|
97
|
+
// "dotenv",
|
|
98
|
+
// "express",
|
|
99
|
+
// "helmet",
|
|
100
|
+
// "joi",
|
|
101
|
+
// "jsonwebtoken",
|
|
102
|
+
// "mongoose",
|
|
103
|
+
// "socket.io",
|
|
104
|
+
// "multer",
|
|
105
|
+
// ];
|
|
106
|
+
|
|
107
|
+
// await runCommand(
|
|
108
|
+
// packageManager,
|
|
109
|
+
// [packageManager === "npm" ? "install" : "add", ...prodDeps],
|
|
110
|
+
// { cwd: targetPath },
|
|
111
|
+
// );
|
|
112
|
+
|
|
113
|
+
// installSpinner.succeed(chalk.green("Production dependencies installed!"));
|
|
114
|
+
// } catch (error) {
|
|
115
|
+
// installSpinner.fail(
|
|
116
|
+
// chalk.red("Failed to install production dependencies"),
|
|
117
|
+
// );
|
|
118
|
+
// console.error(chalk.red(error.message));
|
|
119
|
+
// throw error;
|
|
120
|
+
// }
|
|
121
|
+
|
|
122
|
+
// // Step 5: Install dev dependencies
|
|
123
|
+
// const devInstallSpinner = ora("Installing dev dependencies...").start();
|
|
124
|
+
|
|
125
|
+
// try {
|
|
126
|
+
// const devDeps = [
|
|
127
|
+
// "typescript",
|
|
128
|
+
// "ts-node",
|
|
129
|
+
// "@types/node",
|
|
130
|
+
// "@types/express",
|
|
131
|
+
// "@types/bcryptjs",
|
|
132
|
+
// "@types/compression",
|
|
133
|
+
// "@types/cors",
|
|
134
|
+
// "@types/jsonwebtoken",
|
|
135
|
+
// "@types/mongoose",
|
|
136
|
+
// "@types/socket.io",
|
|
137
|
+
// "@types/multer",
|
|
138
|
+
// "nodemon",
|
|
139
|
+
// ];
|
|
140
|
+
|
|
141
|
+
// const devArgs =
|
|
142
|
+
// packageManager === "npm"
|
|
143
|
+
// ? ["install", "-D", ...devDeps]
|
|
144
|
+
// : ["add", "-D", ...devDeps];
|
|
145
|
+
|
|
146
|
+
// await runCommand(packageManager, devArgs, { cwd: targetPath });
|
|
147
|
+
|
|
148
|
+
// devInstallSpinner.succeed(chalk.green("Dev dependencies installed!"));
|
|
149
|
+
// } catch (error) {
|
|
150
|
+
// devInstallSpinner.fail(chalk.red("Failed to install dev dependencies"));
|
|
151
|
+
// console.error(chalk.red(error.message));
|
|
152
|
+
// throw error;
|
|
153
|
+
// }
|
|
154
|
+
|
|
155
|
+
// // Step 6: Initialize git (optional)
|
|
156
|
+
// const gitSpinner = ora("Initializing git repository...").start();
|
|
157
|
+
// try {
|
|
158
|
+
// await runCommand("git", ["init"], {
|
|
159
|
+
// cwd: targetPath,
|
|
160
|
+
// stdio: "ignore",
|
|
161
|
+
// });
|
|
162
|
+
// gitSpinner.succeed(chalk.green("Git repository initialized!"));
|
|
163
|
+
// } catch (error) {
|
|
164
|
+
// gitSpinner.warn(chalk.yellow("Git not found or initialization skipped"));
|
|
165
|
+
// }
|
|
166
|
+
|
|
167
|
+
// // Step 7: Create .env from .env.example if exists
|
|
168
|
+
// const envExamplePath = path.join(targetPath, ".env.example");
|
|
169
|
+
// const envPath = path.join(targetPath, ".env");
|
|
170
|
+
|
|
171
|
+
// if (fs.existsSync(envExamplePath) && !fs.existsSync(envPath)) {
|
|
172
|
+
// await fs.copy(envExamplePath, envPath);
|
|
173
|
+
// console.log(chalk.green("ā .env file created from .env.example"));
|
|
174
|
+
// }
|
|
175
175
|
|
|
176
176
|
// Success message
|
|
177
177
|
console.log(chalk.green.bold("\n⨠Project created successfully!\n"));
|
|
178
|
-
console.log(chalk.cyan("To get started, run:"));
|
|
179
|
-
console.log(chalk.white(` cd ${projectName}`));
|
|
180
|
-
console.log(chalk.white(" npm run dev\n"));
|
|
178
|
+
// console.log(chalk.cyan("To get started, run:"));
|
|
179
|
+
// console.log(chalk.white(` cd ${projectName}`));
|
|
180
|
+
// console.log(chalk.white(" npm run dev\n"));
|
|
181
181
|
} catch (error) {
|
|
182
182
|
console.error(chalk.red("\nā Error creating project:"), error.message);
|
|
183
183
|
|
|
184
184
|
// Cleanup on error
|
|
185
185
|
if (fs.existsSync(targetPath)) {
|
|
186
186
|
console.log(chalk.yellow("Cleaning up..."));
|
|
187
|
-
await fs.remove(targetPath);
|
|
187
|
+
// await fs.remove(targetPath);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
process.exit(1);
|