netcore-blueprint 1.0.7 → 1.0.8
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/Blueprint.API.sln +4 -4
- package/README.md +0 -0
- package/create.js +25 -31
- package/package.json +1 -2
- package/.gitignore +0 -12
package/Blueprint.API.sln
CHANGED
|
@@ -3,13 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|
|
3
3
|
# Visual Studio Version 17
|
|
4
4
|
VisualStudioVersion = 17.10.35013.160
|
|
5
5
|
MinimumVisualStudioVersion = 10.0.40219.1
|
|
6
|
-
Project("{
|
|
6
|
+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blueprint.API", "Blueprint.API\Blueprint.API.csproj", "{69D89003-25CF-4E3A-9BEF-78F9247B24E1}"
|
|
7
7
|
EndProject
|
|
8
|
-
Project("{
|
|
8
|
+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blueprint.Core", "Blueprint.Core\Blueprint.Core.csproj", "{5E5F367C-FAD3-4254-8E88-D82D797E3731}"
|
|
9
9
|
EndProject
|
|
10
|
-
Project("{
|
|
10
|
+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blueprint.Infra", "Blueprint.Infra\Blueprint.Infra.csproj", "{83F3E527-28B2-4C5F-A265-E15E76530238}"
|
|
11
11
|
EndProject
|
|
12
|
-
Project("{
|
|
12
|
+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blueprint.Test", "Blueprint.Test\Blueprint.Test.csproj", "{A4F5B5E9-32D8-4C4D-AED1-E2D6A9083A2E}"
|
|
13
13
|
EndProject
|
|
14
14
|
Global
|
|
15
15
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
package/README.md
ADDED
|
File without changes
|
package/create.js
CHANGED
|
@@ -1,58 +1,52 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const fs = require(
|
|
4
|
-
const path = require(
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
5
|
|
|
6
6
|
const projectName = process.argv[2];
|
|
7
|
+
|
|
7
8
|
if (!projectName) {
|
|
8
9
|
console.error("❌ Please specify the project name.");
|
|
9
10
|
process.exit(1);
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function
|
|
13
|
+
const upperProjectName = projectName.toUpperCase();
|
|
14
|
+
const destinationPath = path.join(process.cwd(), upperProjectName);
|
|
15
|
+
|
|
16
|
+
// Define template folder and files to rename
|
|
17
|
+
const templateDir = path.join(__dirname, "template"); // Store your template inside a 'template' folder
|
|
18
|
+
const filesToRename = ["Blueprint.API.sln", "README.md"]; // Files that contain references to update
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Recursively copy directory contents and rename project references
|
|
22
|
+
*/
|
|
23
|
+
function copyAndRename(src, dest) {
|
|
23
24
|
if (fs.lstatSync(src).isDirectory()) {
|
|
24
25
|
fs.mkdirSync(dest, { recursive: true });
|
|
25
26
|
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
27
|
+
|
|
26
28
|
for (let entry of entries) {
|
|
27
29
|
const srcPath = path.join(src, entry.name);
|
|
28
|
-
const destPath = path.join(dest, entry.name);
|
|
29
|
-
|
|
30
|
+
const destPath = path.join(dest, entry.name.replace(/Blueprint/g, upperProjectName));
|
|
31
|
+
copyAndRename(srcPath, destPath);
|
|
30
32
|
}
|
|
31
33
|
} else {
|
|
32
|
-
fs.
|
|
34
|
+
let content = fs.readFileSync(src, "utf8");
|
|
35
|
+
content = content.replace(/Blueprint\.API/g, `${upperProjectName}.API`);
|
|
36
|
+
content = content.replace(/Blueprint/g, upperProjectName);
|
|
37
|
+
fs.writeFileSync(dest, content, "utf8");
|
|
33
38
|
}
|
|
34
39
|
}
|
|
35
40
|
|
|
36
41
|
// Ensure destination doesn't already exist
|
|
37
42
|
if (fs.existsSync(destinationPath)) {
|
|
38
|
-
console.error(`❌ Project directory "${
|
|
43
|
+
console.error(`❌ Project directory "${upperProjectName}" already exists.`);
|
|
39
44
|
process.exit(1);
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
fs.mkdirSync(destinationPath, { recursive: true });
|
|
43
48
|
|
|
44
|
-
// Copy template files
|
|
45
|
-
|
|
46
|
-
const srcPath = path.join(__dirname, item);
|
|
47
|
-
const destPath = path.join(destinationPath, item);
|
|
48
|
-
|
|
49
|
-
if (fs.existsSync(srcPath)) {
|
|
50
|
-
console.log(`✅ Copying ${item}...`);
|
|
51
|
-
copyItem(srcPath, destPath);
|
|
52
|
-
} else {
|
|
53
|
-
console.error(`❌ Critical error: "${srcPath}" does not exist.`);
|
|
54
|
-
process.exit(1);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
49
|
+
// Copy all template files and rename them dynamically
|
|
50
|
+
copyAndRename(templateDir, destinationPath);
|
|
57
51
|
|
|
58
|
-
console.log(`🎉 Project "${
|
|
52
|
+
console.log(`🎉 Project "${upperProjectName}" created at ${destinationPath}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netcore-blueprint",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "A custom .NET Core project blueprint",
|
|
5
5
|
"main": "create.js",
|
|
6
6
|
"bin": {
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"Blueprint.Core/**",
|
|
20
20
|
"Blueprint.Infra/**",
|
|
21
21
|
"Blueprint.Test/**",
|
|
22
|
-
".gitignore",
|
|
23
22
|
"README.md"
|
|
24
23
|
]
|
|
25
24
|
}
|