@simplysm/sd-cli 7.0.305 → 7.1.11

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.
Files changed (62) hide show
  1. package/README.md +24 -18
  2. package/dist/bin/sd-cli.d.ts +1 -1
  3. package/dist/bin/sd-cli.mjs +2 -8
  4. package/dist/builder/SdCliClientBuilder.d.ts +1 -1
  5. package/dist/builder/SdCliClientBuilder.mjs +75 -23
  6. package/dist/builder/SdCliServerBuilder.d.ts +1 -1
  7. package/dist/builder/SdCliServerBuilder.mjs +8 -7
  8. package/dist/builder/SdCliTsLibBuilder.mjs +2 -2
  9. package/dist/commons.d.ts +2 -1
  10. package/dist/entry-points/SdCliPrepare.mjs +53 -22
  11. package/dist/entry-points/SdCliProjectGenerator.mjs +37 -27
  12. package/dist/entry-points/file/base/fc_package_npmconfig.mjs +2 -1
  13. package/dist/entry-points/file/project/fc_project_gitignore.mjs +12 -2
  14. package/dist/entry-points/file/project/fc_project_npmconfig.mjs +13 -11
  15. package/dist/entry-points/file/project/fc_project_readme.mjs +1 -1
  16. package/dist/entry-points/file/project/fc_project_tsconfig.mjs +2 -2
  17. package/dist/entry-points/file/project/fc_project_yarnrc.d.ts +1 -0
  18. package/dist/entry-points/file/project/fc_project_yarnrc.mjs +15 -0
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.mjs +2 -2
  21. package/dist/ng-tools/SdCliNgModuleGenerator.d.ts +2 -1
  22. package/dist/ng-tools/SdCliNgModuleGenerator.mjs +41 -21
  23. package/dist/ng-tools/babel/SdCliBbFileMetadata.mjs +17 -5
  24. package/dist/ng-tools/babel/SdCliBbRootMetadata.mjs +19 -7
  25. package/dist/ng-tools/babel/SdCliBbUtil.d.ts +2 -2
  26. package/dist/ng-tools/babel/SdCliBbUtil.mjs +3 -3
  27. package/dist/ng-tools/babel/TSdCliBbTypeMetadata.d.ts +13 -2
  28. package/dist/ng-tools/babel/TSdCliBbTypeMetadata.mjs +25 -1
  29. package/dist/packages/SdCliPackage.mjs +2 -2
  30. package/dist/utils/SdCliBuildResultUtil.mjs +3 -3
  31. package/docs/client-router.md +1 -1
  32. package/docs/client-sw.md +1 -1
  33. package/docs/conf-orm.md +1 -1
  34. package/docs/lib-local-update.md +5 -5
  35. package/package.json +46 -42
  36. package/src/bin/sd-cli.ts +1 -11
  37. package/src/builder/SdCliClientBuilder.ts +81 -22
  38. package/src/builder/SdCliServerBuilder.ts +7 -6
  39. package/src/builder/SdCliTsLibBuilder.ts +1 -1
  40. package/src/commons.ts +2 -1
  41. package/src/entry-points/SdCliPrepare.ts +52 -21
  42. package/src/entry-points/SdCliProjectGenerator.ts +40 -27
  43. package/src/entry-points/file/base/fc_package_npmconfig.ts +1 -0
  44. package/src/entry-points/file/project/fc_project_gitignore.ts +11 -1
  45. package/src/entry-points/file/project/fc_project_npmconfig.ts +12 -10
  46. package/src/entry-points/file/project/fc_project_readme.ts +1 -1
  47. package/src/entry-points/file/project/fc_project_tsconfig.ts +1 -1
  48. package/src/entry-points/file/project/fc_project_yarnrc.ts +14 -0
  49. package/src/index.ts +1 -1
  50. package/src/ng-tools/SdCliNgModuleGenerator.ts +53 -20
  51. package/src/ng-tools/babel/SdCliBbFileMetadata.ts +16 -2
  52. package/src/ng-tools/babel/SdCliBbRootMetadata.ts +22 -6
  53. package/src/ng-tools/babel/SdCliBbUtil.ts +4 -4
  54. package/src/ng-tools/babel/TSdCliBbTypeMetadata.ts +36 -1
  55. package/src/packages/SdCliPackage.ts +1 -1
  56. package/src/utils/SdCliBuildResultUtil.ts +3 -2
  57. package/.eslintrc.cjs +0 -21
  58. package/dist/entry-points/SdCliNpm.d.ts +0 -6
  59. package/dist/entry-points/SdCliNpm.mjs +0 -24
  60. package/src/entry-points/SdCliNpm.ts +0 -28
  61. package/tsconfig-build.json +0 -16
  62. package/tsconfig.json +0 -39
@@ -158,7 +158,7 @@ export class SdCliBbRootMetadata {
158
158
  for (const ngDepPath of ngDepPaths) {
159
159
  const npmConfig = FsUtil.readJson(path.resolve(ngDepPath, "package.json")) as INpmConfig;
160
160
 
161
- const entryFilePath = npmConfig["es2015"] ?? npmConfig["browser"] ?? npmConfig["module"] ?? npmConfig["main"] ?? npmConfig["default"];
161
+ const entryFilePath = npmConfig["es2020"] ?? npmConfig["es2015"] ?? npmConfig["browser"] ?? npmConfig["module"] ?? npmConfig["main"] ?? npmConfig["default"];
162
162
  if (entryFilePath === undefined) {
163
163
  entryMap.set(npmConfig.name, {
164
164
  rootPath: ngDepPath,
@@ -167,6 +167,10 @@ export class SdCliBbRootMetadata {
167
167
  }
168
168
  else if (typeof entryFilePath === "string") {
169
169
  const realPath = this._getRealFilePath(path.resolve(ngDepPath, entryFilePath));
170
+ if (realPath?.endsWith(".json")) {
171
+ continue;
172
+ }
173
+
170
174
  entryMap.set(npmConfig.name, {
171
175
  rootPath: ngDepPath,
172
176
  entryFilePath: realPath
@@ -178,6 +182,10 @@ export class SdCliBbRootMetadata {
178
182
  const exportResult = this._getGlobExportResult(PathUtil.posix(npmConfig.name, key), exportPath);
179
183
  for (const exportResultItem of exportResult) {
180
184
  const exportRealPath = this._getRealFilePath(exportResultItem.target);
185
+ if (exportResultItem.target.endsWith(".json")) {
186
+ continue;
187
+ }
188
+
181
189
  entryMap.set(exportResultItem.name, {
182
190
  rootPath: ngDepPath,
183
191
  entryFilePath: exportRealPath
@@ -190,23 +198,31 @@ export class SdCliBbRootMetadata {
190
198
  const exportKeys = Object.keys(npmConfig.exports);
191
199
  for (const exportKey of exportKeys) {
192
200
  if (
193
- exportKey.includes("/locales") ||
194
- exportKey.endsWith(".json") ||
195
- exportKey.endsWith("/testing") ||
196
- exportKey.endsWith("/upgrade")
201
+ exportKey.startsWith("./locales") ||
202
+ exportKey.startsWith("./testing") ||
203
+ exportKey.startsWith("./upgrade")
197
204
  ) {
198
205
  continue;
199
206
  }
200
207
 
201
- const expEntryFilePath = npmConfig.exports[exportKey]["es2015"] ??
208
+ const expEntryFilePath = npmConfig.exports[exportKey]["es2020"] ??
209
+ npmConfig.exports[exportKey]["es2015"] ??
202
210
  npmConfig.exports[exportKey]["browser"] ??
203
211
  npmConfig.exports[exportKey]["module"] ??
204
212
  npmConfig.exports[exportKey]["main"] ??
205
213
  npmConfig.exports[exportKey]["default"];
206
214
  if (typeof expEntryFilePath === "string") {
215
+ if (expEntryFilePath.endsWith(".json")) {
216
+ continue;
217
+ }
218
+
207
219
  const exportPath = path.resolve(ngDepPath, expEntryFilePath);
208
220
  const exportResult = this._getGlobExportResult(PathUtil.posix(npmConfig.name, exportKey), exportPath);
209
221
  for (const exportResultItem of exportResult) {
222
+ if (exportResultItem.target.endsWith(".json")) {
223
+ continue;
224
+ }
225
+
210
226
  const exportRealPath = this._getRealFilePath(exportResultItem.target);
211
227
  entryMap.set(exportResultItem.name, {
212
228
  rootPath: ngDepPath,
@@ -1,12 +1,12 @@
1
- import { Node } from "@babel/types";
1
+ import { Node, SourceLocation } from "@babel/types";
2
2
  import { SdCliBuildResultError } from "../../SdCliBuildResultError";
3
3
 
4
4
  export class SdCliBbUtil {
5
- public static error(message: string, filePath?: string, meta?: Node): SdCliBuildResultError {
5
+ public static error(message: string, filePath?: string, meta?: Node | SourceLocation["start"]): SdCliBuildResultError {
6
6
  return new SdCliBuildResultError({
7
7
  filePath,
8
- line: meta?.loc?.start.line,
9
- char: meta?.loc?.start.column,
8
+ line: meta && "loc" in meta ? meta.loc?.start.line : meta && "line" in meta ? meta.line : undefined,
9
+ char: meta && "loc" in meta ? meta.loc?.start.column : meta && "column" in meta ? meta.column : undefined,
10
10
  code: undefined,
11
11
  severity: "error",
12
12
  message: message
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  ArrayExpression,
3
3
  ClassDeclaration,
4
+ ConditionalExpression,
4
5
  FunctionDeclaration,
5
6
  isAssignmentExpression,
6
7
  isExpressionStatement,
@@ -26,7 +27,8 @@ export type TSdCliBbTypeMetadata = SdCliBbClassMetadata |
26
27
  SdCliBbVariableMetadata |
27
28
  SdCliBbFunctionMetadata |
28
29
  SdCliBbObjectMetadata |
29
- SdCliBbArrayMetadata;
30
+ SdCliBbArrayMetadata |
31
+ SdCliBbConditionMetadata;
30
32
 
31
33
  export class SdCliBbClassMetadata {
32
34
  public constructor(private readonly _fileMeta: SdCliBbFileMetadata,
@@ -175,3 +177,36 @@ export class SdCliBbArrayMetadata {
175
177
  return this._valueCache;
176
178
  }
177
179
  }
180
+
181
+ export class SdCliBbConditionMetadata {
182
+ public constructor(private readonly _fileMeta: SdCliBbFileMetadata,
183
+ private readonly _metadata: ConditionalExpression) {
184
+ }
185
+
186
+ private _testCache?: TSdCliBbMetadata | undefined;
187
+
188
+ public get test(): TSdCliBbMetadata | undefined {
189
+ if (this._testCache === undefined) {
190
+ this._testCache = this._fileMeta.getMetaFromRaw(this._metadata.test);
191
+ }
192
+ return this._testCache;
193
+ }
194
+
195
+ private _consequentCache?: TSdCliBbMetadata | undefined;
196
+
197
+ public get consequent(): TSdCliBbMetadata | undefined {
198
+ if (this._consequentCache === undefined) {
199
+ this._consequentCache = this._fileMeta.getMetaFromRaw(this._metadata.consequent);
200
+ }
201
+ return this._consequentCache;
202
+ }
203
+
204
+ private _alternateCache?: TSdCliBbMetadata | undefined;
205
+
206
+ public get alternate(): TSdCliBbMetadata | undefined {
207
+ if (this._alternateCache === undefined) {
208
+ this._alternateCache = this._fileMeta.getMetaFromRaw(this._metadata.alternate);
209
+ }
210
+ return this._alternateCache;
211
+ }
212
+ }
@@ -123,7 +123,7 @@ export class SdCliPackage extends EventEmitter {
123
123
  if (this.config.type === "library") {
124
124
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
125
125
  if (this.config.publish === "npm") {
126
- await SdProcess.spawnAsync("npm publish --access public", { cwd: this.rootPath });
126
+ await SdProcess.spawnAsync("yarn npm publish --access public", { cwd: this.rootPath });
127
127
  }
128
128
  else {
129
129
  throw new NeverEntryError();
@@ -49,8 +49,8 @@ export class SdCliBuildResultUtil {
49
49
  private static _convertFromWebpackError(severity: "warning" | "error", err: webpack.WebpackError): ISdCliPackageBuildResult {
50
50
  return {
51
51
  filePath: (err.file as string | undefined) ?? (err.module as webpack.Module | undefined)?.["request"],
52
- line: err.file ? err.loc["start"]?.line : undefined,
53
- char: err.file ? err.loc["start"]?.column : undefined,
52
+ line: err.file ? err.loc?.["start"]?.line : undefined, // eslint-disable-line
53
+ char: err.file ? err.loc?.["start"]?.column : undefined, // eslint-disable-line
54
54
  code: err.name,
55
55
  severity,
56
56
  message: err.message
@@ -71,6 +71,7 @@ export class SdCliBuildResultUtil {
71
71
  str += `${result.code}: `;
72
72
  }
73
73
  str += `${result.severity} ${result.message}`;
74
+
74
75
  return str;
75
76
  }
76
77
  }
package/.eslintrc.cjs DELETED
@@ -1,21 +0,0 @@
1
- module.exports = {
2
- overrides: [
3
- {
4
- files: ["*.ts"],
5
- parserOptions: {
6
- tsconfigRootDir: __dirname,
7
- project: "tsconfig.json"
8
- },
9
- settings: {
10
- "import/resolver": {
11
- "typescript": {
12
- project: "tsconfig.json"
13
- }
14
- }
15
- },
16
- rules: {
17
- "@simplysm/ts-no-throw-not-implement-error": "off"
18
- }
19
- }
20
- ]
21
- };
@@ -1,6 +0,0 @@
1
- export declare class SdCliNpm {
2
- private readonly _rootPath;
3
- private readonly _logger;
4
- constructor(_rootPath: string);
5
- updateAsync(): Promise<void>;
6
- }
@@ -1,24 +0,0 @@
1
- import { Logger, SdProcess } from "@simplysm/sd-core-node";
2
- import { SdCliPrepare } from "./SdCliPrepare";
3
- export class SdCliNpm {
4
- constructor(_rootPath) {
5
- this._rootPath = _rootPath;
6
- this._logger = Logger.get(["simplysm", "sd-cli", this.constructor.name]);
7
- }
8
- async updateAsync() {
9
- try {
10
- this._logger.debug("업데이트할 패키지 확인...");
11
- await SdProcess.spawnAsync("npm outdated", { cwd: this._rootPath });
12
- }
13
- catch (err) {
14
- this._logger.debug("업데이트 시작...");
15
- await SdProcess.spawnAsync("npm update", { cwd: this._rootPath });
16
- this._logger.debug("sd-cli 준비...");
17
- await new SdCliPrepare().prepareAsync();
18
- this._logger.info("노드 패키지 업데이트 완료");
19
- return;
20
- }
21
- this._logger.warn("업데이트할 패키지가 없습니다.");
22
- }
23
- }
24
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU2RDbGlOcG0uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZW50cnktcG9pbnRzL1NkQ2xpTnBtLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQUUsU0FBUyxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDM0QsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBRTlDLE1BQU0sT0FBTyxRQUFRO0lBR25CLFlBQW9DLFNBQWlCO1FBQWpCLGNBQVMsR0FBVCxTQUFTLENBQVE7UUFGcEMsWUFBTyxHQUFHLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQyxVQUFVLEVBQUUsUUFBUSxFQUFFLElBQUksQ0FBQyxXQUFXLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQztJQUdyRixDQUFDO0lBRU0sS0FBSyxDQUFDLFdBQVc7UUFDdEIsSUFBSTtZQUNGLElBQUksQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLGlCQUFpQixDQUFDLENBQUM7WUFDdEMsTUFBTSxTQUFTLENBQUMsVUFBVSxDQUFDLGNBQWMsRUFBRSxFQUFFLEdBQUcsRUFBRSxJQUFJLENBQUMsU0FBUyxFQUFFLENBQUMsQ0FBQztTQUNyRTtRQUNELE9BQU8sR0FBRyxFQUFFO1lBQ1YsSUFBSSxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsWUFBWSxDQUFDLENBQUM7WUFDakMsTUFBTSxTQUFTLENBQUMsVUFBVSxDQUFDLFlBQVksRUFBRSxFQUFFLEdBQUcsRUFBRSxJQUFJLENBQUMsU0FBUyxFQUFFLENBQUMsQ0FBQztZQUVsRSxJQUFJLENBQUMsT0FBTyxDQUFDLEtBQUssQ0FBQyxjQUFjLENBQUMsQ0FBQztZQUNuQyxNQUFNLElBQUksWUFBWSxFQUFFLENBQUMsWUFBWSxFQUFFLENBQUM7WUFFeEMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsZ0JBQWdCLENBQUMsQ0FBQztZQUNwQyxPQUFPO1NBQ1I7UUFFRCxJQUFJLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0lBQ3hDLENBQUM7Q0FDRiJ9
@@ -1,28 +0,0 @@
1
- import { Logger, SdProcess } from "@simplysm/sd-core-node";
2
- import { SdCliPrepare } from "./SdCliPrepare";
3
-
4
- export class SdCliNpm {
5
- private readonly _logger = Logger.get(["simplysm", "sd-cli", this.constructor.name]);
6
-
7
- public constructor(private readonly _rootPath: string) {
8
- }
9
-
10
- public async updateAsync(): Promise<void> {
11
- try {
12
- this._logger.debug("업데이트할 패키지 확인...");
13
- await SdProcess.spawnAsync("npm outdated", { cwd: this._rootPath });
14
- }
15
- catch (err) {
16
- this._logger.debug("업데이트 시작...");
17
- await SdProcess.spawnAsync("npm update", { cwd: this._rootPath });
18
-
19
- this._logger.debug("sd-cli 준비...");
20
- await new SdCliPrepare().prepareAsync();
21
-
22
- this._logger.info("노드 패키지 업데이트 완료");
23
- return;
24
- }
25
-
26
- this._logger.warn("업데이트할 패키지가 없습니다.");
27
- }
28
- }
@@ -1,16 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "lib": [
5
- "ES2020"
6
- ],
7
- "outDir": "./dist",
8
- "declaration": true
9
- },
10
- "files": [
11
- "src/bin/sd-cli.ts",
12
- "src/index.ts",
13
- "src/worker/build-worker.ts",
14
- "src/worker/server-worker.ts"
15
- ]
16
- }
package/tsconfig.json DELETED
@@ -1,39 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "lib": [
5
- "ES2020"
6
- ],
7
- "outDir": "./dist",
8
- "baseUrl": ".",
9
- "paths": {
10
- "@simplysm/sd-core-common": [
11
- "../sd-core-common/src/index.ts"
12
- ],
13
- "@simplysm/sd-core-node": [
14
- "../sd-core-node/src/index.ts"
15
- ],
16
- "@simplysm/sd-service-common": [
17
- "../sd-service-common/src/index.ts"
18
- ],
19
- "@simplysm/sd-service-server": [
20
- "../sd-service-server/src/index.ts"
21
- ],
22
- "@simplysm/sd-orm-common": [
23
- "../sd-orm-common/src/index.ts"
24
- ],
25
- "@simplysm/sd-orm-node": [
26
- "../sd-orm-node/src/index.ts"
27
- ],
28
- "@simplysm/sd-storage": [
29
- "../sd-storage/src/index.ts"
30
- ]
31
- }
32
- },
33
- "files": [
34
- "src/bin/sd-cli.ts",
35
- "src/index.ts",
36
- "src/worker/build-worker.ts",
37
- "src/worker/server-worker.ts"
38
- ]
39
- }