@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
package/package.json
CHANGED
|
@@ -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 => ({
|
|
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',
|
|
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
|
|
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:
|
|
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 '../
|
|
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 '../
|
|
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() {
|