@simplysm/sd-cli 7.0.38 → 7.0.43

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 (36) hide show
  1. package/.eslintrc.cjs +2 -2
  2. package/dist/bin/sd-cli.mjs +3 -2
  3. package/dist/build-tool/SdCliCacheCompilerHost.mjs +1 -1
  4. package/dist/build-tool/SdCliNgCacheCompilerHost.mjs +3 -3
  5. package/dist/build-tool/SdCliPackageLinter.mjs +1 -1
  6. package/dist/builder/SdCliClientBuilder.mjs +197 -120
  7. package/dist/builder/SdCliJsLibBuilder.mjs +7 -3
  8. package/dist/builder/SdCliServerBuilder.mjs +58 -34
  9. package/dist/builder/SdCliTsLibBuilder.d.ts +1 -1
  10. package/dist/builder/SdCliTsLibBuilder.mjs +13 -9
  11. package/dist/commons.d.ts +1 -0
  12. package/dist/entry-points/SdCliLocalUpdate.mjs +1 -1
  13. package/dist/entry-points/SdCliNpm.mjs +1 -1
  14. package/dist/entry-points/SdCliPrepare.mjs +1 -1
  15. package/dist/entry-points/SdCliWorkspace.mjs +5 -5
  16. package/dist/packages/SdCliPackage.mjs +2 -2
  17. package/dist/utils/SdCliBuildResultUtil.mjs +2 -2
  18. package/dist/utils/SdCliConfigUtil.mjs +2 -2
  19. package/package.json +5 -5
  20. package/src/bin/sd-cli.ts +2 -1
  21. package/src/build-tool/SdCliCacheCompilerHost.ts +1 -1
  22. package/src/build-tool/SdCliNgCacheCompilerHost.ts +3 -3
  23. package/src/build-tool/SdCliPackageLinter.ts +1 -1
  24. package/src/builder/SdCliClientBuilder.ts +199 -118
  25. package/src/builder/SdCliJsLibBuilder.ts +7 -3
  26. package/src/builder/SdCliServerBuilder.ts +59 -33
  27. package/src/builder/SdCliTsLibBuilder.ts +14 -9
  28. package/src/commons.ts +1 -0
  29. package/src/entry-points/SdCliLocalUpdate.ts +1 -1
  30. package/src/entry-points/SdCliNpm.ts +1 -1
  31. package/src/entry-points/SdCliPrepare.ts +1 -1
  32. package/src/entry-points/SdCliWorkspace.ts +5 -4
  33. package/src/packages/SdCliPackage.ts +2 -2
  34. package/src/utils/SdCliBuildResultUtil.ts +1 -1
  35. package/src/utils/SdCliConfigUtil.ts +2 -2
  36. package/tsconfig.json +4 -7
@@ -1,7 +1,7 @@
1
1
  import { INpmConfig, ISdCliPackageBuildResult } from "../commons";
2
2
  import { EventEmitter } from "events";
3
3
  import ts from "typescript";
4
- import { FsUtil, Logger, PathUtil, SdFsWatcher } from "@simplysm/sd-core-node";
4
+ import { FsUtil, Logger, PathUtil, SdFsWatcher } from "@simplysm/sd-core/node";
5
5
  import * as path from "path";
6
6
  import { createHash } from "crypto";
7
7
  import { SdCliBuildResultUtil } from "../utils/SdCliBuildResultUtil";
@@ -33,7 +33,7 @@ export class SdCliTsLibBuilder extends EventEmitter {
33
33
 
34
34
  private readonly _isAngular: boolean;
35
35
 
36
- public constructor(private readonly _rootPath) {
36
+ public constructor(private readonly _rootPath: string) {
37
37
  super();
38
38
  this._linter = new SdCliPackageLinter(this._rootPath);
39
39
 
@@ -78,15 +78,20 @@ export class SdCliTsLibBuilder extends EventEmitter {
78
78
  this._fileCache.delete(PathUtil.posix(changeFilePath));
79
79
  }
80
80
 
81
+ const watchBuildResults: ISdCliPackageBuildResult[] = [];
82
+
81
83
  // 빌드
82
84
  const watchBuildPack = this._createSdBuildPack(this._parsedTsconfig);
85
+ watchBuildResults.push(...await this._runBuilderAsync(watchBuildPack.builder, watchBuildPack.ngCompiler));
83
86
 
84
87
  // 린트
85
- const watchBuildResults = await this._runBuilderAsync(watchBuildPack.builder, watchBuildPack.ngCompiler);
86
- watchBuildResults.push(...await this._linter.lintAsync([
88
+ const lintFilePaths = [
87
89
  ...watchBuildPack.affectedSourceFiles.map((item) => item.fileName),
88
- ...changeFilePaths
89
- ], watchBuildPack.program));
90
+ ...changeInfos.filter((item) => ["add", "change"].includes(item.event)).map((item) => item.path)
91
+ ];
92
+ if (lintFilePaths.length > 0) {
93
+ watchBuildResults.push(...await this._linter.lintAsync(lintFilePaths, watchBuildPack.program));
94
+ }
90
95
 
91
96
  const watchRelatedPaths = await this.getAllRelatedPathsAsync();
92
97
  watcher.add(watchRelatedPaths);
@@ -194,7 +199,7 @@ export class SdCliTsLibBuilder extends EventEmitter {
194
199
  }
195
200
  catch (err) {
196
201
  if (err instanceof sass.Exception) {
197
- const matches = err.sassStack.match(/^(.*\.sd\.scss) ([0-9]*):([0-9]*)/)!;
202
+ const matches = (/^(.*\.sd\.scss) ([0-9]*):([0-9]*)/).exec(err.sassStack)!;
198
203
  const filePath = path.resolve(matches[1].replace(/\.sd\.scss/, "").replace(/^\.:/, item => item.toUpperCase()));
199
204
  const scssLine = matches[2];
200
205
  const scssChar = matches[3];
@@ -206,7 +211,7 @@ export class SdCliTsLibBuilder extends EventEmitter {
206
211
  char: undefined,
207
212
  code: undefined,
208
213
  severity: "error",
209
- message: `스타일(${scssLine}:${scssChar}): ${message}`
214
+ message: `스타일(${scssLine}:${scssChar}): ${message}\n${err.message}`
210
215
  }];
211
216
  }
212
217
 
@@ -234,7 +239,7 @@ export class SdCliTsLibBuilder extends EventEmitter {
234
239
  const affectedSourceFileSet: Set<ts.SourceFile> = new Set<ts.SourceFile>();
235
240
  while (true) {
236
241
  const result = this._builder.getSemanticDiagnosticsOfNextAffectedFile(undefined, (sourceFile) => {
237
- if (ngCompiler && ngCompiler.ignoreForDiagnostics.has(sourceFile) && sourceFile.fileName.endsWith(".ngtypecheck.ts")) {
242
+ if (ngCompiler?.ignoreForDiagnostics.has(sourceFile) && sourceFile.fileName.endsWith(".ngtypecheck.ts")) {
238
243
  const orgFileName = sourceFile.fileName.slice(0, -15) + ".ts";
239
244
  const orgSourceFile = this._builder!.getSourceFile(orgFileName);
240
245
  if (orgSourceFile) {
package/src/commons.ts CHANGED
@@ -58,4 +58,5 @@ export interface ISdCliServerPackageConfig {
58
58
  export interface ISdCliClientPackageConfig {
59
59
  type: "client";
60
60
  server: string;
61
+ env?: Record<string, string>;
61
62
  }
@@ -1,5 +1,5 @@
1
1
  import { SdCliConfigUtil } from "../utils/SdCliConfigUtil";
2
- import { FsUtil, Logger, PathUtil, SdFsWatcher } from "@simplysm/sd-core-node";
2
+ import { FsUtil, Logger, PathUtil, SdFsWatcher } from "@simplysm/sd-core/node";
3
3
  import * as path from "path";
4
4
 
5
5
  export class SdCliLocalUpdate {
@@ -1,4 +1,4 @@
1
- import { Logger, SdProcess } from "@simplysm/sd-core-node";
1
+ import { Logger, SdProcess } from "@simplysm/sd-core/node";
2
2
  import { SdCliPrepare } from "./SdCliPrepare";
3
3
 
4
4
  export class SdCliNpm {
@@ -1,4 +1,4 @@
1
- import { FsUtil, Logger } from "@simplysm/sd-core-node";
1
+ import { FsUtil, Logger } from "@simplysm/sd-core/node";
2
2
  import { fileURLToPath } from "url";
3
3
 
4
4
  export class SdCliPrepare {
@@ -1,8 +1,8 @@
1
- import { FsUtil, Logger, SdProcess } from "@simplysm/sd-core-node";
1
+ import { FsUtil, Logger, SdProcess } from "@simplysm/sd-core/node";
2
2
  import path from "path";
3
3
  import { INpmConfig, ISdCliConfig, ISdCliPackageBuildResult } from "../commons";
4
4
  import { SdCliPackage } from "../packages/SdCliPackage";
5
- import { Uuid, Wait } from "@simplysm/sd-core-common";
5
+ import { Uuid, Wait } from "@simplysm/sd-core/common";
6
6
  import os from "os";
7
7
  import { SdCliBuildResultUtil } from "../utils/SdCliBuildResultUtil";
8
8
  import semver from "semver/preload";
@@ -238,7 +238,7 @@ export class SdCliWorkspace {
238
238
  if (i !== sec) {
239
239
  process.stdout.cursorTo(0);
240
240
  }
241
- process.stdout.write(msg + " " + i);
241
+ process.stdout.write(`${msg} ${i}`);
242
242
  await Wait.time(1000);
243
243
  }
244
244
 
@@ -252,6 +252,7 @@ export class SdCliWorkspace {
252
252
  throw new Error("최상위 'package.json'에서 'workspaces'를 찾을 수 없습니다.");
253
253
  }
254
254
 
255
+
255
256
  return pkgRootPaths.map((pkgRootPath) => {
256
257
  const pkgConfig = conf.packages[path.basename(pkgRootPath)];
257
258
  return pkgConfig ? new SdCliPackage(this._rootPath, pkgRootPath, pkgConfig) : undefined;
@@ -264,7 +265,7 @@ export class SdCliWorkspace {
264
265
  pkgName: item[0],
265
266
  ...item1
266
267
  })))
267
- .orderBy((item) => item.pkgName + "_" + item.filePath);
268
+ .orderBy((item) => `${item.pkgName}_${item.filePath}`);
268
269
 
269
270
  const warnings = totalResults
270
271
  .filter((item) => item.severity === "warning")
@@ -1,8 +1,8 @@
1
1
  import { INpmConfig, ISdCliPackageBuildResult, ITsconfig, TSdCliPackageConfig } from "../commons";
2
2
  import path from "path";
3
- import { FsUtil, SdProcess } from "@simplysm/sd-core-node";
3
+ import { FsUtil, SdProcess } from "@simplysm/sd-core/node";
4
4
  import { EventEmitter } from "events";
5
- import { ObjectUtil } from "@simplysm/sd-core-common";
5
+ import { ObjectUtil } from "@simplysm/sd-core/common";
6
6
  import { SdCliTsLibBuilder } from "../builder/SdCliTsLibBuilder";
7
7
  import { SdCliJsLibBuilder } from "../builder/SdCliJsLibBuilder";
8
8
  import { SdCliServerBuilder } from "../builder/SdCliServerBuilder";
@@ -11,7 +11,7 @@ export class SdCliBuildResultUtil {
11
11
  : undefined;
12
12
  if (!severity) return undefined;
13
13
 
14
- const code = "TS" + diag.code;
14
+ const code = `TS${diag.code}`;
15
15
  const message = ts.flattenDiagnosticMessageText(diag.messageText, os.EOL);
16
16
 
17
17
 
@@ -1,6 +1,6 @@
1
1
  import { ISdCliConfig, TSdCliPackageConfig } from "../commons";
2
- import { FsUtil } from "@simplysm/sd-core-node";
3
- import { ObjectUtil } from "@simplysm/sd-core-common";
2
+ import { FsUtil } from "@simplysm/sd-core/node";
3
+ import { ObjectUtil } from "@simplysm/sd-core/common";
4
4
  import path from "path";
5
5
 
6
6
  export class SdCliConfigUtil {
package/tsconfig.json CHANGED
@@ -7,14 +7,11 @@
7
7
  "outDir": "./dist",
8
8
  "baseUrl": ".",
9
9
  "paths": {
10
- "@simplysm/sd-core-node": [
11
- "../sd-core-node/src/index.ts"
10
+ "@simplysm/sd-core/*": [
11
+ "../sd-core/src/*/index.ts"
12
12
  ],
13
- "@simplysm/sd-core-common": [
14
- "../sd-core-common/src/index.ts"
15
- ],
16
- "@simplysm/sd-service/server": [
17
- "../sd-service/src/server.ts"
13
+ "@simplysm/sd-service/*": [
14
+ "../sd-service/src/*/index.ts"
18
15
  ]
19
16
  }
20
17
  }