@simplysm/sd-cli 6.0.27 → 6.0.36
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/dist-node/bin/sd-cli.js +19 -4
- package/dist-node/bin/sd-cli.js.map +1 -1
- package/dist-node/build-tools/SdCliNgModuleFilesGenerator.js +98 -57
- package/dist-node/build-tools/SdCliNgModuleFilesGenerator.js.map +1 -1
- package/dist-node/build-tools/metadata/SdAotMetadataReader.js +16 -12
- package/dist-node/build-tools/metadata/SdAotMetadataReader.js.map +1 -1
- package/dist-node/build-tools/metadata/SdIvyMetadataReader.js +23 -6
- package/dist-node/build-tools/metadata/SdIvyMetadataReader.js.map +1 -1
- package/dist-node/build-tools/metadata/SdMetadataError.js +13 -0
- package/dist-node/build-tools/metadata/SdMetadataError.js.map +1 -0
- package/dist-node/build-tools/metadata/SdMyMetadataReader.js +22 -5
- package/dist-node/build-tools/metadata/SdMyMetadataReader.js.map +1 -1
- package/dist-node/builders/SdCliNgClientBuilder.js +74 -74
- package/dist-node/builders/SdCliNgClientBuilder.js.map +1 -1
- package/dist-node/builders/SdCliNgLibraryBuilder.js +38 -34
- package/dist-node/builders/SdCliNgLibraryBuilder.js.map +1 -1
- package/dist-node/builders/SdCliServerBuilder.js +46 -45
- package/dist-node/builders/SdCliServerBuilder.js.map +1 -1
- package/dist-node/builders/SdCliTypescriptBuilder.js +65 -60
- package/dist-node/builders/SdCliTypescriptBuilder.js.map +1 -1
- package/dist-node/entry-points/SdCliLocalUpdater.js +30 -29
- package/dist-node/entry-points/SdCliLocalUpdater.js.map +1 -1
- package/dist-node/entry-points/SdCliProject.js +10 -16
- package/dist-node/entry-points/SdCliProject.js.map +1 -1
- package/dist-node/packages/SdCliClientPackage.js +6 -4
- package/dist-node/packages/SdCliClientPackage.js.map +1 -1
- package/dist-node/packages/SdCliLibraryPackage.js +5 -3
- package/dist-node/packages/SdCliLibraryPackage.js.map +1 -1
- package/dist-node/packages/SdCliServerPackage.js +4 -3
- package/dist-node/packages/SdCliServerPackage.js.map +1 -1
- package/dist-node/utils/SdProjectConfigUtil.js +1 -1
- package/dist-node/utils/SdProjectConfigUtil.js.map +1 -1
- package/dist-node/utils/SdWebpackUtil.js +33 -13
- package/dist-node/utils/SdWebpackUtil.js.map +1 -1
- package/dist-node/workers/client-ng-gen-worker.js +54 -0
- package/dist-node/workers/client-ng-gen-worker.js.map +1 -0
- package/dist-node/workers/lib-build-worker.js +7 -6
- package/dist-node/workers/lib-build-worker.js.map +1 -1
- package/dist-types/build-tools/metadata/SdIvyMetadataReader.d.ts +1 -0
- package/dist-types/build-tools/metadata/SdMetadataError.d.ts +6 -0
- package/dist-types/build-tools/metadata/SdMyMetadataReader.d.ts +1 -0
- package/dist-types/builders/SdCliNgClientBuilder.d.ts +6 -2
- package/dist-types/builders/SdCliNgLibraryBuilder.d.ts +1 -1
- package/dist-types/builders/SdCliServerBuilder.d.ts +2 -1
- package/dist-types/builders/SdCliTypescriptBuilder.d.ts +5 -5
- package/dist-types/commons.d.ts +4 -1
- package/dist-types/entry-points/SdCliLocalUpdater.d.ts +1 -1
- package/dist-types/entry-points/SdCliProject.d.ts +2 -0
- package/dist-types/packages/SdCliClientPackage.d.ts +2 -1
- package/dist-types/packages/SdCliLibraryPackage.d.ts +2 -1
- package/dist-types/packages/SdCliServerPackage.d.ts +2 -1
- package/dist-types/utils/SdWebpackUtil.d.ts +1 -1
- package/dist-types/workers/client-ng-gen-worker.d.ts +1 -0
- package/package.json +7 -7
- package/schema/schema.json +185 -122
- package/sd-tsconfig.node.json +2 -1
- package/src/bin/sd-cli.ts +19 -4
- package/src/build-tools/SdCliNgModuleFilesGenerator.ts +114 -70
- package/src/build-tools/metadata/SdAotMetadataReader.ts +8 -2
- package/src/build-tools/metadata/SdIvyMetadataReader.ts +27 -4
- package/src/build-tools/metadata/SdMetadataError.ts +7 -0
- package/src/build-tools/metadata/SdMyMetadataReader.ts +25 -3
- package/src/builders/SdCliNgClientBuilder.ts +123 -66
- package/src/builders/SdCliNgLibraryBuilder.ts +79 -39
- package/src/builders/SdCliServerBuilder.ts +61 -44
- package/src/builders/SdCliTypescriptBuilder.ts +92 -73
- package/src/commons.ts +3 -2
- package/src/entry-points/SdCliLocalUpdater.ts +40 -33
- package/src/entry-points/SdCliProject.ts +14 -13
- package/src/packages/SdCliClientPackage.ts +5 -3
- package/src/packages/SdCliLibraryPackage.ts +4 -2
- package/src/packages/SdCliServerPackage.ts +4 -3
- package/src/utils/SdCliFileCrypto.ts +1 -1
- package/src/utils/SdProjectConfigUtil.ts +1 -1
- package/src/utils/SdWebpackUtil.ts +42 -22
- package/src/workers/client-ng-gen-worker.ts +60 -0
- package/src/workers/lib-build-worker.ts +7 -6
- package/tsconfig.json +2 -1
package/schema/schema.json
CHANGED
|
@@ -3,6 +3,154 @@
|
|
|
3
3
|
"type": "object",
|
|
4
4
|
"additionalProperties": false,
|
|
5
5
|
"definitions": {
|
|
6
|
+
"schemaPublish": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"anyOf": [
|
|
9
|
+
{
|
|
10
|
+
"properties": {
|
|
11
|
+
"type": {
|
|
12
|
+
"enum": [
|
|
13
|
+
"ftp",
|
|
14
|
+
"sftp"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"host": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"port": {
|
|
21
|
+
"type": "number"
|
|
22
|
+
},
|
|
23
|
+
"path": {
|
|
24
|
+
"type": "string"
|
|
25
|
+
},
|
|
26
|
+
"username": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
},
|
|
29
|
+
"password": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"required": [
|
|
34
|
+
"type",
|
|
35
|
+
"host",
|
|
36
|
+
"path",
|
|
37
|
+
"username",
|
|
38
|
+
"password"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"properties": {
|
|
43
|
+
"type": {
|
|
44
|
+
"enum": [
|
|
45
|
+
"local-directory"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"path": {
|
|
49
|
+
"type": "string"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"required": [
|
|
53
|
+
"type",
|
|
54
|
+
"path"
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"schemaConfigs": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"properties": {
|
|
62
|
+
"orm": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"additionalProperties": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"additionalProperties": false,
|
|
67
|
+
"properties": {
|
|
68
|
+
"dialect": {
|
|
69
|
+
"enum": [
|
|
70
|
+
"mssql",
|
|
71
|
+
"mssql-azure"
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
"host": {
|
|
75
|
+
"type": "string"
|
|
76
|
+
},
|
|
77
|
+
"port": {
|
|
78
|
+
"type": "number"
|
|
79
|
+
},
|
|
80
|
+
"username": {
|
|
81
|
+
"type": "string"
|
|
82
|
+
},
|
|
83
|
+
"password": {
|
|
84
|
+
"type": "string"
|
|
85
|
+
},
|
|
86
|
+
"database": {
|
|
87
|
+
"type": "string"
|
|
88
|
+
},
|
|
89
|
+
"defaultIsolationLevel": {
|
|
90
|
+
"enum": [
|
|
91
|
+
"READ_UNCOMMITTED",
|
|
92
|
+
"READ_COMMITTED",
|
|
93
|
+
"REPEATABLE_READ",
|
|
94
|
+
"SERIALIZABLE"
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"smtp": {
|
|
101
|
+
"type": "object",
|
|
102
|
+
"additionalProperties": {
|
|
103
|
+
"type": "object",
|
|
104
|
+
"additionalProperties": false,
|
|
105
|
+
"properties": {
|
|
106
|
+
"name": {
|
|
107
|
+
"type": "string"
|
|
108
|
+
},
|
|
109
|
+
"email": {
|
|
110
|
+
"type": "string"
|
|
111
|
+
},
|
|
112
|
+
"user": {
|
|
113
|
+
"type": "string"
|
|
114
|
+
},
|
|
115
|
+
"pass": {
|
|
116
|
+
"type": "string"
|
|
117
|
+
},
|
|
118
|
+
"host": {
|
|
119
|
+
"type": "string"
|
|
120
|
+
},
|
|
121
|
+
"port": {
|
|
122
|
+
"type": "number"
|
|
123
|
+
},
|
|
124
|
+
"secure": {
|
|
125
|
+
"type": "boolean"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"required": [
|
|
129
|
+
"name",
|
|
130
|
+
"email",
|
|
131
|
+
"user",
|
|
132
|
+
"pass",
|
|
133
|
+
"host"
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"crypto": {
|
|
138
|
+
"type": "object",
|
|
139
|
+
"additionalProperties": false,
|
|
140
|
+
"properties": {
|
|
141
|
+
"key": {
|
|
142
|
+
"type": "string"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"required": [
|
|
146
|
+
"key"
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"additionalProperties": {
|
|
151
|
+
"type": "object"
|
|
152
|
+
}
|
|
153
|
+
},
|
|
6
154
|
"schemaPackage": {
|
|
7
155
|
"type": "object",
|
|
8
156
|
"additionalProperties": false,
|
|
@@ -21,7 +169,7 @@
|
|
|
21
169
|
"$ref": "#/definitions/schemaPackage"
|
|
22
170
|
}
|
|
23
171
|
},
|
|
24
|
-
"
|
|
172
|
+
"anyOf": [
|
|
25
173
|
{
|
|
26
174
|
"properties": {
|
|
27
175
|
"type": {
|
|
@@ -75,13 +223,19 @@
|
|
|
75
223
|
]
|
|
76
224
|
},
|
|
77
225
|
"server": {
|
|
78
|
-
"type": "string"
|
|
226
|
+
"type": "string"
|
|
79
227
|
},
|
|
80
228
|
"resolveFallback": {
|
|
81
229
|
"type": "object",
|
|
82
230
|
"additionalProperties": {
|
|
83
231
|
"type": "string"
|
|
84
232
|
}
|
|
233
|
+
},
|
|
234
|
+
"configs": {
|
|
235
|
+
"$ref": "#/definitions/schemaConfigs"
|
|
236
|
+
},
|
|
237
|
+
"publish": {
|
|
238
|
+
"$ref": "#/definitions/schemaPublish"
|
|
85
239
|
}
|
|
86
240
|
}
|
|
87
241
|
},
|
|
@@ -96,125 +250,25 @@
|
|
|
96
250
|
"type": "object"
|
|
97
251
|
},
|
|
98
252
|
"iis": {
|
|
99
|
-
"
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
"type": "object",
|
|
103
|
-
"properties": {
|
|
104
|
-
"orm": {
|
|
105
|
-
"type": "object",
|
|
106
|
-
"additionalProperties": {
|
|
107
|
-
"type": "object",
|
|
108
|
-
"additionalProperties": false,
|
|
109
|
-
"properties": {
|
|
110
|
-
"host": {
|
|
111
|
-
"type": "string"
|
|
112
|
-
},
|
|
113
|
-
"port": {
|
|
114
|
-
"type": "number"
|
|
115
|
-
},
|
|
116
|
-
"username": {
|
|
117
|
-
"type": "string"
|
|
118
|
-
},
|
|
119
|
-
"password": {
|
|
120
|
-
"type": "string"
|
|
121
|
-
},
|
|
122
|
-
"defaultIsolationLevel": {
|
|
123
|
-
"enum": [
|
|
124
|
-
"READ_UNCOMMITTED",
|
|
125
|
-
"READ_COMMITTED",
|
|
126
|
-
"REPEATABLE_READ",
|
|
127
|
-
"SERIALIZABLE"
|
|
128
|
-
]
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
"oneOf": [
|
|
132
|
-
{
|
|
133
|
-
"properties": {
|
|
134
|
-
"dialect": {
|
|
135
|
-
"enum": [
|
|
136
|
-
"mssql"
|
|
137
|
-
]
|
|
138
|
-
},
|
|
139
|
-
"database": {
|
|
140
|
-
"type": "string"
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
"properties": {
|
|
146
|
-
"dialect": {
|
|
147
|
-
"enum": [
|
|
148
|
-
"mssql-azure"
|
|
149
|
-
]
|
|
150
|
-
},
|
|
151
|
-
"database": {
|
|
152
|
-
"type": "string"
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
"required": [
|
|
156
|
-
"database"
|
|
157
|
-
]
|
|
158
|
-
}
|
|
159
|
-
],
|
|
160
|
-
"required": [
|
|
161
|
-
"username",
|
|
162
|
-
"password"
|
|
163
|
-
]
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
"smtp": {
|
|
167
|
-
"type": "object",
|
|
168
|
-
"additionalProperties": {
|
|
169
|
-
"type": "object",
|
|
170
|
-
"additionalProperties": false,
|
|
171
|
-
"properties": {
|
|
172
|
-
"name": {
|
|
173
|
-
"type": "string"
|
|
174
|
-
},
|
|
175
|
-
"email": {
|
|
176
|
-
"type": "string"
|
|
177
|
-
},
|
|
178
|
-
"user": {
|
|
179
|
-
"type": "string"
|
|
180
|
-
},
|
|
181
|
-
"pass": {
|
|
182
|
-
"type": "string"
|
|
183
|
-
},
|
|
184
|
-
"host": {
|
|
185
|
-
"type": "string"
|
|
186
|
-
},
|
|
187
|
-
"port": {
|
|
188
|
-
"type": "number"
|
|
189
|
-
},
|
|
190
|
-
"secure": {
|
|
191
|
-
"type": "boolean"
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
"required": [
|
|
195
|
-
"name",
|
|
196
|
-
"email",
|
|
197
|
-
"user",
|
|
198
|
-
"pass",
|
|
199
|
-
"host"
|
|
200
|
-
]
|
|
201
|
-
}
|
|
253
|
+
"oneOf": [
|
|
254
|
+
{
|
|
255
|
+
"type": "boolean"
|
|
202
256
|
},
|
|
203
|
-
|
|
257
|
+
{
|
|
204
258
|
"type": "object",
|
|
205
|
-
"additionalProperties": false,
|
|
206
259
|
"properties": {
|
|
207
|
-
"
|
|
260
|
+
"serverExeFilePath": {
|
|
208
261
|
"type": "string"
|
|
209
262
|
}
|
|
210
|
-
}
|
|
211
|
-
"required": [
|
|
212
|
-
"key"
|
|
213
|
-
]
|
|
263
|
+
}
|
|
214
264
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
265
|
+
]
|
|
266
|
+
},
|
|
267
|
+
"configs": {
|
|
268
|
+
"$ref": "#/definitions/schemaConfigs"
|
|
269
|
+
},
|
|
270
|
+
"publish": {
|
|
271
|
+
"$ref": "#/definitions/schemaPublish"
|
|
218
272
|
}
|
|
219
273
|
}
|
|
220
274
|
}
|
|
@@ -223,24 +277,33 @@
|
|
|
223
277
|
},
|
|
224
278
|
"properties": {
|
|
225
279
|
"$schema": {
|
|
226
|
-
"type": "string"
|
|
280
|
+
"type": "string",
|
|
281
|
+
"format": "uri"
|
|
227
282
|
},
|
|
228
283
|
"extends": {
|
|
229
|
-
"type": "
|
|
284
|
+
"type": "array",
|
|
285
|
+
"uniqueItems": true,
|
|
286
|
+
"items": {
|
|
287
|
+
"type": "string",
|
|
288
|
+
"format": "uri"
|
|
289
|
+
}
|
|
230
290
|
},
|
|
231
291
|
"packages": {
|
|
232
292
|
"type": "object",
|
|
233
293
|
"additionalProperties": {
|
|
234
|
-
"$ref": "#/definitions/schemaPackage"
|
|
235
|
-
"required": [
|
|
236
|
-
"type"
|
|
237
|
-
]
|
|
294
|
+
"$ref": "#/definitions/schemaPackage"
|
|
238
295
|
}
|
|
239
296
|
},
|
|
240
297
|
"overrides": {
|
|
241
298
|
"type": "object",
|
|
242
299
|
"additionalProperties": {
|
|
243
|
-
"
|
|
300
|
+
"type": "object"
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
"localUpdates": {
|
|
304
|
+
"type": "object",
|
|
305
|
+
"additionalProperties": {
|
|
306
|
+
"type": "string"
|
|
244
307
|
}
|
|
245
308
|
}
|
|
246
309
|
}
|
package/sd-tsconfig.node.json
CHANGED
package/src/bin/sd-cli.ts
CHANGED
|
@@ -59,6 +59,14 @@ const logger = Logger.get(["simplysm", "sd-cli"]);
|
|
|
59
59
|
type: "string",
|
|
60
60
|
describe: "simplysm.json 파일 경로"
|
|
61
61
|
},
|
|
62
|
+
noLint: {
|
|
63
|
+
type: "boolean",
|
|
64
|
+
describe: `lint 작업을 수행하지 않음`
|
|
65
|
+
},
|
|
66
|
+
localUpdate: {
|
|
67
|
+
type: "boolean",
|
|
68
|
+
describe: "LocalUpdate를 사용함"
|
|
69
|
+
},
|
|
62
70
|
options: {
|
|
63
71
|
type: "string",
|
|
64
72
|
describe: "옵션 설정 (설정파일에서 @로 시작하는 부분)",
|
|
@@ -76,6 +84,10 @@ const logger = Logger.get(["simplysm", "sd-cli"]);
|
|
|
76
84
|
describe: "새로 빌드한 후에 배포합니다",
|
|
77
85
|
default: false
|
|
78
86
|
},
|
|
87
|
+
noLint: {
|
|
88
|
+
type: "boolean",
|
|
89
|
+
describe: `빌드시, lint 작업을 수행하지 않음`
|
|
90
|
+
},
|
|
79
91
|
packages: {
|
|
80
92
|
type: "string",
|
|
81
93
|
describe: "수행할 패키지 설정",
|
|
@@ -128,14 +140,14 @@ const logger = Logger.get(["simplysm", "sd-cli"]);
|
|
|
128
140
|
|
|
129
141
|
process.env.SD_CLI_LOGGER_SEVERITY = "DEBUG";
|
|
130
142
|
|
|
131
|
-
Logger.setConfig({
|
|
143
|
+
Logger.setConfig(["simplysm", "sd-cli"], {
|
|
132
144
|
console: {
|
|
133
145
|
level: LoggerSeverity.debug
|
|
134
146
|
}
|
|
135
147
|
});
|
|
136
148
|
}
|
|
137
149
|
else {
|
|
138
|
-
Logger.setConfig({
|
|
150
|
+
Logger.setConfig(["simplysm", "sd-cli"], {
|
|
139
151
|
dot: true
|
|
140
152
|
});
|
|
141
153
|
}
|
|
@@ -147,7 +159,8 @@ const logger = Logger.get(["simplysm", "sd-cli"]);
|
|
|
147
159
|
.buildAsync({
|
|
148
160
|
packages: argv.packages,
|
|
149
161
|
config: argv.config,
|
|
150
|
-
options: argv.options
|
|
162
|
+
options: argv.options,
|
|
163
|
+
skipProcesses: argv.noLint ? ["lint"] : undefined
|
|
151
164
|
});
|
|
152
165
|
process.exit(0);
|
|
153
166
|
}
|
|
@@ -157,7 +170,9 @@ const logger = Logger.get(["simplysm", "sd-cli"]);
|
|
|
157
170
|
watch: true,
|
|
158
171
|
packages: argv.packages,
|
|
159
172
|
config: argv.config,
|
|
160
|
-
options: argv.options
|
|
173
|
+
options: argv.options,
|
|
174
|
+
skipProcesses: argv.noLint ? ["lint"] : undefined,
|
|
175
|
+
localUpdate: argv.localUpdate
|
|
161
176
|
});
|
|
162
177
|
}
|
|
163
178
|
else if (args[0] === "local-update") {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ISdPackageBuildResult } from "../commons";
|
|
2
|
-
import { NeverEntryError, ObjectUtil, StringUtil } from "@simplysm/sd-core-common";
|
|
2
|
+
import { NeverEntryError, ObjectUtil, SdError, StringUtil } from "@simplysm/sd-core-common";
|
|
3
3
|
import * as ts from "typescript";
|
|
4
4
|
import { FsUtil, PathUtil } from "@simplysm/sd-core-node";
|
|
5
5
|
import * as path from "path";
|
|
@@ -25,7 +25,9 @@ import {
|
|
|
25
25
|
} from "./metadata/SdAotMetadataReader";
|
|
26
26
|
import { IIvyNgModuleMetadata, SdIvyMetadataReader, TIvyNgMetadata } from "./metadata/SdIvyMetadataReader";
|
|
27
27
|
import { NgtscProgram } from "@angular/compiler-cli";
|
|
28
|
+
import { SdMetadataError } from "./metadata/SdMetadataError";
|
|
28
29
|
|
|
30
|
+
// TODO: LazyPage??
|
|
29
31
|
export class SdCliNgModuleFilesGenerator {
|
|
30
32
|
private readonly _fileCache = new Map<string, TFileCache>();
|
|
31
33
|
|
|
@@ -57,61 +59,81 @@ export class SdCliNgModuleFilesGenerator {
|
|
|
57
59
|
|
|
58
60
|
let changed = false;
|
|
59
61
|
for (const dirtyFilePath of dirtyFilePaths) {
|
|
60
|
-
|
|
62
|
+
try {
|
|
63
|
+
if (PathUtil.isChildPath(dirtyFilePath, this._moduleDistDirPath)) continue;
|
|
61
64
|
|
|
62
|
-
|
|
65
|
+
this._fileCache.delete(dirtyFilePath);
|
|
63
66
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
sourceFile,
|
|
72
|
-
metadata: new SdMyMetadataReader(sourceFile, this._program).getMetadatas()
|
|
73
|
-
});
|
|
74
|
-
changed = true;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// AOT 라이브러리
|
|
78
|
-
else if (dirtyFilePath.endsWith(".d.ts")) {
|
|
79
|
-
const sourceFile = this._program.getSourceFile(dirtyFilePath);
|
|
80
|
-
if (!sourceFile) throw new NeverEntryError();
|
|
81
|
-
|
|
82
|
-
// from METADATA
|
|
83
|
-
const metadataFilePath = dirtyFilePath.replace(/\.d\.ts$/, ".metadata.json");
|
|
84
|
-
const sdMetadataFilePath = dirtyFilePath.replace(/\.d\.ts$/, ".sd-metadata.json");
|
|
85
|
-
|
|
86
|
-
if (FsUtil.exists(metadataFilePath)) {
|
|
87
|
-
const metadataRoot = await FsUtil.readJsonAsync(metadataFilePath);
|
|
67
|
+
// 내 소스코드
|
|
68
|
+
if (dirtyFilePath.endsWith(".ts") && !dirtyFilePath.endsWith(".d.ts")) {
|
|
69
|
+
const sourceFile = this._program.getSourceFile(dirtyFilePath);
|
|
70
|
+
if (!sourceFile) { // 삭제된 파일
|
|
71
|
+
changed = true;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
88
74
|
|
|
89
75
|
this._fileCache.set(dirtyFilePath, {
|
|
90
|
-
type: "
|
|
76
|
+
type: "my",
|
|
91
77
|
sourceFile,
|
|
92
|
-
|
|
78
|
+
metadata: new SdMyMetadataReader(sourceFile, this._program).getMetadatas()
|
|
93
79
|
});
|
|
94
80
|
changed = true;
|
|
95
81
|
}
|
|
96
|
-
else if (FsUtil.exists(sdMetadataFilePath)) {
|
|
97
|
-
const metadataRoot = await FsUtil.readJsonAsync(sdMetadataFilePath);
|
|
98
82
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
83
|
+
// AOT 라이브러리
|
|
84
|
+
else if (dirtyFilePath.endsWith(".d.ts")) {
|
|
85
|
+
const sourceFile = this._program.getSourceFile(dirtyFilePath);
|
|
86
|
+
if (!sourceFile) { // 삭제된 파일
|
|
87
|
+
changed = true;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// from METADATA
|
|
92
|
+
const metadataFilePath = dirtyFilePath.replace(/\.d\.ts$/, ".metadata.json");
|
|
93
|
+
const sdMetadataFilePath = dirtyFilePath.replace(/\.d\.ts$/, ".sd-metadata.json");
|
|
94
|
+
|
|
95
|
+
if (FsUtil.exists(metadataFilePath)) {
|
|
96
|
+
const metadataRoot = await FsUtil.readJsonAsync(metadataFilePath);
|
|
97
|
+
|
|
98
|
+
this._fileCache.set(dirtyFilePath, {
|
|
99
|
+
type: "aot",
|
|
100
|
+
sourceFile,
|
|
101
|
+
...new SdAotMetadataReader(metadataRoot).getMetadatas()
|
|
102
|
+
});
|
|
103
|
+
changed = true;
|
|
104
|
+
}
|
|
105
|
+
else if (FsUtil.exists(sdMetadataFilePath)) {
|
|
106
|
+
const metadataRoot = await FsUtil.readJsonAsync(sdMetadataFilePath);
|
|
107
|
+
|
|
108
|
+
this._fileCache.set(dirtyFilePath, {
|
|
109
|
+
type: "aot",
|
|
110
|
+
sourceFile,
|
|
111
|
+
...new SdAotMetadataReader(metadataRoot).getMetadatas()
|
|
112
|
+
});
|
|
113
|
+
changed = true;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// from IVY
|
|
117
|
+
else {
|
|
118
|
+
this._fileCache.set(dirtyFilePath, {
|
|
119
|
+
type: "ivy",
|
|
120
|
+
sourceFile,
|
|
121
|
+
...new SdIvyMetadataReader(sourceFile, ngProgram).getMetadatas()
|
|
122
|
+
});
|
|
123
|
+
changed = true;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
if (err instanceof SdMetadataError) {
|
|
129
|
+
result.push({
|
|
130
|
+
filePath: err.fileName,
|
|
131
|
+
severity: "error",
|
|
132
|
+
message: err.message
|
|
103
133
|
});
|
|
104
|
-
changed = true;
|
|
105
134
|
}
|
|
106
|
-
|
|
107
|
-
// from IVY
|
|
108
135
|
else {
|
|
109
|
-
|
|
110
|
-
type: "ivy",
|
|
111
|
-
sourceFile,
|
|
112
|
-
...new SdIvyMetadataReader(sourceFile, ngProgram).getMetadatas()
|
|
113
|
-
});
|
|
114
|
-
changed = true;
|
|
136
|
+
throw new SdError(err, "'" + dirtyFilePath + "' 메타데이터 로딩중 에러");
|
|
115
137
|
}
|
|
116
138
|
}
|
|
117
139
|
}
|
|
@@ -120,29 +142,46 @@ export class SdCliNgModuleFilesGenerator {
|
|
|
120
142
|
}
|
|
121
143
|
|
|
122
144
|
public async generateAsync(): Promise<{ result: ISdPackageBuildResult[]; changedFilePaths: string[] }> {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
145
|
+
try {
|
|
146
|
+
let moduleInfoMap = this._getModuleInfoMap();
|
|
147
|
+
moduleInfoMap = this._mergeCircularModuleInfoMap(moduleInfoMap);
|
|
148
|
+
|
|
149
|
+
const routingModuleMap = await this._getRoutingModuleInfoMapAsync();
|
|
150
|
+
|
|
151
|
+
const changedFilePaths = [
|
|
152
|
+
...await this._writeNgModuleFileAsync(moduleInfoMap),
|
|
153
|
+
...await this._writeRoutingModuleFileAsync(moduleInfoMap, routingModuleMap)
|
|
154
|
+
];
|
|
155
|
+
|
|
156
|
+
const genFilePaths = [...moduleInfoMap.keys(), ...routingModuleMap.keys()].distinct();
|
|
157
|
+
const delFilePaths = (await FsUtil.globAsync(path.resolve(this._moduleDistDirPath, "**", "*")))
|
|
158
|
+
.filter((item) => (
|
|
159
|
+
!genFilePaths.includes(PathUtil.posix(item))
|
|
160
|
+
&& !genFilePaths.some((item1) => PathUtil.isChildPath(item1, item))
|
|
161
|
+
))
|
|
162
|
+
.map((item) => PathUtil.posix(item));
|
|
163
|
+
for (const delFilePath of delFilePaths) {
|
|
164
|
+
changedFilePaths.push(delFilePath);
|
|
165
|
+
await FsUtil.removeAsync(delFilePath);
|
|
166
|
+
}
|
|
144
167
|
|
|
145
|
-
|
|
168
|
+
return { result: [], changedFilePaths: changedFilePaths.distinct() };
|
|
169
|
+
}
|
|
170
|
+
catch (err) {
|
|
171
|
+
if (err instanceof SdMetadataError) {
|
|
172
|
+
return {
|
|
173
|
+
result: [{
|
|
174
|
+
filePath: err.fileName,
|
|
175
|
+
severity: "error",
|
|
176
|
+
message: err.message
|
|
177
|
+
}],
|
|
178
|
+
changedFilePaths: []
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
throw new SdError(err, "메타데이터 생성중 에러");
|
|
183
|
+
}
|
|
184
|
+
}
|
|
146
185
|
}
|
|
147
186
|
|
|
148
187
|
// region NgModule
|
|
@@ -512,7 +551,10 @@ export class ${moduleInfo.className} {
|
|
|
512
551
|
const expFilePath = this._getResolvedFilePath(filePath, moduleName);
|
|
513
552
|
if (StringUtil.isNullOrEmpty(expFilePath)) throw new NeverEntryError();
|
|
514
553
|
const expFileCache = this._fileCache.get(expFilePath);
|
|
515
|
-
if (!expFileCache
|
|
554
|
+
if (!expFileCache) {
|
|
555
|
+
throw new SdMetadataError(filePath, `'${filePath}'에서 '${moduleName}'에 대한 파일 '${expFilePath}'을 찾을 수 없습니다.`);
|
|
556
|
+
}
|
|
557
|
+
if (expFileCache.type !== "aot") throw new NeverEntryError();
|
|
516
558
|
const newExp = expFileCache.exports.single((item) => (item.as ?? item.name) === targetName);
|
|
517
559
|
if (!newExp) throw new NeverEntryError();
|
|
518
560
|
|
|
@@ -612,7 +654,7 @@ export class ${moduleInfo.className} {
|
|
|
612
654
|
if (fileCache.type !== "my") continue;
|
|
613
655
|
|
|
614
656
|
for (const metadata of fileCache.metadata) {
|
|
615
|
-
if (
|
|
657
|
+
if (!metadata.className.endsWith("Page")) continue;
|
|
616
658
|
|
|
617
659
|
const newRoutingModuleInfo: IGenRoutingModuleInfo = {
|
|
618
660
|
path: "",
|
|
@@ -681,7 +723,6 @@ export class ${moduleInfo.className} {
|
|
|
681
723
|
const moduleImportTexts: string[] = [];
|
|
682
724
|
|
|
683
725
|
const pageFilePath = this._getModuleModuleImportName(path.dirname(distFilePath), routingModuleInfo.page.moduleFilePath);
|
|
684
|
-
moduleImportTexts.push(`import { ${routingModuleInfo.page.name} } from "${pageFilePath}";`);
|
|
685
726
|
|
|
686
727
|
let content: string;
|
|
687
728
|
if (path.basename(distFilePath) === "_routes.ts") {
|
|
@@ -697,6 +738,7 @@ export const routes: Routes = [
|
|
|
697
738
|
else {
|
|
698
739
|
moduleImportTexts.push(`import { NgModule } from "@angular/core";`);
|
|
699
740
|
moduleImportTexts.push(`import { RouterModule } from "@angular/router";`);
|
|
741
|
+
moduleImportTexts.push(`import { ${routingModuleInfo.page.name} } from "${pageFilePath}";`);
|
|
700
742
|
|
|
701
743
|
const thisPageModuleInfoEntry = Array.from(moduleInfoMap.entries())
|
|
702
744
|
.single((item) => item[1].exports.some((exp) => exp.moduleFilePath === routingModuleInfo.page.moduleFilePath && exp.name === routingModuleInfo.page.name));
|
|
@@ -745,7 +787,9 @@ export class ${routingModuleInfo.page.name}RoutingModule {
|
|
|
745
787
|
private _getRoutingModuleText(routingModuleInfo: IGenRoutingModuleInfo, distFilePath: string): string {
|
|
746
788
|
let content = "{\r\n";
|
|
747
789
|
content += ` path: "${routingModuleInfo.path}",\r\n`;
|
|
748
|
-
|
|
790
|
+
if (path.basename(distFilePath) !== "_routes.ts") {
|
|
791
|
+
content += ` component: ${routingModuleInfo.page.name},\r\n`;
|
|
792
|
+
}
|
|
749
793
|
if (routingModuleInfo.children.length > 0) {
|
|
750
794
|
content += ` children: [\r\n`;
|
|
751
795
|
for (const child of routingModuleInfo.children) {
|