create-fullstack-boilerplate 2.1.4 → 2.1.5
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/copyProject.js +11 -15
- package/package.json +2 -1
package/lib/copyProject.js
CHANGED
|
@@ -1,37 +1,33 @@
|
|
|
1
1
|
const { log } = require("./utils");
|
|
2
|
-
const fs = require("fs-extra");
|
|
2
|
+
// const fs = require("fs-extra"); // remove this line
|
|
3
|
+
const cpy = require("cpy"); // add this
|
|
3
4
|
const path = require("path");
|
|
5
|
+
const fs = require("fs-extra"); // still needed for pathExists/remove
|
|
4
6
|
|
|
5
7
|
module.exports = async function copyProject(src, dest) {
|
|
6
|
-
// Check if destination already exists
|
|
7
8
|
if (await fs.pathExists(dest)) {
|
|
8
9
|
throw new Error(`Directory '${path.basename(dest)}' already exists. Please choose a different project name.`);
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
// Check if source template exists
|
|
12
12
|
if (!await fs.pathExists(src)) {
|
|
13
13
|
throw new Error(`Template directory not found at: ${src}`);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
log("Creating project directory...");
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
try {
|
|
19
|
-
//
|
|
20
|
-
await
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
19
|
+
// Use cpy instead of fs.copy
|
|
20
|
+
await cpy("**/*", dest, {
|
|
21
|
+
cwd: src,
|
|
22
|
+
parents: true,
|
|
23
|
+
filter: (srcPath) => !srcPath.includes("node_modules")
|
|
25
24
|
});
|
|
26
|
-
|
|
25
|
+
|
|
27
26
|
console.log("✅ Files copied successfully.");
|
|
28
27
|
} catch (err) {
|
|
29
|
-
// Clean up on failure
|
|
30
28
|
try {
|
|
31
29
|
await fs.remove(dest);
|
|
32
|
-
} catch (
|
|
33
|
-
// Ignore cleanup errors
|
|
34
|
-
}
|
|
30
|
+
} catch (_) { }
|
|
35
31
|
throw new Error(`Failed to copy project files: ${err.message}`);
|
|
36
32
|
}
|
|
37
33
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-fullstack-boilerplate",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
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": {
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"app"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
+
"cpy": "^12.1.0",
|
|
35
36
|
"execa": "^5.1.1",
|
|
36
37
|
"fs-extra": "^11.3.2",
|
|
37
38
|
"inquirer": "^8.2.7"
|