netcore-blueprint 1.0.20 → 1.0.22
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 +19 -0
- package/package.json +1 -1
package/create.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
|
+
const { execSync } = require('child_process'); // ✅ Fix: Import execSync
|
|
5
6
|
|
|
6
7
|
// Get the project name from command-line arguments
|
|
7
8
|
const projectName = process.argv[2];
|
|
@@ -54,3 +55,21 @@ fs.readdirSync(templatePath).forEach(item => {
|
|
|
54
55
|
|
|
55
56
|
console.log(`🎉 Project "${projectName}" created successfully at ${destinationPath}`);
|
|
56
57
|
console.log(`📌 Open "${projectName}.sln" in Visual Studio to get started!`);
|
|
58
|
+
|
|
59
|
+
// Initialize Git and commit the first commit
|
|
60
|
+
try {
|
|
61
|
+
process.chdir(destinationPath); // Move into project directory
|
|
62
|
+
|
|
63
|
+
console.log("🚀 Initializing Git repository...");
|
|
64
|
+
execSync('git init', { stdio: 'inherit' });
|
|
65
|
+
|
|
66
|
+
console.log("📂 Adding all files...");
|
|
67
|
+
execSync('git add .', { stdio: 'inherit' });
|
|
68
|
+
|
|
69
|
+
console.log("✅ Creating first commit...");
|
|
70
|
+
execSync('git commit -m "Initial commit from netcore-blueprint"', { stdio: 'inherit' });
|
|
71
|
+
|
|
72
|
+
console.log("🎉 Git repository initialized successfully!");
|
|
73
|
+
} catch (error) {
|
|
74
|
+
console.error("❌ Failed to initialize Git:", error);
|
|
75
|
+
}
|