@simplysm/sd-cli 7.0.53 → 7.0.61

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 (42) hide show
  1. package/dist/build-tool/SdCliCacheCompilerHost.mjs +7 -2
  2. package/dist/builder/SdCliClientBuilder.mjs +39 -9
  3. package/dist/builder/SdCliJsLibBuilder.mjs +2 -2
  4. package/dist/builder/SdCliServerBuilder.mjs +37 -23
  5. package/dist/builder/SdCliTsLibBuilder.mjs +2 -2
  6. package/dist/entry-points/SdCliIndexFileGenerator.mjs +14 -10
  7. package/dist/entry-points/SdCliLocalUpdate.mjs +8 -3
  8. package/dist/entry-points/SdCliWorkspace.mjs +13 -4
  9. package/dist/packages/SdCliPackage.mjs +2 -1
  10. package/dist/utils/SdCliBuildResultUtil.mjs +3 -3
  11. package/lib/ts-node-esm-paths.mjs +2 -2
  12. package/package.json +7 -6
  13. package/src/build-tool/SdCliCacheCompilerHost.ts +7 -1
  14. package/src/builder/SdCliClientBuilder.ts +51 -10
  15. package/src/builder/SdCliJsLibBuilder.ts +1 -1
  16. package/src/builder/SdCliServerBuilder.ts +38 -22
  17. package/src/builder/SdCliTsLibBuilder.ts +1 -1
  18. package/src/commons.ts +4 -3
  19. package/src/entry-points/SdCliIndexFileGenerator.ts +13 -9
  20. package/src/entry-points/SdCliLocalUpdate.ts +7 -2
  21. package/src/entry-points/SdCliWorkspace.ts +16 -4
  22. package/src/packages/SdCliPackage.ts +2 -0
  23. package/src/utils/SdCliBuildResultUtil.ts +2 -2
  24. package/tsconfig-build.json +2 -1
  25. package/dist/bin/sd-cli.d.ts +0 -2
  26. package/dist/build-tool/SdCliCacheCompilerHost.d.ts +0 -10
  27. package/dist/build-tool/SdCliNgCacheCompilerHost.d.ts +0 -11
  28. package/dist/build-tool/SdCliPackageLinter.d.ts +0 -8
  29. package/dist/builder/SdCliClientBuilder.d.ts +0 -20
  30. package/dist/builder/SdCliJsLibBuilder.d.ts +0 -14
  31. package/dist/builder/SdCliServerBuilder.d.ts +0 -24
  32. package/dist/builder/SdCliTsLibBuilder.d.ts +0 -29
  33. package/dist/commons.d.ts +0 -62
  34. package/dist/entry-points/SdCliIndexFileGenerator.d.ts +0 -13
  35. package/dist/entry-points/SdCliLocalUpdate.d.ts +0 -13
  36. package/dist/entry-points/SdCliNpm.d.ts +0 -6
  37. package/dist/entry-points/SdCliPrepare.d.ts +0 -5
  38. package/dist/entry-points/SdCliWorkspace.d.ts +0 -27
  39. package/dist/packages/SdCliPackage.d.ts +0 -23
  40. package/dist/utils/SdCliBuildResultUtil.d.ts +0 -9
  41. package/dist/utils/SdCliConfigUtil.d.ts +0 -7
  42. package/dist/utils/SdCliNpmConfigUtil.d.ts +0 -7
@@ -46,8 +46,8 @@ export class SdCliServerBuilder extends EventEmitter {
46
46
  await FsUtil.removeAsync(this._parsedTsconfig.options.outDir!);
47
47
 
48
48
  // 빌드 준비
49
- const extModuleNames = this._getExternalModuleNames();
50
- const webpackConfig = this._getWebpackConfig(true, extModuleNames);
49
+ const extModules = this._getExternalModules();
50
+ const webpackConfig = this._getWebpackConfig(true, extModules.map((item) => item.name));
51
51
  const compiler = webpack(webpackConfig);
52
52
  await new Promise<void>((resolve, reject) => {
53
53
  compiler.hooks.watchRun.tapAsync(this.constructor.name, (args, callback) => {
@@ -80,8 +80,8 @@ export class SdCliServerBuilder extends EventEmitter {
80
80
 
81
81
  // 빌드
82
82
  this._logger.debug("Webpack 빌드 수행...");
83
- const extModuleNames = this._getExternalModuleNames();
84
- const webpackConfig = this._getWebpackConfig(false, extModuleNames);
83
+ const extModules = this._getExternalModules();
84
+ const webpackConfig = this._getWebpackConfig(false, extModules.map((item) => item.name));
85
85
  const compiler = webpack(webpackConfig);
86
86
  const buildResults = await new Promise<ISdCliPackageBuildResult[]>((resolve, reject) => {
87
87
  compiler.run((err, stats) => {
@@ -106,7 +106,7 @@ export class SdCliServerBuilder extends EventEmitter {
106
106
  await this._writeDistIisConfigFileAsync();
107
107
 
108
108
  // 배포용 package.json 파일 생성
109
- await this._writeDistNpmConfigFileAsync(extModuleNames);
109
+ await this._writeDistNpmConfigFileAsync(extModules.filter((item) => item.exists).map((item) => item.name));
110
110
 
111
111
  // 마무리
112
112
  this._logger.debug("Webpack 빌드 완료");
@@ -204,10 +204,18 @@ export class SdCliServerBuilder extends EventEmitter {
204
204
  );
205
205
  }
206
206
 
207
+ private _getInternalModuleCachePaths(workspaceName: string): string[] {
208
+ return [
209
+ ...FsUtil.findAllParentChildDirPaths("node_modules/*/package.json", this._rootPath, this._workspaceRootPath),
210
+ ...FsUtil.findAllParentChildDirPaths(`node_modules/!(@simplysm|@${workspaceName})/*/package.json`, this._rootPath, this._workspaceRootPath),
211
+ ].map((p) => path.dirname(p));
212
+ }
213
+
207
214
  private _getWebpackConfig(watch: boolean, extModuleNames: string[]): webpack.Configuration {
208
- const internalModuleCachePaths = watch
209
- ? FsUtil.findAllParentChildDirPaths("node_modules/!(@simplysm)", this._rootPath, this._workspaceRootPath)
210
- : undefined;
215
+ const workspaceNpmConfig = this._getNpmConfig(this._workspaceRootPath)!;
216
+ const workspaceName = workspaceNpmConfig.name;
217
+
218
+ const internalModuleCachePaths = watch ? this._getInternalModuleCachePaths(workspaceName) : undefined;
211
219
 
212
220
  const npmConfig = this._getNpmConfig(this._rootPath)!;
213
221
  const pkgKey = npmConfig.name.split("/").last()!;
@@ -246,7 +254,9 @@ export class SdCliServerBuilder extends EventEmitter {
246
254
  filename: "[name].mjs",
247
255
  chunkFilename: "[name].mjs",
248
256
  assetModuleFilename: "res/[name][ext][query]",
249
- libraryTarget: "module"
257
+ library: {
258
+ type: "module"
259
+ }
250
260
  },
251
261
  watch: false,
252
262
  watchOptions: { poll: undefined, ignored: undefined },
@@ -277,11 +287,9 @@ export class SdCliServerBuilder extends EventEmitter {
277
287
  managedPaths: internalModuleCachePaths
278
288
  }
279
289
  } : {},
280
- node: {
281
- __dirname: true
282
- },
290
+ node: false,
283
291
  optimization: {
284
- minimizer: watch ? [
292
+ minimizer: watch ? [] : [
285
293
  new TerserPlugin({
286
294
  extractComments: false,
287
295
  terserOptions: {
@@ -298,13 +306,18 @@ export class SdCliServerBuilder extends EventEmitter {
298
306
  }
299
307
  }
300
308
  })
301
- ] : [],
309
+ ],
302
310
  moduleIds: "deterministic",
303
311
  chunkIds: watch ? "named" : "deterministic",
304
312
  emitOnErrors: watch
305
313
  },
306
314
  module: {
307
315
  strictExportPresence: true,
316
+ parser: {
317
+ javascript: {
318
+ importMeta: false
319
+ }
320
+ },
308
321
  rules: [
309
322
  {
310
323
  test: /\.[cm]?[tj]sx?$/,
@@ -314,12 +327,15 @@ export class SdCliServerBuilder extends EventEmitter {
314
327
  },
315
328
  ...watch ? [
316
329
  {
317
- test: /\.m?js$/,
330
+ test: /\.[cm]?jsx?$/,
318
331
  enforce: "pre" as const,
319
332
  loader: "source-map-loader",
320
333
  options: {
321
334
  filterSourceMappingUrl: (mapUri: string, resourcePath: string) => {
322
- return !resourcePath.includes("node_modules") || (/@simplysm[\\/]/).test(resourcePath);
335
+ const workspaceRegex = new RegExp(`node_modules[\\\\/]@${workspaceName}[\\\\/]`);
336
+ return !resourcePath.includes("node_modules")
337
+ || (/node_modules[\\/]@simplysm[\\/]/).test(resourcePath)
338
+ || workspaceRegex.test(resourcePath);
323
339
  }
324
340
  }
325
341
  }
@@ -418,9 +434,9 @@ export class SdCliServerBuilder extends EventEmitter {
418
434
  };
419
435
  }
420
436
 
421
- private _getExternalModuleNames(): string[] {
437
+ private _getExternalModules(): { name: string; exists: boolean }[] {
422
438
  const loadedModuleNames: string[] = [];
423
- const resultSet = new Set<string>();
439
+ const results: { name: string; exists: boolean }[] = [];
424
440
 
425
441
  const fn = (currPath: string): void => {
426
442
  const npmConfig = this._getNpmConfig(currPath);
@@ -438,7 +454,7 @@ export class SdCliServerBuilder extends EventEmitter {
438
454
  }
439
455
 
440
456
  if (FsUtil.exists(path.resolve(modulePath, "binding.gyp"))) {
441
- resultSet.add(moduleName);
457
+ results.push({ name: moduleName, exists: true });
442
458
  }
443
459
 
444
460
  fn(modulePath);
@@ -450,12 +466,12 @@ export class SdCliServerBuilder extends EventEmitter {
450
466
 
451
467
  const optModulePath = FsUtil.findAllParentChildDirPaths("node_modules/" + optModuleName, currPath, this._workspaceRootPath).first();
452
468
  if (StringUtil.isNullOrEmpty(optModulePath)) {
453
- resultSet.add(optModuleName);
469
+ results.push({ name: optModuleName, exists: false });
454
470
  continue;
455
471
  }
456
472
 
457
473
  if (FsUtil.exists(path.resolve(optModulePath, "binding.gyp"))) {
458
- resultSet.add(optModuleName);
474
+ results.push({ name: optModuleName, exists: true });
459
475
  }
460
476
 
461
477
  fn(optModulePath);
@@ -464,7 +480,7 @@ export class SdCliServerBuilder extends EventEmitter {
464
480
 
465
481
  fn(this._rootPath);
466
482
 
467
- return Array.from(resultSet.values());
483
+ return results;
468
484
  }
469
485
 
470
486
  private _getNpmConfig(pkgPath: string): INpmConfig | undefined {
@@ -2,7 +2,7 @@ import { INpmConfig, ISdCliPackageBuildResult } from "../commons";
2
2
  import { EventEmitter } from "events";
3
3
  import ts from "typescript";
4
4
  import { FsUtil, Logger, PathUtil, SdFsWatcher } from "@simplysm/sd-core-node";
5
- import * as path from "path";
5
+ import path from "path";
6
6
  import { createHash } from "crypto";
7
7
  import { SdCliBuildResultUtil } from "../utils/SdCliBuildResultUtil";
8
8
  import { NgtscProgram } from "@angular/compiler-cli";
package/src/commons.ts CHANGED
@@ -2,10 +2,8 @@ export interface INpmConfig {
2
2
  name: string;
3
3
  version: string;
4
4
  workspaces?: string[];
5
- es2020?: string;
6
- browser?: string;
7
- module?: string;
8
5
  main?: string;
6
+ types?: string;
9
7
  exports?: Record<string, {
10
8
  types?: string;
11
9
  }>;
@@ -23,8 +21,10 @@ export interface ITsconfig {
23
21
  outDir?: string;
24
22
  baseUrl?: string;
25
23
  paths?: Record<string, string[]>;
24
+ declaration?: boolean;
26
25
  };
27
26
  files?: string[];
27
+ angularCompilerOptions?: Record<string, any>;
28
28
  }
29
29
 
30
30
  export interface ISdCliPackageBuildResult {
@@ -63,4 +63,5 @@ export interface ISdCliClientPackageConfig {
63
63
  type: "client";
64
64
  server: string;
65
65
  env?: Record<string, string>;
66
+ configs?: Record<string, any>;
66
67
  }
@@ -1,11 +1,11 @@
1
1
  import { ITsconfig } from "../commons";
2
- import * as path from "path";
2
+ import path from "path";
3
3
  import { FsUtil, PathUtil } from "@simplysm/sd-core-node";
4
- import * as os from "os";
5
- import * as chokidar from "chokidar";
4
+ import os from "os";
5
+ import chokidar from "chokidar";
6
6
 
7
7
  export class SdCliIndexFileGenerator {
8
- private readonly _indexFilePath = PathUtil.posix(this.rootPath, "src/index.ts");
8
+ private readonly _indexFilePath = path.resolve(this.rootPath, "src/index.ts");
9
9
  private _contentCache: string | undefined;
10
10
 
11
11
  public constructor(public readonly rootPath: string,
@@ -13,12 +13,16 @@ export class SdCliIndexFileGenerator {
13
13
  }
14
14
 
15
15
  public async watchAsync(): Promise<void> {
16
- const watcher = chokidar.watch([PathUtil.posix(this.rootPath, "src")], { persistent: true });
17
- watcher.on("add", async () => {
18
- await this.runAsync();
16
+ const watcher = chokidar.watch([path.resolve(this.rootPath, "src")], { persistent: true });
17
+ watcher.on("add", async (filePath) => {
18
+ if (filePath.endsWith(".ts")) {
19
+ await this.runAsync();
20
+ }
19
21
  });
20
- watcher.on("unlink", async () => {
21
- await this.runAsync();
22
+ watcher.on("unlink", async (filePath) => {
23
+ if (filePath.endsWith(".ts")) {
24
+ await this.runAsync();
25
+ }
22
26
  });
23
27
 
24
28
  await this.runAsync();
@@ -1,6 +1,6 @@
1
1
  import { SdCliConfigUtil } from "../utils/SdCliConfigUtil";
2
2
  import { FsUtil, Logger, PathUtil, SdFsWatcher } from "@simplysm/sd-core-node";
3
- import * as path from "path";
3
+ import path from "path";
4
4
 
5
5
  export class SdCliLocalUpdate {
6
6
  private readonly _logger = Logger.get(["simplysm", "sd-cli", this.constructor.name]);
@@ -14,6 +14,7 @@ export class SdCliLocalUpdate {
14
14
  if (!conf.localUpdates) return;
15
15
 
16
16
  const updatePathInfos = await this._getUpdatePathInfosAsync(conf.localUpdates);
17
+ this._logger.debug("로컬 업데이트 구성", updatePathInfos);
17
18
 
18
19
  this._logger.log("로컬 라이브러리 업데이트 시작...");
19
20
  for (const updatePathInfo of updatePathInfos) {
@@ -36,6 +37,7 @@ export class SdCliLocalUpdate {
36
37
  if (!conf.localUpdates) return;
37
38
 
38
39
  const updatePathInfos = await this._getUpdatePathInfosAsync(conf.localUpdates);
40
+ this._logger.debug("로컬 업데이트 구성", updatePathInfos);
39
41
 
40
42
  const watchPaths = (await updatePathInfos.mapManyAsync(async (item) => await this._getWatchPathsAsync(item.source))).distinct();
41
43
 
@@ -73,7 +75,10 @@ export class SdCliLocalUpdate {
73
75
  const result: IUpdatePathInfo[] = [];
74
76
  for (const pkgGlobPath of Object.keys(record)) {
75
77
  // "node_modules'에서 로컬업데이트 설정에 맞는 패키지를 "glob"하여 대상 패키지경로 목록 가져오기
76
- const targetPaths = await FsUtil.globAsync(path.resolve(this._rootPath, "node_modules", pkgGlobPath));
78
+ const targetPaths = [
79
+ ...await FsUtil.globAsync(path.resolve(this._rootPath, "node_modules", pkgGlobPath)),
80
+ ...await FsUtil.globAsync(path.resolve(this._rootPath, "packages", "*", "node_modules", pkgGlobPath))
81
+ ];
77
82
 
78
83
  result.push(
79
84
  ...targetPaths
@@ -93,17 +93,26 @@ export class SdCliWorkspace {
93
93
  });
94
94
  }
95
95
 
96
+ private _isServerRestarting = false;
97
+
96
98
  private async _restartServerAsync(pkg: SdCliPackage): Promise<void> {
99
+ await Wait.until(() => !this._isServerRestarting);
100
+
101
+ this._isServerRestarting = true;
97
102
  const entryFileRelPath = pkg.main;
98
103
  if (entryFileRelPath === undefined) {
99
104
  this._logger.error(`서버패키지(${pkg.name})의 'package.json'에서 'main'필드를 찾을 수 없습니다.`);
105
+ this._isServerRestarting = false;
100
106
  return;
101
107
  }
102
108
  const entryFilePath = path.resolve(pkg.rootPath, entryFileRelPath);
103
109
 
104
110
  this._logger.log(`서버(${pkg.name}) 재시작...`);
105
111
  try {
106
- const serverInfo = this._serverInfoMap.getOrCreate(pkg.name, { middlewares: [], clientInfos: [] });
112
+ const serverInfo = this._serverInfoMap.getOrCreate(path.basename(pkg.rootPath), {
113
+ middlewares: [],
114
+ clientInfos: []
115
+ });
107
116
  if (serverInfo.server) {
108
117
  await serverInfo.server.closeAsync();
109
118
  delete serverInfo.server;
@@ -112,6 +121,7 @@ export class SdCliWorkspace {
112
121
  serverInfo.server = (await import("file:///" + entryFilePath + "?update=" + Uuid.new().toString())).default as SdServiceServer | undefined;
113
122
  if (!serverInfo.server) {
114
123
  this._logger.error(`${entryFilePath}(0, 0): 'SdServiceServer'를 'export'해야 합니다.`);
124
+ this._isServerRestarting = false;
115
125
  return;
116
126
  }
117
127
  serverInfo.server.devMiddlewares = serverInfo.middlewares;
@@ -122,6 +132,8 @@ export class SdCliWorkspace {
122
132
  catch (err) {
123
133
  this._logger.error(`서버(${pkg.name}) 재시작중 오류 발생`, err);
124
134
  }
135
+
136
+ this._isServerRestarting = false;
125
137
  }
126
138
 
127
139
  public async buildAsync(opt: { confFileRelPath: string; optNames: string[] }): Promise<void> {
@@ -193,11 +205,11 @@ export class SdCliWorkspace {
193
205
  this._logger.debug("프로젝트 및 패키지 버전 설정...");
194
206
  await this._upgradeVersionAsync(pkgs);
195
207
 
196
- this._logger.debug("노드패키지 업데이트...");
197
- await new SdCliNpm(this._rootPath).updateAsync();
198
-
199
208
  // 빌드
200
209
  if (!opt.noBuild) {
210
+ this._logger.debug("노드패키지 업데이트...");
211
+ await new SdCliNpm(this._rootPath).updateAsync();
212
+
201
213
  this._logger.debug("빌드를 시작합니다...");
202
214
  await this._buildPkgsAsync(pkgs);
203
215
  }
@@ -116,6 +116,8 @@ export class SdCliPackage extends EventEmitter {
116
116
  delete buildTsconfig.compilerOptions.baseUrl;
117
117
  delete buildTsconfig.compilerOptions.paths;
118
118
 
119
+ buildTsconfig.compilerOptions.declaration = Boolean(this._npmConfig.types);
120
+
119
121
  const buildTsconfigFilePath = path.resolve(this.rootPath, "tsconfig-build.json");
120
122
  await FsUtil.writeJsonAsync(buildTsconfigFilePath, buildTsconfig, { space: 2 });
121
123
  }
@@ -1,6 +1,6 @@
1
1
  import ts from "typescript";
2
- import * as os from "os";
3
- import * as path from "path";
2
+ import os from "os";
3
+ import path from "path";
4
4
  import { ISdCliPackageBuildResult } from "../commons";
5
5
  import webpack from "webpack";
6
6
 
@@ -4,6 +4,7 @@
4
4
  "lib": [
5
5
  "ES2020"
6
6
  ],
7
- "outDir": "./dist"
7
+ "outDir": "./dist",
8
+ "declaration": false
8
9
  }
9
10
  }
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node --experimental-specifier-resolution=node --experimental-import-meta-resolve
2
- export {};
@@ -1,10 +0,0 @@
1
- import ts from "typescript";
2
- export declare class SdCliCacheCompilerHost {
3
- static create(parsedTsconfig: ts.ParsedCommandLine, moduleResolutionCache: ts.ModuleResolutionCache, sourceFileCache: Map<string, IFileCache>, outputFileCache: Map<string, string>): ts.CompilerHost;
4
- }
5
- interface IFileCache {
6
- exists?: boolean;
7
- sourceFile?: ts.SourceFile;
8
- content?: string;
9
- }
10
- export {};
@@ -1,11 +0,0 @@
1
- import ts from "typescript";
2
- export declare class SdCliNgCacheCompilerHost {
3
- static wrap(compilerHost: ts.CompilerHost, sourceFileCache: Map<string, IFileCache>): ts.CompilerHost;
4
- }
5
- interface IFileCache {
6
- exists?: boolean;
7
- sourceFile?: ts.SourceFile;
8
- content?: string;
9
- styleContent?: string;
10
- }
11
- export {};
@@ -1,8 +0,0 @@
1
- import { ISdCliPackageBuildResult } from "../commons";
2
- import ts from "typescript";
3
- export declare class SdCliPackageLinter {
4
- private readonly _rootPath;
5
- private readonly _lintResultCache;
6
- constructor(_rootPath: string);
7
- lintAsync(filePaths: string[], program?: ts.Program): Promise<ISdCliPackageBuildResult[]>;
8
- }
@@ -1,20 +0,0 @@
1
- /// <reference types="node" />
2
- import { ISdCliClientPackageConfig, ISdCliPackageBuildResult } from "../commons";
3
- import { EventEmitter } from "events";
4
- import { NextHandleFunction } from "connect";
5
- export declare class SdCliClientBuilder extends EventEmitter {
6
- private readonly _rootPath;
7
- private readonly _config;
8
- private readonly _workspaceRootPath;
9
- private readonly _logger;
10
- private readonly _tsconfigFilePath;
11
- private readonly _parsedTsconfig;
12
- private readonly _npmConfigMap;
13
- constructor(_rootPath: string, _config: ISdCliClientPackageConfig, _workspaceRootPath: string);
14
- on(event: "change", listener: () => void): this;
15
- on(event: "complete", listener: (results: ISdCliPackageBuildResult[]) => void): this;
16
- watchAsync(): Promise<NextHandleFunction[]>;
17
- buildAsync(): Promise<ISdCliPackageBuildResult[]>;
18
- private _getWebpackConfig;
19
- private _getNpmConfig;
20
- }
@@ -1,14 +0,0 @@
1
- /// <reference types="node" />
2
- import { ISdCliPackageBuildResult } from "../commons";
3
- import { EventEmitter } from "events";
4
- export declare class SdCliJsLibBuilder extends EventEmitter {
5
- private readonly _rootPath;
6
- private readonly _logger;
7
- private readonly _linter;
8
- constructor(_rootPath: string);
9
- on(event: "change", listener: () => void): this;
10
- on(event: "complete", listener: (results: ISdCliPackageBuildResult[]) => void): this;
11
- watchAsync(): Promise<void>;
12
- buildAsync(): Promise<ISdCliPackageBuildResult[]>;
13
- private getRelatedPathsAsync;
14
- }
@@ -1,24 +0,0 @@
1
- /// <reference types="node" />
2
- import { ISdCliPackageBuildResult, ISdCliServerPackageConfig } from "../commons";
3
- import { EventEmitter } from "events";
4
- export declare class SdCliServerBuilder extends EventEmitter {
5
- private readonly _rootPath;
6
- private readonly _config;
7
- private readonly _workspaceRootPath;
8
- private readonly _logger;
9
- private readonly _tsconfigFilePath;
10
- private readonly _parsedTsconfig;
11
- private readonly _npmConfigMap;
12
- constructor(_rootPath: string, _config: ISdCliServerPackageConfig, _workspaceRootPath: string);
13
- on(event: "change", listener: () => void): this;
14
- on(event: "complete", listener: (results: ISdCliPackageBuildResult[]) => void): this;
15
- watchAsync(): Promise<void>;
16
- buildAsync(): Promise<ISdCliPackageBuildResult[]>;
17
- private _writeDistConfigFileAsync;
18
- private _writeDistPm2ConfigFileAsync;
19
- private _writeDistIisConfigFileAsync;
20
- private _writeDistNpmConfigFileAsync;
21
- private _getWebpackConfig;
22
- private _getExternalModuleNames;
23
- private _getNpmConfig;
24
- }
@@ -1,29 +0,0 @@
1
- /// <reference types="node" />
2
- import { ISdCliPackageBuildResult } from "../commons";
3
- import { EventEmitter } from "events";
4
- export declare class SdCliTsLibBuilder extends EventEmitter {
5
- private readonly _rootPath;
6
- private readonly _logger;
7
- private _moduleResolutionCache?;
8
- private readonly _linter;
9
- private readonly _fileCache;
10
- private readonly _writeFileCache;
11
- private _program?;
12
- private _ngProgram?;
13
- private _builder?;
14
- private readonly _tsconfigFilePath;
15
- private readonly _parsedTsconfig;
16
- private readonly _npmConfig;
17
- private readonly _isAngular;
18
- constructor(_rootPath: string);
19
- on(event: "change", listener: () => void): this;
20
- on(event: "complete", listener: (results: ISdCliPackageBuildResult[]) => void): this;
21
- watchAsync(): Promise<void>;
22
- buildAsync(): Promise<ISdCliPackageBuildResult[]>;
23
- private getAllRelatedPathsAsync;
24
- private _runBuilderAsync;
25
- private _createSdBuildPack;
26
- private _createProgram;
27
- private _configProgramSourceFileVersions;
28
- private _createCacheCompilerHost;
29
- }
package/dist/commons.d.ts DELETED
@@ -1,62 +0,0 @@
1
- export interface INpmConfig {
2
- name: string;
3
- version: string;
4
- workspaces?: string[];
5
- es2020?: string;
6
- browser?: string;
7
- module?: string;
8
- main?: string;
9
- exports?: Record<string, {
10
- types?: string;
11
- }>;
12
- scripts?: Record<string, string>;
13
- dependencies?: Record<string, string>;
14
- optionalDependencies?: Record<string, string>;
15
- devDependencies?: Record<string, string>;
16
- peerDependencies?: Record<string, string>;
17
- peerDependenciesMeta?: Record<string, {
18
- optional?: boolean;
19
- }>;
20
- }
21
- export interface ITsconfig {
22
- compilerOptions?: {
23
- outDir?: string;
24
- baseUrl?: string;
25
- paths?: Record<string, string[]>;
26
- };
27
- files?: string[];
28
- }
29
- export interface ISdCliPackageBuildResult {
30
- filePath: string | undefined;
31
- line: number | undefined;
32
- char: number | undefined;
33
- code: string | undefined;
34
- severity: "error" | "warning";
35
- message: string;
36
- }
37
- export interface ISdCliConfig {
38
- packages: Record<string, TSdCliPackageConfig | undefined>;
39
- localUpdates?: Record<string, string>;
40
- }
41
- export declare type TSdCliPackageConfig = ISdCliLibPackageConfig | ISdCliServerPackageConfig | ISdCliClientPackageConfig;
42
- export interface ISdCliLibPackageConfig {
43
- type: "library";
44
- autoIndex?: {
45
- polyfills?: string[];
46
- };
47
- publish?: "npm";
48
- }
49
- export interface ISdCliServerPackageConfig {
50
- type: "server";
51
- env?: Record<string, string>;
52
- configs?: Record<string, any>;
53
- pm2?: Record<string, any> | boolean;
54
- iis?: {
55
- serverExeFilePath?: string;
56
- } | boolean;
57
- }
58
- export interface ISdCliClientPackageConfig {
59
- type: "client";
60
- server: string;
61
- env?: Record<string, string>;
62
- }
@@ -1,13 +0,0 @@
1
- export declare class SdCliIndexFileGenerator {
2
- readonly rootPath: string;
3
- readonly config: ISdAutoIndexConfig;
4
- private readonly _indexFilePath;
5
- private _contentCache;
6
- constructor(rootPath: string, config: ISdAutoIndexConfig);
7
- watchAsync(): Promise<void>;
8
- runAsync(): Promise<void>;
9
- private _getFilePathsAsync;
10
- }
11
- export interface ISdAutoIndexConfig {
12
- polyfills?: string[];
13
- }
@@ -1,13 +0,0 @@
1
- export declare class SdCliLocalUpdate {
2
- private readonly _rootPath;
3
- private readonly _logger;
4
- constructor(_rootPath: string);
5
- runAsync(opt: {
6
- confFileRelPath: string;
7
- }): Promise<void>;
8
- watchAsync(opt: {
9
- confFileRelPath: string;
10
- }): Promise<void>;
11
- private _getUpdatePathInfosAsync;
12
- protected _getWatchPathsAsync(sourcePath: string): Promise<string[]>;
13
- }
@@ -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,5 +0,0 @@
1
- export declare class SdCliPrepare {
2
- private readonly _logger;
3
- prepareAsync(): Promise<void>;
4
- private _modifyTypescriptCodeForTypeCheckPerformanceWarning;
5
- }
@@ -1,27 +0,0 @@
1
- export declare class SdCliWorkspace {
2
- private readonly _rootPath;
3
- private readonly _logger;
4
- private readonly _npmConfig;
5
- private readonly _serverInfoMap;
6
- constructor(_rootPath: string);
7
- watchAsync(opt: {
8
- confFileRelPath: string;
9
- optNames: string[];
10
- }): Promise<void>;
11
- private _restartServerAsync;
12
- buildAsync(opt: {
13
- confFileRelPath: string;
14
- optNames: string[];
15
- }): Promise<void>;
16
- private _buildPkgsAsync;
17
- publishAsync(opt: {
18
- noBuild: boolean;
19
- confFileRelPath: string;
20
- optNames: string[];
21
- }): Promise<void>;
22
- private _upgradeVersionAsync;
23
- private _waitSecMessageAsync;
24
- private _getPackagesAsync;
25
- private _loggingResults;
26
- private _loggingOpenClientHrefs;
27
- }
@@ -1,23 +0,0 @@
1
- /// <reference types="node" />
2
- import { ISdCliPackageBuildResult, TSdCliPackageConfig } from "../commons";
3
- import { EventEmitter } from "events";
4
- import { NextHandleFunction } from "connect";
5
- export declare class SdCliPackage extends EventEmitter {
6
- private readonly _workspaceRootPath;
7
- readonly rootPath: string;
8
- readonly config: TSdCliPackageConfig;
9
- private readonly _npmConfig;
10
- get basename(): string;
11
- get name(): string;
12
- get main(): string | undefined;
13
- get allDependencies(): string[];
14
- constructor(_workspaceRootPath: string, rootPath: string, config: TSdCliPackageConfig);
15
- on(event: "change", listener: () => void): this;
16
- on(event: "complete", listener: (results: ISdCliPackageBuildResult[]) => void): this;
17
- setNewVersionAsync(newVersion: string, pkgNames: string[]): Promise<void>;
18
- watchAsync(): Promise<NextHandleFunction[] | void>;
19
- buildAsync(): Promise<ISdCliPackageBuildResult[]>;
20
- publishAsync(): Promise<void>;
21
- private _createBuilderAsync;
22
- private _genBuildTsconfigAsync;
23
- }
@@ -1,9 +0,0 @@
1
- import ts from "typescript";
2
- import { ISdCliPackageBuildResult } from "../commons";
3
- import webpack from "webpack";
4
- export declare class SdCliBuildResultUtil {
5
- static convertFromTsDiag(diag: ts.Diagnostic): ISdCliPackageBuildResult | undefined;
6
- static convertFromWebpackStats(stats: webpack.Stats): ISdCliPackageBuildResult[];
7
- private static _convertFromWebpackError;
8
- static getMessage(result: ISdCliPackageBuildResult): string;
9
- }