netcore-blueprint 1.0.0
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/index.js +32 -0
- package/package.json +15 -0
package/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
const projectName = process.argv[2];
|
|
7
|
+
if (!projectName) {
|
|
8
|
+
console.error("Please specify the project name.");
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Define paths
|
|
13
|
+
const templatePath = path.join(__dirname, "../"); // Root of the template
|
|
14
|
+
const destinationPath = path.join(process.cwd(), projectName);
|
|
15
|
+
|
|
16
|
+
function copyTemplateFiles(src, dest) {
|
|
17
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
18
|
+
fs.readdirSync(src).forEach((file) => {
|
|
19
|
+
const srcPath = path.join(src, file);
|
|
20
|
+
const destPath = path.join(dest, file);
|
|
21
|
+
if (fs.statSync(srcPath).isDirectory()) {
|
|
22
|
+
copyTemplateFiles(srcPath, destPath);
|
|
23
|
+
} else {
|
|
24
|
+
fs.copyFileSync(srcPath, destPath);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Copy everything from the template to the new project directory
|
|
30
|
+
copyTemplateFiles(templatePath, destinationPath);
|
|
31
|
+
|
|
32
|
+
console.log(`Project ${projectName} created at ${destinationPath}`);
|
package/package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "netcore-blueprint",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
7
|
+
},
|
|
8
|
+
"keywords": [],
|
|
9
|
+
"author": "",
|
|
10
|
+
"license": "ISC",
|
|
11
|
+
"description": "",
|
|
12
|
+
"bin": {
|
|
13
|
+
"truongdx8-netcore-blueprint": "./index.js"
|
|
14
|
+
}
|
|
15
|
+
}
|