@simplysm/sd-cli 12.4.1 → 12.5.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplysm/sd-cli",
3
- "version": "12.4.1",
3
+ "version": "12.5.1",
4
4
  "description": "심플리즘 패키지 - CLI",
5
5
  "author": "김석래",
6
6
  "repository": {
@@ -14,37 +14,38 @@
14
14
  "main": "./dist/index.js",
15
15
  "types": "./dist/index.d.ts",
16
16
  "engines": {
17
- "node": "18.18.2"
17
+ "node": "20.16.0"
18
18
  },
19
19
  "scripts": {
20
- "postinstall": "node --experimental-import-meta-resolve lib/postinstall.js"
20
+ "postinstall": "node lib/postinstall.js"
21
21
  },
22
22
  "dependencies": {
23
- "@angular/build": "^18.2.1",
24
- "@angular/compiler": "^18.2.1",
25
- "@angular/compiler-cli": "^18.2.1",
23
+ "@angular/build": "^18.2.3",
24
+ "@angular/compiler": "^18.2.3",
25
+ "@angular/compiler-cli": "^18.2.3",
26
26
  "@electron/rebuild": "^3.6.0",
27
- "@simplysm/sd-core-common": "12.4.1",
28
- "@simplysm/sd-core-node": "12.4.1",
29
- "@simplysm/sd-service-server": "12.4.1",
30
- "@simplysm/sd-storage": "12.4.1",
27
+ "@simplysm/sd-core-common": "12.5.1",
28
+ "@simplysm/sd-core-node": "12.5.1",
29
+ "@simplysm/sd-service-server": "12.5.1",
30
+ "@simplysm/sd-storage": "12.5.1",
31
31
  "browserslist": "^4.23.3",
32
32
  "cordova": "^12.0.0",
33
- "electron": "^32.0.1",
34
- "electron-builder": "^23.6.0",
33
+ "electron": "^32.0.2",
34
+ "electron-builder": "^25.0.5",
35
35
  "esbuild": "^0.23.1",
36
- "eslint": "^8.57.0",
36
+ "eslint": "^9.9.1",
37
37
  "jszip": "^3.10.1",
38
38
  "node-stdlib-browser": "^1.2.0",
39
39
  "rxjs": "^7.8.1",
40
- "sass": "^1.77.8",
40
+ "sass": "^1.78.0",
41
41
  "semver": "^7.6.3",
42
+ "specifier-resolution-node": "^1.1.4",
42
43
  "typescript": "~5.5.4",
43
44
  "xml2js": "^0.6.2",
44
45
  "yargs": "^17.7.2"
45
46
  },
46
47
  "devDependencies": {
47
- "@types/eslint": "^8.56.12",
48
+ "@types/eslint": "^9.6.1",
48
49
  "@types/xml2js": "^0.4.14",
49
50
  "@types/yargs": "^17.0.33"
50
51
  }
@@ -67,7 +67,7 @@ import {Routes} from "@angular/router";
67
67
  export const routes: Routes = [
68
68
  ${fn(result, 2)}
69
69
  ];`.trim();
70
- if (content.trim() !== cache?.trim()) {
70
+ if (content !== cache) {
71
71
  await FsUtil.writeFileAsync(routesFilePath, content);
72
72
  }
73
73
  return content;
@@ -1,56 +1,59 @@
1
- import {ISdCliPackageBuildResult} from "../commons";
2
- import {ESLint} from "eslint";
1
+ import { ISdCliPackageBuildResult } from "../commons";
2
+ import { ESLint } from "eslint";
3
3
  import ts from "typescript";
4
- import {FsUtil} from "@simplysm/sd-core-node";
4
+ import { FsUtil } from "@simplysm/sd-core-node";
5
5
 
6
6
  export abstract class SdLinter {
7
- static async lintAsync(fileSet: Iterable<string>, tsProgram: ts.Program | undefined): Promise<ISdCliPackageBuildResult[]> {
8
- const lintFilePaths = Array.from(fileSet).filter((item) =>
9
- (!item.endsWith(".d.ts") && item.endsWith(".ts")) ||
10
- item.endsWith(".js") ||
11
- item.endsWith(".cjs") ||
12
- item.endsWith(".mjs")
13
- ).filter((item) => FsUtil.exists(item));
7
+ static async lintAsync(
8
+ fileSet: Iterable<string>,
9
+ tsProgram: ts.Program | undefined
10
+ ): Promise<ISdCliPackageBuildResult[]> {
11
+ const lintFilePaths = Array.from(fileSet)
12
+ .filter(
13
+ (item) =>
14
+ (!item.endsWith(".d.ts") && item.endsWith(".ts")) ||
15
+ item.endsWith(".js") ||
16
+ item.endsWith(".cjs") ||
17
+ item.endsWith(".mjs")
18
+ )
19
+ .filter((item) => FsUtil.exists(item));
14
20
 
15
21
  if (lintFilePaths.length === 0) {
16
22
  return [];
17
23
  }
18
24
 
19
- const linter = new ESLint(tsProgram != null ? {
20
- cache: false,
21
- overrideConfig: {
22
- overrides: [
23
- {
24
- files: ["*.ts"],
25
- parserOptions: {
26
- programs: [tsProgram],
27
- tsconfigRootDir: null,
28
- project: null
29
- }/*,
30
- settings: {
31
- "import/resolver": {
32
- "typescript": {
25
+ const linter = new ESLint(
26
+ tsProgram != null
27
+ ? {
28
+ cache: false,
29
+ overrideConfig: [
30
+ {
31
+ files: ["**/*.ts"],
32
+ languageOptions: {
33
+ parserOptions: {
33
34
  programs: [tsProgram],
34
- project: null
35
+ project: null,
36
+ tsconfigRootDir: null
35
37
  }
36
38
  }
37
- }*/
38
- }
39
- ]
40
- }
41
- } : undefined);
42
-
39
+ }
40
+ ]
41
+ }
42
+ : undefined
43
+ );
43
44
 
44
45
  const lintResults = await linter.lintFiles(lintFilePaths);
45
46
 
46
- return lintResults.mapMany((lintResult) => lintResult.messages.map((msg) => ({
47
- filePath: lintResult.filePath,
48
- line: msg.line,
49
- char: msg.column,
50
- code: msg.messageId,
51
- severity: msg.severity === 1 ? "warning" as const : "error" as const,
52
- message: msg.message + (msg.ruleId != null ? ` (${msg.ruleId})` : ``),
53
- type: "lint" as const
54
- })));
47
+ return lintResults.mapMany((lintResult) =>
48
+ lintResult.messages.map((msg) => ({
49
+ filePath: lintResult.filePath,
50
+ line: msg.line,
51
+ char: msg.column,
52
+ code: msg.messageId,
53
+ severity: msg.severity === 1 ? ("warning" as const) : ("error" as const),
54
+ message: msg.message + (msg.ruleId != null ? ` (${msg.ruleId})` : ``),
55
+ type: "lint" as const
56
+ }))
57
+ );
55
58
  }
56
59
  }
@@ -10,10 +10,22 @@ import {SdNgBundlerContext} from "./SdNgBundlerContext";
10
10
  import {INgPluginResultCache, sdNgPlugin} from "../bundle-plugins/sdNgPlugin";
11
11
  import ts from "typescript";
12
12
  import {MemoryLoadResultCache} from "@angular/build/src/tools/esbuild/load-result-cache";
13
- import {convertOutputFile, createOutputFile, transformSupportedBrowsersToTargets} from "@angular/build/src/tools/esbuild/utils";
14
- import {BuildOutputFile, BuildOutputFileType, InitialFileRecord} from "@angular/build/src/tools/esbuild/bundler-context";
13
+ import {
14
+ convertOutputFile,
15
+ createOutputFile,
16
+ transformSupportedBrowsersToTargets
17
+ } from "@angular/build/src/tools/esbuild/utils";
18
+ import {
19
+ BuildOutputFile,
20
+ BuildOutputFileType,
21
+ InitialFileRecord
22
+ } from "@angular/build/src/tools/esbuild/bundler-context";
15
23
  import {extractLicenses} from "@angular/build/src/tools/esbuild/license-extractor";
16
- import {HintMode, IndexHtmlGenerator, IndexHtmlProcessResult} from "@angular/build/src/utils/index-file/index-html-generator";
24
+ import {
25
+ HintMode,
26
+ IndexHtmlGenerator,
27
+ IndexHtmlProcessResult
28
+ } from "@angular/build/src/utils/index-file/index-html-generator";
17
29
  import {Entrypoint} from "@angular/build/src/utils/index-file/augment-index-html";
18
30
  import {CrossOrigin} from "@angular/build/src/builders/application/schema";
19
31
  import {InlineCriticalCssProcessor} from "@angular/build/src/utils/index-file/inline-critical-css";
@@ -62,7 +74,7 @@ export class SdNgBundler {
62
74
  this.#mainFilePath = path.resolve(opt.pkgPath, "src/main.ts");
63
75
  this.#tsConfigFilePath = path.resolve(opt.pkgPath, "tsconfig.json");
64
76
  this.#swConfFilePath = path.resolve(opt.pkgPath, "ngsw-config.json");
65
- this.#browserTarget = transformSupportedBrowsersToTargets(browserslist(["last 2 Chrome versions", "last 2 Edge versions"]));
77
+ this.#browserTarget = transformSupportedBrowsersToTargets(browserslist(opt.browserslist ?? ["last 2 Chrome versions", "last 2 Edge versions"]));
66
78
  this.#indexHtmlFilePath = path.resolve(opt.pkgPath, "src/index.html");
67
79
  this.#pkgName = path.basename(opt.pkgPath);
68
80
  this.#baseHref = opt.builderType === "web" ? `/${this.#pkgName}/` : opt.dev ? `/${this.#pkgName}/${opt.builderType}/` : ``;
@@ -86,7 +98,7 @@ export class SdNgBundler {
86
98
 
87
99
  if (!this.#contexts) {
88
100
  this.#contexts = [
89
- await this._getAppContextAsync(),
101
+ this._getAppContext(),
90
102
  this._getStyleContext(),
91
103
  ...this.#opt.builderType === "electron" ? [
92
104
  this._getElectronMainContext()
@@ -357,7 +369,7 @@ export class SdNgBundler {
357
369
  );
358
370
  }
359
371
 
360
- private async _getAppContextAsync(): Promise<SdNgBundlerContext> {
372
+ private _getAppContext() {
361
373
  return new SdNgBundlerContext(this.#opt.pkgPath, {
362
374
  absWorkingDir: this.#opt.pkgPath,
363
375
  bundle: true,
@@ -435,7 +447,7 @@ export class SdNgBundler {
435
447
  ".mp3": "file",
436
448
  ".ogg": "file"
437
449
  },
438
- inject: [PathUtil.posix(fileURLToPath(await import.meta.resolve!("node-stdlib-browser/helpers/esbuild/shim")))],
450
+ inject: [PathUtil.posix(fileURLToPath(import.meta.resolve("node-stdlib-browser/helpers/esbuild/shim")))],
439
451
  plugins: [
440
452
  ...this.#opt.builderType === "cordova" && this.#opt.cordovaConfig?.plugins ? [{
441
453
  name: "cordova:plugin-empty",
@@ -594,4 +606,5 @@ interface IOptions {
594
606
  builderType: string;
595
607
  env: Record<string, string> | undefined;
596
608
  cordovaConfig: ISdCliClientBuilderCordovaConfig | undefined;
609
+ browserslist: string[] | undefined;
597
610
  }
@@ -142,6 +142,7 @@ export class SdCliClientBuilder extends EventEmitter {
142
142
  ...this._pkgConf.env,
143
143
  ...this._pkgConf.builder?.[builderType]?.env
144
144
  },
145
+ browserslist: this._pkgConf.builder?.[builderType]?.browserslist,
145
146
  cordovaConfig: builderType === "cordova" ? this._pkgConf.builder!.cordova : undefined,
146
147
  }));
147
148
  }
@@ -187,7 +188,7 @@ export class SdCliClientBuilder extends EventEmitter {
187
188
  return {
188
189
  watchFileSet: currWatchFileSet,
189
190
  affectedFileSet,
190
- buildResults: [...results, ...lintResults]
191
+ buildResults: [...results, ...lintResults].filter(item => item.filePath !== path.resolve(this._pkgPath, "src/routes.ts"))
191
192
  };
192
193
  }
193
194
 
package/src/commons.ts CHANGED
@@ -122,12 +122,14 @@ export interface ISdCliClientBuilderElectronConfig {
122
122
  // devServerPort?: number;
123
123
  reinstallDependencies?: string[];
124
124
  env?: Record<string, string>;
125
+ browserslist?: string[];
125
126
  }
126
127
 
127
128
  export interface ISdCliClientBuilderWebConfig {
128
129
  // devServerHost?: string;
129
130
  // devServerPort?: number;
130
131
  env?: Record<string, string>;
132
+ browserslist?: string[];
131
133
  }
132
134
 
133
135
  export interface ISdCliClientBuilderCordovaConfig {
@@ -153,8 +155,9 @@ export interface ISdCliClientBuilderCordovaConfig {
153
155
  maxSdkVersion?: number;
154
156
  }[];
155
157
  }
156
- }
158
+ };
157
159
  env?: Record<string, string>;
160
+ browserslist?: string[];
158
161
  }
159
162
 
160
163
  export type TSdCliPostPublishConfig = ISdCliPostPublishScriptConfig;