create-fullstack-boilerplate 2.1.8 ā 2.1.9
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/index.js +181 -24
- package/lib/copyProject.js +37 -7
- package/lib/utils.js +134 -15
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -15,9 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
// ---- Your existing create-project code ----
|
|
17
17
|
const path = require("path");
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
const { runInstall, installDBDriver } = require("./lib/utils");
|
|
18
|
+
const copyProject = require('./lib/copyProject');
|
|
19
|
+
const { runInstall, installDBDriver, normalizePath } = require("./lib/utils"); // ADD normalizePath HERE
|
|
21
20
|
const setupMainDB = require("./lib/setupMainDB");
|
|
22
21
|
const setupExtraDB = require("./lib/setupExtraDB");
|
|
23
22
|
const testDBConnection = require("./lib/testDBConnection");
|
|
@@ -30,56 +29,74 @@
|
|
|
30
29
|
let templateDir;
|
|
31
30
|
|
|
32
31
|
// Try __dirname first (works for local/dev)
|
|
33
|
-
const localTemplate = path.
|
|
32
|
+
const localTemplate = normalizePath(path.resolve(__dirname, "template")); // NORMALIZE
|
|
33
|
+
console.log("š Checking local template:", localTemplate);
|
|
34
|
+
|
|
34
35
|
if (fs.existsSync(localTemplate)) {
|
|
35
36
|
templateDir = localTemplate;
|
|
37
|
+
console.log("ā
Found local template");
|
|
36
38
|
} else {
|
|
37
39
|
// Fallback for npx (temp folder)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
try {
|
|
41
|
+
const pkg = require.resolve("create-fullstack-boilerplate/package.json");
|
|
42
|
+
templateDir = normalizePath(path.resolve(path.dirname(pkg), "template")); // NORMALIZE
|
|
43
|
+
console.log("ā
Found npm template:", templateDir);
|
|
44
|
+
} catch (err) {
|
|
45
|
+
console.error("ā Could not resolve package:", err.message);
|
|
46
|
+
}
|
|
40
47
|
}
|
|
41
48
|
|
|
42
|
-
if (!fs.existsSync(templateDir)) {
|
|
49
|
+
if (!templateDir || !fs.existsSync(templateDir)) {
|
|
43
50
|
throw new Error(
|
|
44
|
-
|
|
51
|
+
`Template folder not found!\nSearched: ${localTemplate}\nMake sure 'template' is included in package.json 'files' field.`
|
|
45
52
|
);
|
|
46
53
|
}
|
|
47
54
|
|
|
48
|
-
console.log("Using template folder:", templateDir);
|
|
55
|
+
console.log("ā
Using template folder:", templateDir);
|
|
56
|
+
|
|
57
|
+
console.log("=== DEBUG INFO ===");
|
|
58
|
+
console.log("Current directory:", process.cwd());
|
|
59
|
+
console.log("Template directory:", templateDir);
|
|
60
|
+
console.log("Template exists:", fs.existsSync(templateDir));
|
|
61
|
+
if (fs.existsSync(templateDir)) {
|
|
62
|
+
console.log("Template contents:", fs.readdirSync(templateDir));
|
|
63
|
+
}
|
|
64
|
+
console.log("==================");
|
|
49
65
|
|
|
50
66
|
|
|
51
67
|
try {
|
|
52
68
|
console.log("\nšļø Setting Up Full Stack Project...\n");
|
|
53
69
|
|
|
54
70
|
const answers = await mainPrompts();
|
|
55
|
-
|
|
56
|
-
const targetDir = path.join(process.cwd(), answers.projectName);
|
|
71
|
+
const targetDir = normalizePath(path.join(process.cwd(), answers.projectName)); // NORMALIZE
|
|
57
72
|
|
|
58
|
-
(
|
|
73
|
+
console.log("Target directory:", targetDir);
|
|
59
74
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
75
|
+
// Remove the IIFE wrapper and just await directly
|
|
76
|
+
try {
|
|
77
|
+
console.log("š Copying project files...");
|
|
78
|
+
await copyProject(templateDir, targetDir);
|
|
79
|
+
console.log("ā
Project copied successfully");
|
|
80
|
+
} catch (err) {
|
|
81
|
+
console.error("ā Failed to copy project files:", err.message);
|
|
82
|
+
throw err; // Re-throw to stop execution
|
|
83
|
+
}
|
|
67
84
|
|
|
68
85
|
await setupMainDB(targetDir, answers.dbDialect);
|
|
69
86
|
console.log("ā”ļø Installing backend dependencies...");
|
|
70
|
-
await runInstall(path.join(targetDir, "Backend"));
|
|
87
|
+
await runInstall(normalizePath(path.join(targetDir, "Backend"))); // NORMALIZE
|
|
71
88
|
|
|
72
89
|
console.log("ā”ļø Installing frontend dependencies...");
|
|
73
|
-
await runInstall(path.join(targetDir, "Frontend"));
|
|
90
|
+
await runInstall(normalizePath(path.join(targetDir, "Frontend"))); // NORMALIZE
|
|
74
91
|
|
|
75
|
-
console.log("ā”ļø Installing Your Db Dialect: ", answers.dbDialect)
|
|
76
|
-
await installDBDriver(path.join(targetDir, "Backend"), answers.dbDialect);
|
|
92
|
+
console.log("ā”ļø Installing Your Db Dialect: ", answers.dbDialect);
|
|
93
|
+
await installDBDriver(normalizePath(path.join(targetDir, "Backend")), answers.dbDialect); // NORMALIZE
|
|
77
94
|
|
|
78
95
|
|
|
79
96
|
if (answers.addExtraDB) {
|
|
80
97
|
const extraDB = await extraDBPrompts();
|
|
81
98
|
console.log(`\nš Testing connection for ${extraDB.dbKey}...`);
|
|
82
|
-
await installDBDriver(path.join(targetDir, "Backend"), extraDB.dialect);
|
|
99
|
+
await installDBDriver(normalizePath(path.join(targetDir, "Backend")), extraDB.dialect); // NORMALIZE
|
|
83
100
|
const ok = await testDBConnection(targetDir, extraDB);
|
|
84
101
|
|
|
85
102
|
if (ok) {
|
|
@@ -117,3 +134,143 @@
|
|
|
117
134
|
process.exit(1);
|
|
118
135
|
}
|
|
119
136
|
})();
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
// #!/usr/bin/env node
|
|
141
|
+
|
|
142
|
+
// (async () => {
|
|
143
|
+
// const argv = process.argv.slice(2);
|
|
144
|
+
|
|
145
|
+
// if (argv[0] === "add-db") {
|
|
146
|
+
// await require("./lib/addDB")();
|
|
147
|
+
// return;
|
|
148
|
+
// }
|
|
149
|
+
|
|
150
|
+
// if (argv[0] === "add-route") {
|
|
151
|
+
// await require("./lib/addRoute")();
|
|
152
|
+
// return;
|
|
153
|
+
// }
|
|
154
|
+
|
|
155
|
+
// // ---- Your existing create-project code ----
|
|
156
|
+
// const path = require("path");
|
|
157
|
+
// // const { ensure } = require("./lib/utils");
|
|
158
|
+
// const copyProject = require('./lib/copyProject')
|
|
159
|
+
// const { runInstall, installDBDriver } = require("./lib/utils");
|
|
160
|
+
// const setupMainDB = require("./lib/setupMainDB");
|
|
161
|
+
// const setupExtraDB = require("./lib/setupExtraDB");
|
|
162
|
+
// const testDBConnection = require("./lib/testDBConnection");
|
|
163
|
+
// const { mainPrompts, extraDBPrompts } = require("./lib/prompts");
|
|
164
|
+
|
|
165
|
+
// const fs = require("fs-extra");
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
// // Resolve template folder dynamically
|
|
169
|
+
// let templateDir;
|
|
170
|
+
|
|
171
|
+
// // Try __dirname first (works for local/dev)
|
|
172
|
+
// const localTemplate = path.resolve(__dirname, "template");
|
|
173
|
+
// console.log("š Checking local template:", localTemplate);
|
|
174
|
+
|
|
175
|
+
// if (fs.existsSync(localTemplate)) {
|
|
176
|
+
// templateDir = localTemplate;
|
|
177
|
+
// console.log("ā
Found local template");
|
|
178
|
+
// } else {
|
|
179
|
+
// // Fallback for npx (temp folder)
|
|
180
|
+
// try {
|
|
181
|
+
// const pkg = require.resolve("create-fullstack-boilerplate/package.json");
|
|
182
|
+
// templateDir = path.resolve(path.dirname(pkg), "template");
|
|
183
|
+
// console.log("ā
Found npm template:", templateDir);
|
|
184
|
+
// } catch (err) {
|
|
185
|
+
// console.error("ā Could not resolve package:", err.message);
|
|
186
|
+
// }
|
|
187
|
+
// }
|
|
188
|
+
|
|
189
|
+
// if (!templateDir || !fs.existsSync(templateDir)) {
|
|
190
|
+
// throw new Error(
|
|
191
|
+
// `Template folder not found!\nSearched: ${localTemplate}\nMake sure 'template' is included in package.json 'files' field.`
|
|
192
|
+
// );
|
|
193
|
+
// }
|
|
194
|
+
|
|
195
|
+
// console.log("ā
Using template folder:", templateDir);
|
|
196
|
+
|
|
197
|
+
// console.log("=== DEBUG INFO ===");
|
|
198
|
+
// console.log("Current directory:", process.cwd());
|
|
199
|
+
// console.log("Template directory:", templateDir);
|
|
200
|
+
// console.log("Template exists:", fs.existsSync(templateDir));
|
|
201
|
+
// if (fs.existsSync(templateDir)) {
|
|
202
|
+
// console.log("Template contents:", fs.readdirSync(templateDir));
|
|
203
|
+
// }
|
|
204
|
+
// console.log("==================");
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
// try {
|
|
208
|
+
// console.log("\nšļø Setting Up Full Stack Project...\n");
|
|
209
|
+
|
|
210
|
+
// const answers = await mainPrompts();
|
|
211
|
+
// const targetDir = path.join(process.cwd(), answers.projectName);
|
|
212
|
+
|
|
213
|
+
// console.log("Target directory:", targetDir);
|
|
214
|
+
|
|
215
|
+
// // Remove the IIFE wrapper and just await directly
|
|
216
|
+
// try {
|
|
217
|
+
// console.log("š Copying project files...");
|
|
218
|
+
// await copyProject(templateDir, targetDir);
|
|
219
|
+
// console.log("ā
Project copied successfully");
|
|
220
|
+
// } catch (err) {
|
|
221
|
+
// console.error("ā Failed to copy project files:", err.message);
|
|
222
|
+
// throw err; // Re-throw to stop execution
|
|
223
|
+
// }
|
|
224
|
+
|
|
225
|
+
// await setupMainDB(targetDir, answers.dbDialect);
|
|
226
|
+
// console.log("ā”ļø Installing backend dependencies...");
|
|
227
|
+
// await runInstall(path.join(targetDir, "Backend"));
|
|
228
|
+
|
|
229
|
+
// console.log("ā”ļø Installing frontend dependencies...");
|
|
230
|
+
// await runInstall(path.join(targetDir, "Frontend"));
|
|
231
|
+
|
|
232
|
+
// console.log("ā”ļø Installing Your Db Dialect: ", answers.dbDialect)
|
|
233
|
+
// await installDBDriver(path.join(targetDir, "Backend"), answers.dbDialect);
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
// if (answers.addExtraDB) {
|
|
237
|
+
// const extraDB = await extraDBPrompts();
|
|
238
|
+
// console.log(`\nš Testing connection for ${extraDB.dbKey}...`);
|
|
239
|
+
// await installDBDriver(path.join(targetDir, "Backend"), extraDB.dialect);
|
|
240
|
+
// const ok = await testDBConnection(targetDir, extraDB);
|
|
241
|
+
|
|
242
|
+
// if (ok) {
|
|
243
|
+
// await setupExtraDB(targetDir, extraDB);
|
|
244
|
+
// console.log(`ā
Extra DB '${extraDB.dbKey}' successfully integrated.\n`);
|
|
245
|
+
// } else {
|
|
246
|
+
// console.log(`ā ļø Connection failed. Skipping extra DB setup.\n`);
|
|
247
|
+
// }
|
|
248
|
+
// }
|
|
249
|
+
|
|
250
|
+
// if (answers.initGit) {
|
|
251
|
+
// try {
|
|
252
|
+
// const execa = require("execa").execa || require("execa");
|
|
253
|
+
// await execa("git", ["init"], { cwd: targetDir });
|
|
254
|
+
// if (answers.remoteRepo) {
|
|
255
|
+
// await execa("git", ["remote", "add", "origin", answers.remoteRepo], { cwd: targetDir });
|
|
256
|
+
// }
|
|
257
|
+
// console.log("ā
Git initialized.\n");
|
|
258
|
+
// } catch (gitErr) {
|
|
259
|
+
// console.log(`ā ļø Git initialization failed: ${gitErr.message}`);
|
|
260
|
+
// console.log(` You can initialize git manually later.\n`);
|
|
261
|
+
// }
|
|
262
|
+
// }
|
|
263
|
+
|
|
264
|
+
// console.log(`\nš Project Ready!`);
|
|
265
|
+
// console.log(`\nā”ļø Next Steps:`);
|
|
266
|
+
// console.log(` cd ${answers.projectName}`);
|
|
267
|
+
// console.log(` cd backend && npm run dev`);
|
|
268
|
+
// console.log(` cd ../frontend && npm run dev\n`);
|
|
269
|
+
// } catch (err) {
|
|
270
|
+
// console.error(`\nā Error creating project: ${err.message}\n`);
|
|
271
|
+
// if (err.stack && process.env.DEBUG) {
|
|
272
|
+
// console.error(err.stack);
|
|
273
|
+
// }
|
|
274
|
+
// process.exit(1);
|
|
275
|
+
// }
|
|
276
|
+
// })();
|
package/lib/copyProject.js
CHANGED
|
@@ -1,12 +1,42 @@
|
|
|
1
1
|
const path = require("path");
|
|
2
2
|
const fs = require("fs-extra");
|
|
3
|
+
const { normalizePath } = require("./utils"); // IMPORT THIS
|
|
3
4
|
|
|
4
5
|
module.exports = async function copyProject(src, dest) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
10
|
-
console.log("ā
Files copied successfully.");
|
|
11
|
-
}
|
|
6
|
+
try {
|
|
7
|
+
// Use normalizePath for consistent path handling
|
|
8
|
+
const resolvedSrc = normalizePath(path.resolve(src));
|
|
9
|
+
const resolvedDest = normalizePath(path.resolve(dest));
|
|
12
10
|
|
|
11
|
+
if (!await fs.pathExists(resolvedSrc)) {
|
|
12
|
+
throw new Error(`Source template directory not found: ${resolvedSrc}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (await fs.pathExists(resolvedDest)) {
|
|
16
|
+
throw new Error(`Destination directory already exists: ${resolvedDest}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
console.log(`š Copying from: ${resolvedSrc}`);
|
|
20
|
+
console.log(`š Copying to: ${resolvedDest}`);
|
|
21
|
+
|
|
22
|
+
await fs.copy(resolvedSrc, resolvedDest, {
|
|
23
|
+
overwrite: false,
|
|
24
|
+
errorOnExist: false,
|
|
25
|
+
filter: (srcPath) => {
|
|
26
|
+
const normalizedPath = normalizePath(srcPath); // NORMALIZE HERE TOO
|
|
27
|
+
const shouldCopy = !normalizedPath.includes("node_modules");
|
|
28
|
+
return shouldCopy;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Verify the copy was successful
|
|
33
|
+
if (!await fs.pathExists(resolvedDest)) {
|
|
34
|
+
throw new Error("Copy operation completed but destination directory not found");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
console.log("ā
Files copied successfully.");
|
|
38
|
+
} catch (err) {
|
|
39
|
+
console.error("ā Copy operation failed:", err.message);
|
|
40
|
+
throw err;
|
|
41
|
+
}
|
|
42
|
+
}
|
package/lib/utils.js
CHANGED
|
@@ -1,15 +1,130 @@
|
|
|
1
|
-
//
|
|
1
|
+
// const fs = require("fs-extra");
|
|
2
|
+
// const path = require("path");
|
|
3
|
+
// const execa = require("execa");
|
|
4
|
+
|
|
5
|
+
// // ------------------ Logging ------------------
|
|
6
|
+
// function log(step) {
|
|
7
|
+
// console.log(`\nā”ļø ${step}`);
|
|
8
|
+
// }
|
|
9
|
+
|
|
10
|
+
// // ------------------ Replace in Files ------------------
|
|
11
|
+
// async function replaceInFiles(base, replacements) {
|
|
12
|
+
// const exts = [".js", ".ts", ".json", ".md", ".env", ".yml"];
|
|
13
|
+
|
|
14
|
+
// async function walk(dir) {
|
|
15
|
+
// // Check if directory exists
|
|
16
|
+
// if (!await fs.pathExists(dir)) {
|
|
17
|
+
// console.warn(`Warning: Directory ${dir} does not exist, skipping...`);
|
|
18
|
+
// return;
|
|
19
|
+
// }
|
|
20
|
+
|
|
21
|
+
// let items;
|
|
22
|
+
// try {
|
|
23
|
+
// items = await fs.readdir(dir);
|
|
24
|
+
// } catch (err) {
|
|
25
|
+
// console.warn(`Warning: Could not read directory ${dir}: ${err.message}`);
|
|
26
|
+
// return;
|
|
27
|
+
// }
|
|
28
|
+
|
|
29
|
+
// for (const item of items) {
|
|
30
|
+
// const fullPath = path.join(dir, item);
|
|
31
|
+
// try {
|
|
32
|
+
// const stat = await fs.stat(fullPath);
|
|
33
|
+
// if (stat.isDirectory()) {
|
|
34
|
+
// await walk(fullPath);
|
|
35
|
+
// } else if (exts.includes(path.extname(fullPath))) {
|
|
36
|
+
// let data = await fs.readFile(fullPath, "utf8");
|
|
37
|
+
// for (const [k, v] of Object.entries(replacements)) {
|
|
38
|
+
// data = data.replaceAll(k, v);
|
|
39
|
+
// }
|
|
40
|
+
// await fs.writeFile(fullPath, data);
|
|
41
|
+
// }
|
|
42
|
+
// } catch (err) {
|
|
43
|
+
// console.warn(`Warning: Error processing ${fullPath}: ${err.message}`);
|
|
44
|
+
// }
|
|
45
|
+
// }
|
|
46
|
+
// }
|
|
47
|
+
|
|
48
|
+
// await walk(base);
|
|
49
|
+
// }
|
|
50
|
+
|
|
51
|
+
// // ------------------ Ensure Directory ------------------
|
|
52
|
+
// async function ensureDir(dir) {
|
|
53
|
+
// await fs.ensureDir(dir);
|
|
54
|
+
// }
|
|
55
|
+
|
|
56
|
+
// // ------------------ Assert Dependency ------------------
|
|
57
|
+
// function assertDependency(depName, cwd) {
|
|
2
58
|
// try {
|
|
3
|
-
// return require(
|
|
4
|
-
// } catch (
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
59
|
+
// return require(path.join(cwd, "node_modules", depName));
|
|
60
|
+
// } catch (err) {
|
|
61
|
+
// throw new Error(
|
|
62
|
+
// `Dependency '${depName}' is not installed in ${cwd}.\n` +
|
|
63
|
+
// `Run: cd ${cwd} && npm install ${depName}`
|
|
64
|
+
// );
|
|
8
65
|
// }
|
|
9
66
|
// }
|
|
10
67
|
|
|
68
|
+
// // ------------------ Run npm install ------------------
|
|
69
|
+
// async function runInstall(cwd) {
|
|
70
|
+
// // Normalize path for Windows
|
|
71
|
+
// const normalizedCwd = path.normalize(cwd);
|
|
72
|
+
|
|
73
|
+
// // Verify directory exists
|
|
74
|
+
// if (!await fs.pathExists(normalizedCwd)) {
|
|
75
|
+
// throw new Error(`Directory does not exist: ${normalizedCwd}`);
|
|
76
|
+
// }
|
|
77
|
+
|
|
78
|
+
// try {
|
|
79
|
+
// await execa("npm", ["install"], {
|
|
80
|
+
// cwd: normalizedCwd,
|
|
81
|
+
// stdio: "inherit",
|
|
82
|
+
// shell: true // Use shell for Windows compatibility
|
|
83
|
+
// });
|
|
84
|
+
// } catch (err) {
|
|
85
|
+
// throw new Error(`npm install failed in ${normalizedCwd}: ${err.message}`);
|
|
86
|
+
// }
|
|
87
|
+
// }
|
|
11
88
|
|
|
89
|
+
// // ------------------ Installing Dynamic DB Drivers ----------------
|
|
12
90
|
|
|
91
|
+
// async function installDBDriver(targetDir, dialect) {
|
|
92
|
+
// let pkg;
|
|
93
|
+
// if (dialect === "mariadb") pkg = "mariadb";
|
|
94
|
+
// if (dialect === "mysql") pkg = "mysql2";
|
|
95
|
+
// if (dialect === "postgres") pkg = "pg";
|
|
96
|
+
// if (!pkg) return;
|
|
97
|
+
|
|
98
|
+
// // Normalize path for Windows
|
|
99
|
+
// const normalizedDir = path.normalize(targetDir);
|
|
100
|
+
|
|
101
|
+
// console.log(`ā”ļø Installing ${pkg}...`);
|
|
102
|
+
// try {
|
|
103
|
+
// await execa("npm", ["install", pkg], {
|
|
104
|
+
// cwd: normalizedDir,
|
|
105
|
+
// stdio: "inherit",
|
|
106
|
+
// shell: true // Use shell for Windows compatibility
|
|
107
|
+
// });
|
|
108
|
+
// } catch (err) {
|
|
109
|
+
// console.warn(`Warning: Failed to install ${pkg}: ${err.message}`);
|
|
110
|
+
// }
|
|
111
|
+
// }
|
|
112
|
+
|
|
113
|
+
// // Add this function to utils.js
|
|
114
|
+
// function normalizePath(p) {
|
|
115
|
+
// return path.normalize(p).replace(/\\/g, '/');
|
|
116
|
+
// }
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
// module.exports = {
|
|
120
|
+
// log,
|
|
121
|
+
// replaceInFiles,
|
|
122
|
+
// ensureDir,
|
|
123
|
+
// assertDependency,
|
|
124
|
+
// runInstall,
|
|
125
|
+
// installDBDriver,
|
|
126
|
+
// normalizePath
|
|
127
|
+
// };
|
|
13
128
|
|
|
14
129
|
|
|
15
130
|
const fs = require("fs-extra");
|
|
@@ -21,6 +136,11 @@ function log(step) {
|
|
|
21
136
|
console.log(`\nā”ļø ${step}`);
|
|
22
137
|
}
|
|
23
138
|
|
|
139
|
+
// ------------------ Normalize Path (Windows compatible) ------------------
|
|
140
|
+
function normalizePath(p) {
|
|
141
|
+
return path.normalize(p).replace(/\\/g, '/');
|
|
142
|
+
}
|
|
143
|
+
|
|
24
144
|
// ------------------ Replace in Files ------------------
|
|
25
145
|
async function replaceInFiles(base, replacements) {
|
|
26
146
|
const exts = [".js", ".ts", ".json", ".md", ".env", ".yml"];
|
|
@@ -83,12 +203,12 @@ function assertDependency(depName, cwd) {
|
|
|
83
203
|
async function runInstall(cwd) {
|
|
84
204
|
// Normalize path for Windows
|
|
85
205
|
const normalizedCwd = path.normalize(cwd);
|
|
86
|
-
|
|
206
|
+
|
|
87
207
|
// Verify directory exists
|
|
88
208
|
if (!await fs.pathExists(normalizedCwd)) {
|
|
89
209
|
throw new Error(`Directory does not exist: ${normalizedCwd}`);
|
|
90
210
|
}
|
|
91
|
-
|
|
211
|
+
|
|
92
212
|
try {
|
|
93
213
|
await execa("npm", ["install"], {
|
|
94
214
|
cwd: normalizedCwd,
|
|
@@ -101,7 +221,6 @@ async function runInstall(cwd) {
|
|
|
101
221
|
}
|
|
102
222
|
|
|
103
223
|
// ------------------ Installing Dynamic DB Drivers ----------------
|
|
104
|
-
|
|
105
224
|
async function installDBDriver(targetDir, dialect) {
|
|
106
225
|
let pkg;
|
|
107
226
|
if (dialect === "mariadb") pkg = "mariadb";
|
|
@@ -111,11 +230,11 @@ async function installDBDriver(targetDir, dialect) {
|
|
|
111
230
|
|
|
112
231
|
// Normalize path for Windows
|
|
113
232
|
const normalizedDir = path.normalize(targetDir);
|
|
114
|
-
|
|
233
|
+
|
|
115
234
|
console.log(`ā”ļø Installing ${pkg}...`);
|
|
116
235
|
try {
|
|
117
|
-
await execa("npm", ["install", pkg], {
|
|
118
|
-
cwd: normalizedDir,
|
|
236
|
+
await execa("npm", ["install", pkg], {
|
|
237
|
+
cwd: normalizedDir,
|
|
119
238
|
stdio: "inherit",
|
|
120
239
|
shell: true // Use shell for Windows compatibility
|
|
121
240
|
});
|
|
@@ -124,12 +243,12 @@ async function installDBDriver(targetDir, dialect) {
|
|
|
124
243
|
}
|
|
125
244
|
}
|
|
126
245
|
|
|
127
|
-
|
|
128
246
|
module.exports = {
|
|
129
247
|
log,
|
|
130
248
|
replaceInFiles,
|
|
131
249
|
ensureDir,
|
|
132
250
|
assertDependency,
|
|
133
251
|
runInstall,
|
|
134
|
-
installDBDriver
|
|
135
|
-
|
|
252
|
+
installDBDriver,
|
|
253
|
+
normalizePath // ADD THIS
|
|
254
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-fullstack-boilerplate",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.9",
|
|
4
4
|
"description": "A Full Stack Application Comprised of React for Frontend, Express & Sequelize with Node js for Backend to help developers get started on real implementation instead of spending time setting up projects.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|