netcore-blueprint 1.0.10 → 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.
Files changed (2) hide show
  1. package/create.js +25 -7
  2. package/package.json +1 -1
package/create.js CHANGED
@@ -32,12 +32,9 @@ function copyAndRename(src, dest) {
32
32
  } else {
33
33
  let content = fs.readFileSync(src, 'utf8');
34
34
 
35
- // Ensure projectName follows PascalCase format
36
- const projectNamePascalCase = projectName.charAt(0).toUpperCase() + projectName.slice(1);
37
-
38
- // Replace "Blueprint.API" first, then "Blueprint" (case-insensitive)
39
- content = content.replace(/Blueprint\.API/gi, `${projectNamePascalCase}.API`);
40
- content = content.replace(/Blueprint/gi, projectNamePascalCase);
35
+ // Replace "Blueprint" with the new project name (case-insensitive)
36
+ const regex = new RegExp("Blueprint", "gi");
37
+ content = content.replace(regex, projectName);
41
38
 
42
39
  fs.writeFileSync(dest, content);
43
40
  }
@@ -51,7 +48,7 @@ if (fs.existsSync(destinationPath)) {
51
48
 
52
49
  fs.mkdirSync(destinationPath, { recursive: true });
53
50
 
54
- // Copy template files
51
+ // Copy and rename template files
55
52
  templateItems.forEach(item => {
56
53
  const srcPath = path.join(__dirname, item);
57
54
  let destPath = path.join(destinationPath, item);
@@ -69,4 +66,25 @@ templateItems.forEach(item => {
69
66
  }
70
67
  });
71
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
+
72
90
  console.log(`🎉 Project "${projectName}" created successfully at ${destinationPath}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "netcore-blueprint",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "A custom .NET Core project blueprint",
5
5
  "main": "create.js",
6
6
  "bin": {