netcore-blueprint 1.0.0 → 1.0.1
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/.gitignore +12 -0
- package/index.js +20 -13
- package/package.json +9 -4
package/.gitignore
ADDED
package/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
1
|
const fs = require("fs");
|
|
4
2
|
const path = require("path");
|
|
5
3
|
|
|
@@ -9,24 +7,33 @@ if (!projectName) {
|
|
|
9
7
|
process.exit(1);
|
|
10
8
|
}
|
|
11
9
|
|
|
12
|
-
// Define paths
|
|
13
|
-
const templatePath = path.join(__dirname, "../"); // Root of the template
|
|
14
10
|
const destinationPath = path.join(process.cwd(), projectName);
|
|
11
|
+
const templateFolders = ["MainProject", "WorkerProject1", "WorkerProject2"];
|
|
15
12
|
|
|
16
|
-
function
|
|
13
|
+
function copyFolder(src, dest) {
|
|
17
14
|
fs.mkdirSync(dest, { recursive: true });
|
|
18
|
-
fs.readdirSync(src
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
16
|
+
|
|
17
|
+
for (let entry of entries) {
|
|
18
|
+
const srcPath = path.join(src, entry.name);
|
|
19
|
+
const destPath = path.join(dest, entry.name);
|
|
20
|
+
|
|
21
|
+
if (entry.isDirectory()) {
|
|
22
|
+
copyFolder(srcPath, destPath);
|
|
23
23
|
} else {
|
|
24
24
|
fs.copyFileSync(srcPath, destPath);
|
|
25
25
|
}
|
|
26
|
-
}
|
|
26
|
+
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
//
|
|
30
|
-
|
|
29
|
+
// Create the destination directory
|
|
30
|
+
fs.mkdirSync(destinationPath, { recursive: true });
|
|
31
|
+
|
|
32
|
+
// Copy each template folder into the new project directory
|
|
33
|
+
templateFolders.forEach(folder => {
|
|
34
|
+
const srcFolderPath = path.join(__dirname, folder);
|
|
35
|
+
const destFolderPath = path.join(destinationPath, folder);
|
|
36
|
+
copyFolder(srcFolderPath, destFolderPath);
|
|
37
|
+
});
|
|
31
38
|
|
|
32
39
|
console.log(`Project ${projectName} 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.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"description": "",
|
|
12
12
|
"bin": {
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
13
|
+
"truongdx8-netcore-blueprint": "./index.js"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"index.js",
|
|
17
|
+
"MainProject",
|
|
18
|
+
".gitignore"
|
|
19
|
+
]
|
|
20
|
+
}
|