create-fullstack-boilerplate 2.1.9 → 2.1.10
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 +30 -10
- package/package.json +1 -1
package/lib/copyProject.js
CHANGED
|
@@ -1,39 +1,59 @@
|
|
|
1
1
|
const path = require("path");
|
|
2
2
|
const fs = require("fs-extra");
|
|
3
|
-
const { normalizePath } = require("./utils");
|
|
3
|
+
const { normalizePath } = require("./utils");
|
|
4
4
|
|
|
5
5
|
module.exports = async function copyProject(src, dest) {
|
|
6
6
|
try {
|
|
7
|
-
// Use normalizePath for
|
|
8
|
-
const resolvedSrc =
|
|
9
|
-
const resolvedDest =
|
|
7
|
+
// Use path.resolve without normalizePath for fs operations
|
|
8
|
+
const resolvedSrc = path.resolve(src);
|
|
9
|
+
const resolvedDest = path.resolve(dest);
|
|
10
10
|
|
|
11
|
+
console.log(`📁 Copying from: ${resolvedSrc}`);
|
|
12
|
+
console.log(`📁 Copying to: ${resolvedDest}`);
|
|
13
|
+
|
|
14
|
+
// Check source exists
|
|
11
15
|
if (!await fs.pathExists(resolvedSrc)) {
|
|
12
16
|
throw new Error(`Source template directory not found: ${resolvedSrc}`);
|
|
13
17
|
}
|
|
14
18
|
|
|
19
|
+
// Check if destination already exists
|
|
15
20
|
if (await fs.pathExists(resolvedDest)) {
|
|
16
21
|
throw new Error(`Destination directory already exists: ${resolvedDest}`);
|
|
17
22
|
}
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
console.log(`📁 Copying to: ${resolvedDest}`);
|
|
21
|
-
|
|
24
|
+
// Perform the copy
|
|
22
25
|
await fs.copy(resolvedSrc, resolvedDest, {
|
|
23
26
|
overwrite: false,
|
|
24
27
|
errorOnExist: false,
|
|
25
28
|
filter: (srcPath) => {
|
|
26
|
-
|
|
27
|
-
const
|
|
29
|
+
// Don't skip node_modules using includes, use a more reliable check
|
|
30
|
+
const relativePath = path.relative(resolvedSrc, srcPath);
|
|
31
|
+
const shouldCopy = !relativePath.split(path.sep).includes("node_modules");
|
|
28
32
|
return shouldCopy;
|
|
29
33
|
}
|
|
30
34
|
});
|
|
31
35
|
|
|
36
|
+
console.log("📁 Copy operation completed, verifying...");
|
|
37
|
+
|
|
38
|
+
// Add a small delay to ensure filesystem sync (especially on Windows)
|
|
39
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
40
|
+
|
|
32
41
|
// Verify the copy was successful
|
|
33
|
-
|
|
42
|
+
const destExists = await fs.pathExists(resolvedDest);
|
|
43
|
+
console.log(`📁 Destination exists: ${destExists}`);
|
|
44
|
+
|
|
45
|
+
if (!destExists) {
|
|
34
46
|
throw new Error("Copy operation completed but destination directory not found");
|
|
35
47
|
}
|
|
36
48
|
|
|
49
|
+
// Verify contents were copied
|
|
50
|
+
const destContents = await fs.readdir(resolvedDest);
|
|
51
|
+
console.log(`📁 Destination contents: ${destContents.join(", ")}`);
|
|
52
|
+
|
|
53
|
+
if (destContents.length === 0) {
|
|
54
|
+
throw new Error("Destination directory is empty after copy");
|
|
55
|
+
}
|
|
56
|
+
|
|
37
57
|
console.log("✅ Files copied successfully.");
|
|
38
58
|
} catch (err) {
|
|
39
59
|
console.error("❌ Copy operation failed:", err.message);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-fullstack-boilerplate",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.10",
|
|
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": {
|