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.
Files changed (3) hide show
  1. package/.gitignore +12 -0
  2. package/index.js +20 -13
  3. package/package.json +9 -4
package/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ bin
2
+ obj
3
+ _nugetLib
4
+ /.vs
5
+ /.vscode
6
+ /debug.log
7
+
8
+ # Ignore all .cache files
9
+ *.cache
10
+
11
+ # Ignore all AssemblyInfo.cs files
12
+ **/AssemblyInfo.cs
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 copyTemplateFiles(src, dest) {
13
+ function copyFolder(src, dest) {
17
14
  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);
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
- // Copy everything from the template to the new project directory
30
- copyTemplateFiles(templatePath, destinationPath);
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.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
- "truongdx8-netcore-blueprint": "./index.js"
14
- }
15
- }
13
+ "truongdx8-netcore-blueprint": "./index.js"
14
+ },
15
+ "files": [
16
+ "index.js",
17
+ "MainProject",
18
+ ".gitignore"
19
+ ]
20
+ }