@acorex/platform-generator 21.0.0-next.24 → 21.0.0-next.31
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/README.md +67 -6
- package/package.json +9 -3
- package/src/bin/create-acorex-app.js +116 -0
- package/src/bin/standalone-scaffold.js +533 -0
- package/src/generators/app-module/files/project.json.template +194 -48
- package/src/generators/app-module/files/src/app/app.config.api.ts.template +145 -0
- package/src/generators/app-module/files/src/app/app.config.full.ts.template +216 -0
- package/src/generators/app-module/files/src/app/app.config.minimal.ts.template +162 -0
- package/src/generators/app-module/files/src/app/app.routes.ts.template +1 -1
- package/src/generators/app-module/files/src/app/modules/common/default-settings.providers.ts.template +16 -8
- package/src/generators/app-module/files/src/app/modules/layout/layout-root.module.ts.template +2 -5
- package/src/generators/app-module/files/src/app/modules/root/root.module.ts.template +1 -1
- package/src/generators/app-module/files/src/assets/i18n/en-US/activity-log.json +10 -1
- package/src/generators/app-module/files/src/assets/i18n/en-US/data-management.json +4 -0
- package/src/generators/app-module/files/src/assets/i18n/en-US/general.json +5 -0
- package/src/generators/app-module/files/src/assets/i18n/en-US/questionnaire.json +77 -0
- package/src/generators/app-module/files/src/assets/i18n/fa-IR/activity-log.json +10 -1
- package/src/generators/app-module/files/src/assets/i18n/fa-IR/data-management.json +5 -1
- package/src/generators/app-module/files/src/assets/i18n/fa-IR/general.json +7 -3
- package/src/generators/app-module/files/src/assets/i18n/fa-IR/human-capital-management.json +4 -7
- package/src/generators/app-module/files/src/assets/i18n/fa-IR/questionnaire.json +77 -0
- package/src/generators/app-module/files/src/environments/environment.dev.ts.template +45 -16
- package/src/generators/app-module/files/src/environments/environment.prod.ts.template +33 -0
- package/src/generators/app-module/files/src/environments/environment.ts.template +23 -7
- package/src/generators/app-module/files/src/main.ts.template +42 -2
- package/src/generators/app-module/generator.d.ts +10 -1
- package/src/generators/app-module/generator.js +100 -12
- package/src/generators/app-module/generator.js.map +1 -1
- package/src/generators/app-module/schema.d.ts +28 -0
- package/src/generators/app-module/schema.json +74 -5
- package/src/generators/standalone-workspace/versions.json +53 -0
- package/src/generators/app-module/files/src/app/app.config.ts.template +0 -156
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
"unknown": "نامشخص"
|
|
19
19
|
},
|
|
20
20
|
"multi-language": "چند زبانه",
|
|
21
|
+
"multi-language-select": {
|
|
22
|
+
"show-other-languages": "نمایش زبانهایی که پروفایل محلی ندارند"
|
|
23
|
+
},
|
|
21
24
|
"selectbox": {
|
|
22
25
|
"popover": {
|
|
23
26
|
"title": "انتخاب گزینه"
|
|
@@ -549,6 +552,7 @@
|
|
|
549
552
|
},
|
|
550
553
|
"configure": {
|
|
551
554
|
"title": "پیکربندی",
|
|
555
|
+
"named-title": "پیکربندی {{name}}",
|
|
552
556
|
"description": "تنظیم گزینهها و تنظیمات"
|
|
553
557
|
},
|
|
554
558
|
"setup": {
|
|
@@ -701,7 +705,6 @@
|
|
|
701
705
|
"description": "در این بخش رکوردی موجود نیست. برای شروع یک رکورد جدید ایجاد کنید."
|
|
702
706
|
}
|
|
703
707
|
},
|
|
704
|
-
|
|
705
708
|
"state-message": {
|
|
706
709
|
"error": {
|
|
707
710
|
"title": "خطا",
|
|
@@ -756,6 +759,7 @@
|
|
|
756
759
|
"type": "نوع",
|
|
757
760
|
"types": "نوعها",
|
|
758
761
|
"icon": "آیکون",
|
|
762
|
+
"interface": "رابط",
|
|
759
763
|
"color": "رنگ",
|
|
760
764
|
"avatar": "نمایه",
|
|
761
765
|
"size": "اندازه",
|
|
@@ -968,7 +972,7 @@
|
|
|
968
972
|
},
|
|
969
973
|
"selection": {
|
|
970
974
|
"items-selected": "آیتمهای انتخاب شده",
|
|
971
|
-
"all-items": "همه
|
|
975
|
+
"all-items": "همه ردیفها",
|
|
972
976
|
"availability": "قابلیت دسترسی"
|
|
973
977
|
},
|
|
974
978
|
"navigation": {
|
|
@@ -998,4 +1002,4 @@
|
|
|
998
1002
|
}
|
|
999
1003
|
}
|
|
1000
1004
|
}
|
|
1001
|
-
}
|
|
1005
|
+
}
|
|
@@ -29,9 +29,8 @@
|
|
|
29
29
|
"delete-items": "حذف آیتمها",
|
|
30
30
|
"delete": "حذف",
|
|
31
31
|
"detail": "جزئیات",
|
|
32
|
-
"all-item": "همه
|
|
32
|
+
"all-item": "همه ردیفها"
|
|
33
33
|
},
|
|
34
|
-
|
|
35
34
|
"employee-skill": {
|
|
36
35
|
"individual-title": "مهارت کارمند",
|
|
37
36
|
"plural-title": "مهارتهای کارمند",
|
|
@@ -48,7 +47,6 @@
|
|
|
48
47
|
"validationDate": "تاریخ تأیید",
|
|
49
48
|
"notes": "یادداشتها"
|
|
50
49
|
},
|
|
51
|
-
|
|
52
50
|
"skill-level": {
|
|
53
51
|
"individual-title": "سطح مهارت",
|
|
54
52
|
"plural-title": "سطوح مهارت",
|
|
@@ -59,7 +57,6 @@
|
|
|
59
57
|
"is-active": "فعال است",
|
|
60
58
|
"description": "توضیحات"
|
|
61
59
|
},
|
|
62
|
-
|
|
63
60
|
"employment-type": {
|
|
64
61
|
"individual-title": "نوع استخدام",
|
|
65
62
|
"plural-title": "انواع استخدام",
|
|
@@ -70,7 +67,7 @@
|
|
|
70
67
|
"delete-items": "حذف آیتمها",
|
|
71
68
|
"delete": "حذف",
|
|
72
69
|
"detail": "جزئیات",
|
|
73
|
-
"all-item": "همه
|
|
70
|
+
"all-item": "همه ردیفها"
|
|
74
71
|
},
|
|
75
72
|
"position-assignment": {
|
|
76
73
|
"individual-title": "واگذاری سمت",
|
|
@@ -93,7 +90,7 @@
|
|
|
93
90
|
"delete-items": "حذف آیتمها",
|
|
94
91
|
"delete": "حذف",
|
|
95
92
|
"detail": "جزئیات",
|
|
96
|
-
"all-item": "همه
|
|
93
|
+
"all-item": "همه ردیفها"
|
|
97
94
|
},
|
|
98
95
|
"leave-type": {
|
|
99
96
|
"individual-title": "نوع مرخصی",
|
|
@@ -141,4 +138,4 @@
|
|
|
141
138
|
"note-description": "یادداشتهای اختیاری درباره تصمیم تأیید."
|
|
142
139
|
}
|
|
143
140
|
}
|
|
144
|
-
}
|
|
141
|
+
}
|
|
@@ -113,6 +113,83 @@
|
|
|
113
113
|
"high": "زیاد",
|
|
114
114
|
"critical": "بحرانی"
|
|
115
115
|
}
|
|
116
|
+
},
|
|
117
|
+
"yes-no-maybe-options": {
|
|
118
|
+
"title": "بله / خیر / شاید",
|
|
119
|
+
"columns": {
|
|
120
|
+
"value": { "title": "مقدار" },
|
|
121
|
+
"title": { "title": "عنوان" }
|
|
122
|
+
},
|
|
123
|
+
"samples": {
|
|
124
|
+
"yes": "بله",
|
|
125
|
+
"no": "خیر",
|
|
126
|
+
"maybe": "شاید"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"yes-no-na-options": {
|
|
130
|
+
"title": "بله / خیر / نامعتبر",
|
|
131
|
+
"columns": {
|
|
132
|
+
"value": { "title": "مقدار" },
|
|
133
|
+
"title": { "title": "عنوان" }
|
|
134
|
+
},
|
|
135
|
+
"samples": {
|
|
136
|
+
"yes": "بله",
|
|
137
|
+
"no": "خیر",
|
|
138
|
+
"not-applicable": "نامعتبر"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"gender-options": {
|
|
142
|
+
"title": "جنسیت",
|
|
143
|
+
"columns": {
|
|
144
|
+
"value": { "title": "مقدار" },
|
|
145
|
+
"title": { "title": "عنوان" }
|
|
146
|
+
},
|
|
147
|
+
"samples": {
|
|
148
|
+
"female": "زن",
|
|
149
|
+
"male": "مرد",
|
|
150
|
+
"non-binary": "غیر دوتایی",
|
|
151
|
+
"prefer-not-to-say": "تمایلی به اعلام ندارم",
|
|
152
|
+
"other": "سایر"
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"rating-1-10-options": {
|
|
156
|
+
"title": "امتیاز (۱ تا ۱۰)",
|
|
157
|
+
"columns": {
|
|
158
|
+
"value": { "title": "مقدار" },
|
|
159
|
+
"title": { "title": "عنوان" }
|
|
160
|
+
},
|
|
161
|
+
"samples": {
|
|
162
|
+
"1": "۱",
|
|
163
|
+
"2": "۲",
|
|
164
|
+
"3": "۳",
|
|
165
|
+
"4": "۴",
|
|
166
|
+
"5": "۵",
|
|
167
|
+
"6": "۶",
|
|
168
|
+
"7": "۷",
|
|
169
|
+
"8": "۸",
|
|
170
|
+
"9": "۹",
|
|
171
|
+
"10": "۱۰"
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"nps-scale-options": {
|
|
175
|
+
"title": "شاخص وفاداری خالص (۰ تا ۱۰)",
|
|
176
|
+
"columns": {
|
|
177
|
+
"value": { "title": "مقدار" },
|
|
178
|
+
"title": { "title": "عنوان" }
|
|
179
|
+
},
|
|
180
|
+
"samples": {
|
|
181
|
+
"0": "۰",
|
|
182
|
+
"1": "۱",
|
|
183
|
+
"2": "۲",
|
|
184
|
+
"3": "۳",
|
|
185
|
+
"4": "۴",
|
|
186
|
+
"5": "۵",
|
|
187
|
+
"6": "۶",
|
|
188
|
+
"7": "۷",
|
|
189
|
+
"8": "۸",
|
|
190
|
+
"9": "۹",
|
|
191
|
+
"10": "۱۰"
|
|
192
|
+
}
|
|
116
193
|
}
|
|
117
194
|
}
|
|
118
195
|
}
|
|
@@ -1,20 +1,49 @@
|
|
|
1
|
+
import { AuthConfig } from 'angular-oauth2-oidc';
|
|
2
|
+
|
|
3
|
+
const REDIRECT_URIS = [
|
|
4
|
+
'http://localhost:4200/auth/axp-oauth-callback',
|
|
5
|
+
'https://localhost:4200/auth/axp-oauth-callback',
|
|
6
|
+
];
|
|
7
|
+
|
|
8
|
+
const POST_LOGOUT_REDIRECT_URIS = ['http://localhost:4200/signoutcallback', 'https://localhost:4200/signoutcallback'];
|
|
9
|
+
|
|
10
|
+
export const oidcConfig: AuthConfig = {
|
|
11
|
+
issuer: 'https://localhost:7003',
|
|
12
|
+
clientId: 'acorex',
|
|
13
|
+
responseType: 'token',
|
|
14
|
+
scope: 'openid profile email offline_access',
|
|
15
|
+
showDebugInformation: true,
|
|
16
|
+
redirectUri: REDIRECT_URIS.find((uri) => uri.startsWith(window.location.origin)) || REDIRECT_URIS[0],
|
|
17
|
+
silentRefreshRedirectUri: REDIRECT_URIS.find((uri) => uri.startsWith(window.location.origin)) || REDIRECT_URIS[0],
|
|
18
|
+
postLogoutRedirectUri:
|
|
19
|
+
POST_LOGOUT_REDIRECT_URIS.find((uri) => uri.startsWith(window.location.origin)) || POST_LOGOUT_REDIRECT_URIS[0],
|
|
20
|
+
sessionChecksEnabled: true,
|
|
21
|
+
clearHashAfterLogin: true,
|
|
22
|
+
useSilentRefresh: true,
|
|
23
|
+
timeoutFactor: 10,
|
|
24
|
+
sessionCheckIntervall: 2000,
|
|
25
|
+
strictDiscoveryDocumentValidation: false,
|
|
26
|
+
disableAtHashCheck: true,
|
|
27
|
+
skipIssuerCheck: true,
|
|
28
|
+
oidc: false,
|
|
29
|
+
requireHttps: true,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** Entity storage: 'dexie' = IndexedDB, 'firestore' = Firestore. When firestore, set firebase config. */
|
|
1
33
|
export const environment = {
|
|
2
34
|
production: false,
|
|
3
|
-
baseUrl: 'https://
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
showDebugInformation: true,
|
|
17
|
-
redirect_uri: 'http://localhost:4200/auth/signincallback',
|
|
18
|
-
silentRequestTimeoutInSeconds: 20000,
|
|
35
|
+
baseUrl: 'https://localhost:7003/api',
|
|
36
|
+
oidcConfig,
|
|
37
|
+
logoutUrl: 'https://localhost:7003/connect/logout',
|
|
38
|
+
entityStorage: {
|
|
39
|
+
backend: '<%= entityStorageBackend %>' as 'dexie' | 'firestore',
|
|
40
|
+
firebase: {
|
|
41
|
+
apiKey: '<%= firebaseApiKey %>',
|
|
42
|
+
authDomain: '<%= firebaseAuthDomain %>',
|
|
43
|
+
projectId: '<%= firebaseProjectId %>',
|
|
44
|
+
storageBucket: '<%= firebaseStorageBucket %>',
|
|
45
|
+
messagingSenderId: '<%= firebaseMessagingSenderId %>',
|
|
46
|
+
appId: '<%= firebaseAppId %>',
|
|
47
|
+
},
|
|
19
48
|
},
|
|
20
49
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Production environment stub. Replace fileReplacements targets or adjust OIDC URLs for your deployment.
|
|
3
|
+
*/
|
|
4
|
+
export const environment = {
|
|
5
|
+
production: true,
|
|
6
|
+
baseUrl: '<%= baseUrl %>',
|
|
7
|
+
logoutUrl: 'https://localhost:44320/connect/logout',
|
|
8
|
+
entityStorage: {
|
|
9
|
+
backend: '<%= entityStorageBackend %>' as 'dexie' | 'firestore',
|
|
10
|
+
firebase: {
|
|
11
|
+
apiKey: '<%= firebaseApiKey %>',
|
|
12
|
+
authDomain: '<%= firebaseAuthDomain %>',
|
|
13
|
+
projectId: '<%= firebaseProjectId %>',
|
|
14
|
+
storageBucket: '<%= firebaseStorageBucket %>',
|
|
15
|
+
messagingSenderId: '<%= firebaseMessagingSenderId %>',
|
|
16
|
+
appId: '<%= firebaseAppId %>',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
oidcConfig: {
|
|
20
|
+
authority: 'https://localhost:44320',
|
|
21
|
+
userinfo_endpoint: 'https://localhost:44320/api/userinfo',
|
|
22
|
+
scope: 'openid profile email offline_access api1',
|
|
23
|
+
client_id: 'acorex',
|
|
24
|
+
response_type: 'code',
|
|
25
|
+
automaticSilentRenew: true,
|
|
26
|
+
monitorSession: true,
|
|
27
|
+
filterProtocolClaims: true,
|
|
28
|
+
loadUserInfo: true,
|
|
29
|
+
showDebugInformation: false,
|
|
30
|
+
redirect_uri: 'https://localhost:4200/auth/axp-oauth-callback',
|
|
31
|
+
silentRequestTimeoutInSeconds: 2000,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -1,20 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entity storage backend: 'dexie' = IndexedDB (local), 'firestore' = Firebase Firestore (cloud).
|
|
3
|
+
* When using 'firestore', set firebase with your project credentials from Firebase Console.
|
|
4
|
+
*/
|
|
1
5
|
export const environment = {
|
|
2
6
|
production: false,
|
|
3
|
-
baseUrl: '
|
|
4
|
-
logoutUrl: 'https://localhost:
|
|
5
|
-
|
|
7
|
+
baseUrl: '<%= baseUrl %>',
|
|
8
|
+
logoutUrl: 'https://localhost:44320/connect/logout',
|
|
9
|
+
|
|
10
|
+
entityStorage: {
|
|
11
|
+
backend: '<%= entityStorageBackend %>' as 'dexie' | 'firestore',
|
|
12
|
+
firebase: {
|
|
13
|
+
apiKey: '<%= firebaseApiKey %>',
|
|
14
|
+
authDomain: '<%= firebaseAuthDomain %>',
|
|
15
|
+
projectId: '<%= firebaseProjectId %>',
|
|
16
|
+
storageBucket: '<%= firebaseStorageBucket %>',
|
|
17
|
+
messagingSenderId: '<%= firebaseMessagingSenderId %>',
|
|
18
|
+
appId: '<%= firebaseAppId %>',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
|
|
6
22
|
oidcConfig: {
|
|
7
23
|
authority: 'https://localhost:44320',
|
|
8
24
|
userinfo_endpoint: 'https://localhost:44320/api/userinfo',
|
|
9
25
|
scope: 'openid profile email offline_access api1',
|
|
10
26
|
client_id: 'acorex',
|
|
11
27
|
response_type: 'code',
|
|
12
|
-
automaticSilentRenew: true,
|
|
13
|
-
monitorSession: true,
|
|
14
|
-
filterProtocolClaims: true,
|
|
28
|
+
automaticSilentRenew: true,
|
|
29
|
+
monitorSession: true,
|
|
30
|
+
filterProtocolClaims: true,
|
|
15
31
|
loadUserInfo: true,
|
|
16
32
|
showDebugInformation: true,
|
|
17
|
-
redirect_uri: 'https://localhost:4200/auth/
|
|
33
|
+
redirect_uri: 'https://localhost:4200/auth/axp-oauth-callback',
|
|
18
34
|
silentRequestTimeoutInSeconds: 2000,
|
|
19
35
|
},
|
|
20
36
|
};
|
|
@@ -1,6 +1,46 @@
|
|
|
1
|
-
import {
|
|
1
|
+
<% if (includeConsoleLogCapture) { %>import { AXMLogCaptureService } from '@acorex/modules/help-desk';
|
|
2
|
+
import { ApplicationRef, isDevMode } from '@angular/core';
|
|
3
|
+
<% } %>import { bootstrapApplication } from '@angular/platform-browser';
|
|
2
4
|
import { AppComponent } from './app/app.component';
|
|
3
5
|
import { appConfig } from './app/app.config';
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
//#region ---- Bootstrap Application ----
|
|
8
|
+
|
|
9
|
+
bootstrapApplication(AppComponent, appConfig)<% if (includeConsoleLogCapture) { %>
|
|
10
|
+
.then((appRef: ApplicationRef) => {
|
|
11
|
+
const injector = appRef.injector;
|
|
12
|
+
|
|
13
|
+
if (!isDevMode()) {
|
|
14
|
+
const logCaptureService = injector.get(AXMLogCaptureService);
|
|
15
|
+
|
|
16
|
+
(function patchConsole() {
|
|
17
|
+
const originalLog = console.log;
|
|
18
|
+
const originalError = console.error;
|
|
19
|
+
const originalWarn = console.warn;
|
|
20
|
+
|
|
21
|
+
console.log = function (...args: unknown[]) {
|
|
22
|
+
if (logCaptureService.canCaptureLog()) {
|
|
23
|
+
logCaptureService.addConsoleLog(args.map(String).join(' '));
|
|
24
|
+
}
|
|
25
|
+
originalLog.apply(console, args);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
console.error = function (...args: unknown[]) {
|
|
29
|
+
if (logCaptureService.canCaptureLog()) {
|
|
30
|
+
logCaptureService.addConsoleError(args.map(String).join(' '));
|
|
31
|
+
}
|
|
32
|
+
originalError.apply(console, args);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
console.warn = function (...args: unknown[]) {
|
|
36
|
+
if (logCaptureService.canCaptureLog()) {
|
|
37
|
+
logCaptureService.addConsoleWarning(args.map(String).join(' '));
|
|
38
|
+
}
|
|
39
|
+
originalWarn.apply(console, args);
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
}
|
|
43
|
+
})<% } %>
|
|
6
44
|
.catch((err) => console.error(err));
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
2
|
import { AppModuleGeneratorSchema } from './schema';
|
|
3
3
|
export declare function upperCase(text: string): string;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Builds a valid TypeScript class name prefix from a project name (kebab-case, snake_case, dot.case).
|
|
6
|
+
* Examples: "my-app" -> "MyApp", "demo" -> "Demo", "foo_bar" -> "FooBar"
|
|
7
|
+
*/
|
|
8
|
+
export declare function toPascalCase(text: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Uppercase identifier prefix for const exports (hyphens/dots become underscores).
|
|
11
|
+
* Examples: "my-app" -> "MY_APP", "demo" -> "DEMO"
|
|
12
|
+
*/
|
|
13
|
+
export declare function toConstPrefix(text: string): string;
|
|
5
14
|
export declare function appModuleGenerator(tree: Tree, options: AppModuleGeneratorSchema): Promise<void>;
|
|
6
15
|
export default appModuleGenerator;
|
|
@@ -1,29 +1,117 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.upperCase = upperCase;
|
|
4
|
-
exports.
|
|
4
|
+
exports.toPascalCase = toPascalCase;
|
|
5
|
+
exports.toConstPrefix = toConstPrefix;
|
|
5
6
|
exports.appModuleGenerator = appModuleGenerator;
|
|
6
7
|
const tslib_1 = require("tslib");
|
|
7
8
|
const devkit_1 = require("@nx/devkit");
|
|
8
9
|
const path = require("path");
|
|
10
|
+
//#region ---- Template helpers ----
|
|
9
11
|
function upperCase(text) {
|
|
10
12
|
return text.toUpperCase();
|
|
11
13
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Builds a valid TypeScript class name prefix from a project name (kebab-case, snake_case, dot.case).
|
|
16
|
+
* Examples: "my-app" -> "MyApp", "demo" -> "Demo", "foo_bar" -> "FooBar"
|
|
17
|
+
*/
|
|
18
|
+
function toPascalCase(text) {
|
|
19
|
+
return String(text)
|
|
20
|
+
.split(/[-_\s.]+/)
|
|
21
|
+
.filter(Boolean)
|
|
22
|
+
.map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
|
|
23
|
+
.join('');
|
|
14
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Uppercase identifier prefix for const exports (hyphens/dots become underscores).
|
|
27
|
+
* Examples: "my-app" -> "MY_APP", "demo" -> "DEMO"
|
|
28
|
+
*/
|
|
29
|
+
function toConstPrefix(text) {
|
|
30
|
+
return String(text)
|
|
31
|
+
.split(/[-_\s.]+/)
|
|
32
|
+
.filter(Boolean)
|
|
33
|
+
.join('_')
|
|
34
|
+
.toUpperCase();
|
|
35
|
+
}
|
|
36
|
+
/** i18n JSON files kept when preset is minimal (both locales, basename only). */
|
|
37
|
+
const MINIMAL_I18N_BASENAMES = new Set([
|
|
38
|
+
'module.json',
|
|
39
|
+
'acorex.json',
|
|
40
|
+
'auth.json',
|
|
41
|
+
'general.json',
|
|
42
|
+
'layout.json',
|
|
43
|
+
'settings.json',
|
|
44
|
+
'regional.json',
|
|
45
|
+
'help-desk.json',
|
|
46
|
+
'dashboard.json',
|
|
47
|
+
'notification-management.json',
|
|
48
|
+
'security-management.json',
|
|
49
|
+
'organization-management.json',
|
|
50
|
+
'platform-management.json',
|
|
51
|
+
]);
|
|
52
|
+
function normalizeSchema(raw) {
|
|
53
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
54
|
+
const preset = (_a = raw.preset) !== null && _a !== void 0 ? _a : 'full';
|
|
55
|
+
const entityStorage = (_b = raw.entityStorage) !== null && _b !== void 0 ? _b : 'dexie';
|
|
56
|
+
return Object.assign(Object.assign({}, raw), { copyright: (_c = raw.copyright) !== null && _c !== void 0 ? _c : '© 2025', baseUrl: (_d = raw.baseUrl) !== null && _d !== void 0 ? _d : 'https://localhost:44320/api', preset,
|
|
57
|
+
entityStorage, entityStorageBackend: entityStorage, includeApiConfig: (_e = raw.includeApiConfig) !== null && _e !== void 0 ? _e : true, includeConsoleLogCapture: (_f = raw.includeConsoleLogCapture) !== null && _f !== void 0 ? _f : false, firebaseApiKey: (_g = raw.firebaseApiKey) !== null && _g !== void 0 ? _g : 'YOUR_FIREBASE_API_KEY', firebaseAuthDomain: (_h = raw.firebaseAuthDomain) !== null && _h !== void 0 ? _h : 'your-project.firebaseapp.com', firebaseProjectId: (_j = raw.firebaseProjectId) !== null && _j !== void 0 ? _j : 'your-project-id', firebaseStorageBucket: (_k = raw.firebaseStorageBucket) !== null && _k !== void 0 ? _k : 'your-project.appspot.com', firebaseMessagingSenderId: (_l = raw.firebaseMessagingSenderId) !== null && _l !== void 0 ? _l : '000000000000', firebaseAppId: (_m = raw.firebaseAppId) !== null && _m !== void 0 ? _m : '1:000000000000:web:000000000000000000000', upperCase, className: toPascalCase(raw.name), constPrefix: toConstPrefix(raw.name), isFullPreset: preset === 'full', isMinimalPreset: preset === 'minimal' });
|
|
58
|
+
}
|
|
59
|
+
function mergeAppConfigFromPreset(tree, projectRoot, preset) {
|
|
60
|
+
const src = `${projectRoot}/src/app`;
|
|
61
|
+
const fullPath = `${src}/app.config.full.ts`;
|
|
62
|
+
const minPath = `${src}/app.config.minimal.ts`;
|
|
63
|
+
const chosen = preset === 'minimal' ? minPath : fullPath;
|
|
64
|
+
const body = tree.read(chosen, 'utf-8');
|
|
65
|
+
if (!body) {
|
|
66
|
+
throw new Error(`[create-app] Missing generated file: ${chosen}`);
|
|
67
|
+
}
|
|
68
|
+
tree.write(`${src}/app.config.ts`, body);
|
|
69
|
+
if (tree.exists(fullPath)) {
|
|
70
|
+
tree.delete(fullPath);
|
|
71
|
+
}
|
|
72
|
+
if (tree.exists(minPath)) {
|
|
73
|
+
tree.delete(minPath);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function pruneMinimalI18n(tree, projectRoot, appName) {
|
|
77
|
+
const locales = ['en-US', 'fa-IR'];
|
|
78
|
+
for (const loc of locales) {
|
|
79
|
+
const dir = `${projectRoot}/src/assets/i18n/${loc}`;
|
|
80
|
+
if (!tree.exists(dir)) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
const children = tree.children(dir);
|
|
84
|
+
for (const file of children) {
|
|
85
|
+
if (!file.endsWith('.json')) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const moduleFile = `${appName}-module.json`;
|
|
89
|
+
if (file === moduleFile) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (MINIMAL_I18N_BASENAMES.has(file)) {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
tree.delete(`${dir}/${file}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
15
100
|
function appModuleGenerator(tree, options) {
|
|
16
101
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
102
|
const projectRoot = `apps/${options.name}`;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
103
|
+
const templateOptions = normalizeSchema(options);
|
|
104
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), projectRoot, templateOptions);
|
|
105
|
+
mergeAppConfigFromPreset(tree, projectRoot, templateOptions.preset);
|
|
106
|
+
if (!templateOptions.includeApiConfig) {
|
|
107
|
+
const apiPath = `${projectRoot}/src/app/app.config.api.ts`;
|
|
108
|
+
if (tree.exists(apiPath)) {
|
|
109
|
+
tree.delete(apiPath);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (templateOptions.isMinimalPreset) {
|
|
113
|
+
pruneMinimalI18n(tree, projectRoot, options.name);
|
|
114
|
+
}
|
|
27
115
|
// Rename root module to match the module name
|
|
28
116
|
tree.rename(`${projectRoot}/src/app/modules/root/root.module.ts`, `${projectRoot}/src/app/modules/${options.name}/${options.name}-root.module.ts`);
|
|
29
117
|
tree.rename(`${projectRoot}/src/app/modules/root`, `${projectRoot}/src/app/modules/${options.name}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../generator/src/generators/app-module/generator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../generator/src/generators/app-module/generator.ts"],"names":[],"mappings":";;AAMA,8BAEC;AAMD,oCAMC;AAMD,sCAMC;AAyFD,gDAqCC;;AA9JD,uCAA8D;AAC9D,6BAA6B;AAG7B,oCAAoC;AAEpC,SAAgB,SAAS,CAAC,IAAY;IACpC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;AAC5B,CAAC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAC,IAAY;IACvC,OAAO,MAAM,CAAC,IAAI,CAAC;SAChB,KAAK,CAAC,UAAU,CAAC;SACjB,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACpE,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAAC,IAAY;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC;SAChB,KAAK,CAAC,UAAU,CAAC;SACjB,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC;SACT,WAAW,EAAE,CAAC;AACnB,CAAC;AAED,iFAAiF;AACjF,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC;IACrC,aAAa;IACb,aAAa;IACb,WAAW;IACX,cAAc;IACd,aAAa;IACb,eAAe;IACf,eA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iB,CAChF,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,GAAG,WAAW,uBAAuB,EAAE,GAAG,WAAW,oBAAoB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAErG,6CAA6C;QAC7C,IAAI,CAAC,MAAM,CACT,GAAG,WAAW,oCAAoC,EAClD,GAAG,WAAW,0BAA0B,OAAO,CAAC,IAAI,cAAc,CACnE,CAAC;QACF,IAAI,CAAC,MAAM,CACT,GAAG,WAAW,oCAAoC,EAClD,GAAG,WAAW,0BAA0B,OAAO,CAAC,IAAI,cAAc,CACnE,CAAC;QAEF,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAED,kBAAe,kBAAkB,CAAC"}
|
|
@@ -1,4 +1,32 @@
|
|
|
1
|
+
export type AppPreset = 'minimal' | 'full';
|
|
2
|
+
|
|
3
|
+
export type EntityStorageBackend = 'dexie' | 'firestore';
|
|
4
|
+
|
|
1
5
|
export interface AppModuleGeneratorSchema {
|
|
2
6
|
name: string;
|
|
3
7
|
title: string;
|
|
8
|
+
copyright?: string;
|
|
9
|
+
baseUrl?: string;
|
|
10
|
+
/** App scaffold: full mirrors apps/demo module set; minimal is a smaller subset. */
|
|
11
|
+
preset?: AppPreset;
|
|
12
|
+
/** IndexedDB (dexie) vs Firebase Firestore mock backend. */
|
|
13
|
+
entityStorage?: EntityStorageBackend;
|
|
14
|
+
/** When true, generates app.config.api.ts and build/serve targets that swap to API auth. */
|
|
15
|
+
includeApiConfig?: boolean;
|
|
16
|
+
/** When true, main.ts patches console for AXMLogCaptureService in production (matches demo). */
|
|
17
|
+
includeConsoleLogCapture?: boolean;
|
|
18
|
+
/** Placeholder Firebase config (user must replace in environment files). */
|
|
19
|
+
firebaseApiKey?: string;
|
|
20
|
+
firebaseAuthDomain?: string;
|
|
21
|
+
firebaseProjectId?: string;
|
|
22
|
+
firebaseStorageBucket?: string;
|
|
23
|
+
firebaseMessagingSenderId?: string;
|
|
24
|
+
firebaseAppId?: string;
|
|
25
|
+
|
|
26
|
+
// Populated in generator (lodash template helpers)
|
|
27
|
+
upperCase?: (text: string) => string;
|
|
28
|
+
/** PascalCase prefix for generated classes (from app name). */
|
|
29
|
+
className?: string;
|
|
30
|
+
/** SCREAMING_SNAKE prefix for generated const identifiers (from app name). */
|
|
31
|
+
constPrefix?: string;
|
|
4
32
|
}
|