netcore-blueprint 1.0.9 → 1.0.11
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/create.js +25 -4
- package/package.json +1 -1
package/create.js
CHANGED
|
@@ -32,9 +32,9 @@ function copyAndRename(src, dest) {
|
|
|
32
32
|
} else {
|
|
33
33
|
let content = fs.readFileSync(src, 'utf8');
|
|
34
34
|
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
content = content.replace(
|
|
35
|
+
// Replace "Blueprint" with the new project name (case-insensitive)
|
|
36
|
+
const regex = new RegExp("Blueprint", "gi");
|
|
37
|
+
content = content.replace(regex, projectName);
|
|
38
38
|
|
|
39
39
|
fs.writeFileSync(dest, content);
|
|
40
40
|
}
|
|
@@ -48,7 +48,7 @@ if (fs.existsSync(destinationPath)) {
|
|
|
48
48
|
|
|
49
49
|
fs.mkdirSync(destinationPath, { recursive: true });
|
|
50
50
|
|
|
51
|
-
// Copy template files
|
|
51
|
+
// Copy and rename template files
|
|
52
52
|
templateItems.forEach(item => {
|
|
53
53
|
const srcPath = path.join(__dirname, item);
|
|
54
54
|
let destPath = path.join(destinationPath, item);
|
|
@@ -66,4 +66,25 @@ templateItems.forEach(item => {
|
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
+
// Rename Directories & Solution File
|
|
70
|
+
const renameItems = [
|
|
71
|
+
{ old: "Blueprint.API", new: `${projectName}.API` },
|
|
72
|
+
{ old: "Blueprint.Core", new: `${projectName}.Core` },
|
|
73
|
+
{ old: "Blueprint.Infra", new: `${projectName}.Infra` },
|
|
74
|
+
{ old: "Blueprint.Test", new: `${projectName}.Test` },
|
|
75
|
+
{ old: "Blueprint.API.sln", new: `${projectName}.sln` }
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
renameItems.forEach(({ old, new: newName }) => {
|
|
79
|
+
const oldPath = path.join(destinationPath, old);
|
|
80
|
+
const newPath = path.join(destinationPath, newName);
|
|
81
|
+
|
|
82
|
+
if (fs.existsSync(oldPath)) {
|
|
83
|
+
fs.renameSync(oldPath, newPath);
|
|
84
|
+
console.log(`🔄 Renamed ${old} -> ${newName}`);
|
|
85
|
+
} else {
|
|
86
|
+
console.warn(`⚠️ Warning: ${old} not found.`);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
69
90
|
console.log(`🎉 Project "${projectName}" created successfully at ${destinationPath}`);
|