@azure-net/cli 1.3.6 → 1.3.8

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/bin/azure-net.js CHANGED
@@ -19,7 +19,7 @@ program.command('generate:crud-repo')
19
19
  .action(generateRepository);
20
20
 
21
21
  program
22
- .command('generate:crud')
22
+ .command('make:crud')
23
23
  .description('Generate CRUD Domain/Repo/Service')
24
24
  .action(generateCrud);
25
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-net/cli",
3
- "version": "1.3.6",
3
+ "version": "1.3.8",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "azure-net": "bin/azure-net.js"
@@ -32,7 +32,10 @@ export default async function generateCrud() {
32
32
  type: 'select',
33
33
  name: 'module',
34
34
  message: 'Select target module:',
35
- choices: config.modules.map(m => ({ title: m, value: m }))
35
+ choices: [...config.modules, 'shared-context'].map(m => ({
36
+ title: m === 'shared-context' ? 'shared-context (shared)' : m,
37
+ value: m
38
+ }))
36
39
  }
37
40
  : null,
38
41
  { type: 'text', name: 'className', message: 'Class name (PascalCase):' },
@@ -42,7 +45,6 @@ export default async function generateCrud() {
42
45
 
43
46
  const rawName = answers.className.trim();
44
47
  const capital = rawName[0].toUpperCase() + rawName.slice(1);
45
- const lower = rawName[0].toLowerCase() + rawName.slice(1);
46
48
  const endpoint = answers.endpoint.trim();
47
49
  const datasource = answers.datasource.trim();
48
50
  const selectedModule = answers.module;
@@ -50,22 +52,27 @@ export default async function generateCrud() {
50
52
  const baseArch = path.join(process.cwd(), 'src/app/contexts');
51
53
  const basePath = selectedModule ? path.join(baseArch, selectedModule) : path.join(baseArch, 'app-context');
52
54
 
53
- const domainPath = path.join(basePath, 'Domain', lower);
55
+ const domainPath = path.join(basePath, 'Domain', capital);
54
56
  const serviceDir = path.join(basePath, 'Application', 'Services');
55
57
  const repoPath = path.join(basePath, 'Infra', 'Repo');
56
58
 
57
- const aliasCurrent = selectedModule ? `$${selectedModule}` : '$app-context';
59
+ const aliasCurrent = selectedModule === 'shared-context'
60
+ ? '$shared-context'
61
+ : selectedModule
62
+ ? `$${selectedModule}`
63
+ : '$app-context';
58
64
  const aliasShared = '$shared-context';
59
65
 
60
66
  const templateData = {
61
67
  className: capital,
62
- domainName: lower,
68
+ domainName: capital,
63
69
  endpoint,
64
70
  datasource,
65
71
  aliasDomain: `${aliasCurrent}/Domain`,
66
72
  aliasShared: aliasShared,
67
73
  aliasApplication: `${aliasCurrent}/Application`,
68
- aliasInfra: `${aliasCurrent}/Infra`
74
+ aliasInfra: `${aliasCurrent}/Infra`,
75
+ aliasRepo: `${aliasCurrent}/Infra/Repo`,
69
76
  };
70
77
 
71
78
  // === 1) Abstracts
@@ -97,7 +104,6 @@ export default async function generateCrud() {
97
104
  path.join(domainPath, 'index.ts'),
98
105
  [`export * from './Abstracts';`, `export * from './Request';`].join('\n') + '\n'
99
106
  );
100
- await updateIndexTs(domainPath);
101
107
 
102
108
  // === 5) Repo
103
109
  const repoTpl = await fs.readFile(path.join(__dirname, '../templates/data/repo/ClassRepo.ejs'), 'utf-8');
@@ -1,5 +1,5 @@
1
1
  import { BaseRequest } from '@azure-net/kit';
2
- import type { I<%= className %>CreateRequest } from '../abstracts';
2
+ import type { I<%= className %>CreateRequest } from '../Abstracts';
3
3
 
4
4
  export class <%= className %>CreateRequest extends BaseRequest<I<%= className %>CreateRequest> {
5
5
  override rules() {
@@ -1,5 +1,5 @@
1
1
  import { BaseRequest } from '@azure-net/kit';
2
- import type { I<%= className %>UpdateRequest } from '../abstracts';
2
+ import type { I<%= className %>UpdateRequest } from '../Abstracts';
3
3
 
4
4
  export class <%= className %>UpdateRequest extends BaseRequest<I<%= className %>UpdateRequest> {
5
5
  override rules() {