netcore-blueprint 0.0.65 → 0.0.67

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.
@@ -0,0 +1,18 @@
1
+ How to use the app
2
+ 1. Tạo mới 1 module
3
+ - create-module ModuleName EntityName
4
+ - copy-module CopiedModuleName (Chỉnh sửa, sau đó cho vào thư mục cùng cấp với BlueprintTemplate)
5
+ - Thêm ref vào Host.API trong appsettings, mục "Modules" (Bật tắt qua đây)
6
+
7
+ 2. Bỏ module
8
+ - Xóa module
9
+ - Bỏ <Folder Name="/Modules/ProductModule/"> ở MyBlueprint.slnx
10
+ - Bỏ ProjectReference ở Host.API.csproj
11
+ - Bỏ ref ở Host.API trong appsettings
12
+
13
+ 3. Mock Data
14
+ - Tools → NuGet Package Manager → Package Manager Console
15
+ - Default project: catalog.Infra
16
+ - Xóa Migration cũ
17
+ - Add-Migration SeedInitialData
18
+ - Update-Database
@@ -12,6 +12,7 @@ namespace __MODULE__Module.API
12
12
  public class __MODULE__Module : IModule
13
13
  {
14
14
  public string Name => "__MODULE__";
15
+ public bool RequiresDatabase => true;
15
16
  public void Register(IServiceCollection services, IConfiguration config)
16
17
  {
17
18
  __MODULE__CoreDependencyInjection.AddModule(services);
package/README.md CHANGED
@@ -1,29 +1,8 @@
1
- How to make a blueprint
1
+ How to use the blueprint
2
2
  1. Use the lib from npm:
3
3
  - npm uninstall -g netcore-blueprint
4
4
  - npm install -g netcore-blueprint
5
5
  - npm list -g netcore-blueprint
6
6
  - create-app AppName (Sửa connection string)
7
- - create-module ModuleName EntityName
8
- - copy-module CopiedModuleName (Run in the folder Modules right outside the solution) (copy-module CopiedModuleName --force)
9
-
10
- 2. Tạo mới 1 module
11
- - create-module ModuleName EntityName
12
- - copy-module CopiedModuleName (Chỉnh sửa, sau đó cho vào thư mục cùng cấp với BlueprintTemplate)
13
- - Thêm ref vào Host.API trong appsettings, mục "Modules" (Bật tắt qua đây)
14
-
15
- 3. Bỏ module
16
- - Xóa module
17
- - Bỏ <Folder Name="/Modules/ProductModule/"> ở MyBlueprint.slnx
18
- - Bỏ ProjectReference ở Host.API.csproj
19
- - Bỏ ref ở Host.API trong appsettings
20
-
21
- 4. Mock Data
22
- - Tools → NuGet Package Manager → Package Manager Console
23
- - Default project: catalog.Infra
24
- - Xóa Migration cũ
25
- - Add-Migration SeedInitialData
26
- - Update-Database
27
-
28
- 5. Todos
29
- - Plug/ Unplug database provider (config)
7
+ - create-module ModuleName
8
+ - copy-module CopiedModuleName TargetFolder (Run in the folder Modules right outside the solution) (copy-module CopiedModuleName TargetFolder --force)
@@ -11,6 +11,7 @@ const { execSync } = require('child_process');
11
11
  // =====================================================
12
12
 
13
13
  const sourceModuleName = process.argv[2];
14
+ const targetFolder = process.argv[3];
14
15
  const force = process.argv.includes('--force');
15
16
 
16
17
  if (!sourceModuleName) {
@@ -19,11 +20,16 @@ if (!sourceModuleName) {
19
20
  process.exit(1);
20
21
  }
21
22
 
23
+ if (!moduleName || !targetFolder) {
24
+ console.error('Usage: copy-module <ModuleName> <TargetFolder>');
25
+ process.exit(1);
26
+ }
27
+
22
28
  // Assume current working directory is Modules/
23
29
  const modulesPath = process.cwd();
24
30
 
25
31
  const templateRoot = path.join(modulesPath, sourceModuleName);
26
- const targetModuleRoot = path.join(modulesPath, '..', 'BlueprintTemplate', 'Modules', `${sourceModuleName}Module`);
32
+ const targetModuleRoot = path.join(modulesPath, '..', targetFolder, 'Modules', `${sourceModuleName}Module`);
27
33
 
28
34
  const solutionFile = findSolutionFileFixed(modulesPath);
29
35
 
@@ -188,20 +194,20 @@ function copyRecursive(src, dest) {
188
194
  function findSolutionFileFixed(startDir) {
189
195
  // startDir = .../Modules/SomeModule
190
196
  const root = path.dirname(startDir);
191
- const blueprintTemplate = path.join(root, 'BlueprintTemplate');
197
+ const targetSolution = path.join(root, targetFolder);
192
198
 
193
- if (!fs.existsSync(blueprintTemplate)) {
194
- throw new Error('BlueprintTemplate folder not found');
199
+ if (!fs.existsSync(targetSolution)) {
200
+ throw new Error('Target folder not found');
195
201
  }
196
202
 
197
- const btFiles = fs.readdirSync(blueprintTemplate);
203
+ const btFiles = fs.readdirSync(targetSolution);
198
204
  const sln = btFiles.find(f => f.endsWith('.sln') || f.endsWith('.slnx'));
199
205
 
200
206
  if (!sln) {
201
- throw new Error('No .sln file found in BlueprintTemplate');
207
+ throw new Error('No .sln file found in Target folder');
202
208
  }
203
209
 
204
- return path.join(blueprintTemplate, sln);
210
+ return path.join(targetSolution, sln);
205
211
  }
206
212
 
207
213
  function mergeItemGroupFromTemplate(templateCsprojPath, targetCsprojPath) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "netcore-blueprint",
3
- "version": "0.0.65",
3
+ "version": "0.0.67",
4
4
  "description": "A custom project blueprint",
5
5
  "main": "create.js",
6
6
  "bin": {