create-fullstack-boilerplate 2.1.2 → 2.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/index.js +4 -4
- package/lib/addDB.js +1 -1
- package/lib/addRoute.js +1 -1
- package/lib/copyProject.js +9 -24
- package/lib/setupExtraDB.js +1 -1
- package/lib/setupMainDB.js +1 -1
- package/lib/testDBConnection.js +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -58,19 +58,19 @@
|
|
|
58
58
|
await copyProject(templateDir, targetDir);
|
|
59
59
|
await setupMainDB(targetDir, answers.dbDialect);
|
|
60
60
|
console.log("➡️ Installing backend dependencies...");
|
|
61
|
-
await runInstall(path.join(targetDir, "
|
|
61
|
+
await runInstall(path.join(targetDir, "Backend"));
|
|
62
62
|
|
|
63
63
|
console.log("➡️ Installing frontend dependencies...");
|
|
64
|
-
await runInstall(path.join(targetDir, "
|
|
64
|
+
await runInstall(path.join(targetDir, "Frontend"));
|
|
65
65
|
|
|
66
66
|
console.log("➡️ Installing Your Db Dialect: ", answers.dbDialect)
|
|
67
|
-
await installDBDriver(path.join(targetDir, "
|
|
67
|
+
await installDBDriver(path.join(targetDir, "Backend"), answers.dbDialect);
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
if (answers.addExtraDB) {
|
|
71
71
|
const extraDB = await extraDBPrompts();
|
|
72
72
|
console.log(`\n🔍 Testing connection for ${extraDB.dbKey}...`);
|
|
73
|
-
await installDBDriver(path.join(targetDir, "
|
|
73
|
+
await installDBDriver(path.join(targetDir, "Backend"), extraDB.dialect);
|
|
74
74
|
const ok = await testDBConnection(targetDir, extraDB);
|
|
75
75
|
|
|
76
76
|
if (ok) {
|
package/lib/addDB.js
CHANGED
|
@@ -11,7 +11,7 @@ module.exports = async function addDB() {
|
|
|
11
11
|
console.log(`\n➕ Add New Database to Existing Project\n`);
|
|
12
12
|
|
|
13
13
|
const targetDir = process.cwd();
|
|
14
|
-
const backendDir = path.join(targetDir, "
|
|
14
|
+
const backendDir = path.join(targetDir, "Backend");
|
|
15
15
|
const dbDir = path.join(backendDir, "DB");
|
|
16
16
|
const modelsDir = path.join(backendDir, "Models");
|
|
17
17
|
|
package/lib/addRoute.js
CHANGED
|
@@ -9,7 +9,7 @@ module.exports = async function addRoute() {
|
|
|
9
9
|
console.log(`\n➕ Add New Route to Backend\n`);
|
|
10
10
|
|
|
11
11
|
const targetDir = process.cwd();
|
|
12
|
-
const backendDir = path.join(targetDir, "
|
|
12
|
+
const backendDir = path.join(targetDir, "Backend");
|
|
13
13
|
const routesDir = path.join(backendDir, "routes");
|
|
14
14
|
const servicesDir = path.join(backendDir, "services");
|
|
15
15
|
|
package/lib/copyProject.js
CHANGED
|
@@ -3,47 +3,32 @@ const fs = require("fs-extra");
|
|
|
3
3
|
const path = require("path");
|
|
4
4
|
|
|
5
5
|
module.exports = async function copyProject(src, dest) {
|
|
6
|
-
// Normalize paths to handle Windows paths with spaces
|
|
7
|
-
const normalizedSrc = path.normalize(src);
|
|
8
|
-
const normalizedDest = path.normalize(dest);
|
|
9
|
-
|
|
10
6
|
// Check if destination already exists
|
|
11
|
-
if (await fs.pathExists(
|
|
12
|
-
throw new Error(`Directory '${path.basename(
|
|
7
|
+
if (await fs.pathExists(dest)) {
|
|
8
|
+
throw new Error(`Directory '${path.basename(dest)}' already exists. Please choose a different project name.`);
|
|
13
9
|
}
|
|
14
10
|
|
|
15
11
|
// Check if source template exists
|
|
16
|
-
if (!await fs.pathExists(
|
|
17
|
-
throw new Error(`Template directory not found at: ${
|
|
12
|
+
if (!await fs.pathExists(src)) {
|
|
13
|
+
throw new Error(`Template directory not found at: ${src}`);
|
|
18
14
|
}
|
|
19
15
|
|
|
20
16
|
log("Creating project directory...");
|
|
21
17
|
|
|
22
18
|
try {
|
|
23
|
-
//
|
|
24
|
-
await fs.
|
|
25
|
-
|
|
26
|
-
// Copy with error handling
|
|
27
|
-
await fs.copy(normalizedSrc, normalizedDest, {
|
|
28
|
-
overwrite: false,
|
|
29
|
-
errorOnExist: false,
|
|
30
|
-
filter: (item) => {
|
|
19
|
+
// Copy entire template directory (Backend and Frontend folders will be copied with their exact names)
|
|
20
|
+
await fs.copy(src, dest, {
|
|
21
|
+
filter: (srcPath) => {
|
|
31
22
|
// Filter out node_modules
|
|
32
|
-
return !
|
|
23
|
+
return !srcPath.includes("node_modules");
|
|
33
24
|
}
|
|
34
25
|
});
|
|
35
26
|
|
|
36
|
-
// Verify the copy was successful by checking if backend exists
|
|
37
|
-
const backendPath = path.join(normalizedDest, "backend");
|
|
38
|
-
if (!await fs.pathExists(backendPath)) {
|
|
39
|
-
throw new Error(`Copy verification failed: backend folder not found at ${backendPath}`);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
27
|
console.log("✅ Files copied successfully.");
|
|
43
28
|
} catch (err) {
|
|
44
29
|
// Clean up on failure
|
|
45
30
|
try {
|
|
46
|
-
await fs.remove(
|
|
31
|
+
await fs.remove(dest);
|
|
47
32
|
} catch (cleanupErr) {
|
|
48
33
|
// Ignore cleanup errors
|
|
49
34
|
}
|
package/lib/setupExtraDB.js
CHANGED
|
@@ -5,7 +5,7 @@ const fs = require("fs-extra"); // no assert needed
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
module.exports = async function setupExtraDB(targetDir, dbConfig) {
|
|
8
|
-
const backendDir = path.join(targetDir, "
|
|
8
|
+
const backendDir = path.join(targetDir, "Backend");
|
|
9
9
|
const modelsDir = path.join(backendDir, "Models");
|
|
10
10
|
const dbDir = path.join(backendDir, "DB");
|
|
11
11
|
|
package/lib/setupMainDB.js
CHANGED
|
@@ -3,7 +3,7 @@ const path = require("path");
|
|
|
3
3
|
|
|
4
4
|
module.exports = async function setupMainDB(targetDir, dialect) {
|
|
5
5
|
log("Configuring main DB in backend...");
|
|
6
|
-
const backendDir = path.join(targetDir, "
|
|
6
|
+
const backendDir = path.join(targetDir, "Backend");
|
|
7
7
|
await replaceInFiles(backendDir, {
|
|
8
8
|
"__DB_DIALECT__": dialect
|
|
9
9
|
});
|
package/lib/testDBConnection.js
CHANGED
|
@@ -36,7 +36,7 @@ const path = require("path");
|
|
|
36
36
|
const { assertDependency } = require("./utils");
|
|
37
37
|
|
|
38
38
|
async function testDBConnection(targetDir, dbConfig) {
|
|
39
|
-
const backendDir = path.join(targetDir, "
|
|
39
|
+
const backendDir = path.join(targetDir, "Backend");
|
|
40
40
|
|
|
41
41
|
let driver;
|
|
42
42
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-fullstack-boilerplate",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
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": {
|