@simplysm/sd-cli 7.1.10 → 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.
- package/README.md +24 -18
- package/dist/bin/sd-cli.d.ts +1 -1
- package/dist/bin/sd-cli.mjs +1 -1
- package/dist/builder/SdCliClientBuilder.d.ts +1 -1
- package/dist/builder/SdCliClientBuilder.mjs +14 -14
- package/dist/builder/SdCliServerBuilder.d.ts +1 -1
- package/dist/builder/SdCliServerBuilder.mjs +8 -7
- package/dist/entry-points/SdCliProjectGenerator.mjs +8 -5
- package/dist/entry-points/file/project/fc_project_npmconfig.mjs +5 -5
- package/dist/entry-points/file/project/fc_project_tsconfig.mjs +2 -2
- package/dist/entry-points/file/project/fc_project_yarnrc.mjs +1 -5
- package/dist/ng-tools/SdCliNgModuleGenerator.mjs +2 -2
- package/docs/client-router.md +1 -1
- package/docs/client-sw.md +1 -1
- package/docs/lib-local-update.md +5 -5
- package/package.json +17 -17
- package/src/bin/sd-cli.ts +1 -1
- package/src/builder/SdCliClientBuilder.ts +13 -13
- package/src/builder/SdCliServerBuilder.ts +7 -6
- package/src/entry-points/SdCliProjectGenerator.ts +8 -4
- package/src/entry-points/file/project/fc_project_npmconfig.ts +4 -4
- package/src/entry-points/file/project/fc_project_tsconfig.ts +1 -1
- package/src/entry-points/file/project/fc_project_yarnrc.ts +0 -4
- package/src/ng-tools/SdCliNgModuleGenerator.ts +1 -1
|
@@ -15,6 +15,7 @@ import CopyWebpackPlugin from "copy-webpack-plugin";
|
|
|
15
15
|
import { LicenseWebpackPlugin } from "license-webpack-plugin";
|
|
16
16
|
import { SdCliNpmConfigUtil } from "../utils/SdCliNpmConfigUtil";
|
|
17
17
|
import { createHash } from "crypto";
|
|
18
|
+
import { fileURLToPath } from "url";
|
|
18
19
|
import LintResult = ESLint.LintResult;
|
|
19
20
|
|
|
20
21
|
export class SdCliServerBuilder extends EventEmitter {
|
|
@@ -44,7 +45,7 @@ export class SdCliServerBuilder extends EventEmitter {
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
private async _checkCacheAsync(watch: boolean): Promise<void> {
|
|
47
|
-
const projPkgLockContent = await FsUtil.readFileAsync(path.resolve(this._projRootPath, "
|
|
48
|
+
const projPkgLockContent = await FsUtil.readFileAsync(path.resolve(this._projRootPath, "yarn.lock"));
|
|
48
49
|
|
|
49
50
|
// const cachePath = path.resolve(cacheBasePath, pkgVersion);
|
|
50
51
|
|
|
@@ -77,7 +78,7 @@ export class SdCliServerBuilder extends EventEmitter {
|
|
|
77
78
|
|
|
78
79
|
// 빌드 준비
|
|
79
80
|
const extModules = this._getExternalModules();
|
|
80
|
-
const webpackConfig = this.
|
|
81
|
+
const webpackConfig = await this._getWebpackConfigAsync(true, extModules);
|
|
81
82
|
const compiler = webpack(webpackConfig);
|
|
82
83
|
await new Promise<void>((resolve, reject) => {
|
|
83
84
|
compiler.hooks.watchRun.tapAsync(this.constructor.name, (args, callback) => {
|
|
@@ -119,7 +120,7 @@ export class SdCliServerBuilder extends EventEmitter {
|
|
|
119
120
|
// 빌드
|
|
120
121
|
this._logger.debug("Webpack 빌드 수행...");
|
|
121
122
|
const extModules = this._getExternalModules();
|
|
122
|
-
const webpackConfig = this.
|
|
123
|
+
const webpackConfig = await this._getWebpackConfigAsync(false, extModules);
|
|
123
124
|
const compiler = webpack(webpackConfig);
|
|
124
125
|
const buildResults = await new Promise<ISdCliPackageBuildResult[]>((resolve, reject) => {
|
|
125
126
|
compiler.run((err, stats) => {
|
|
@@ -254,7 +255,7 @@ export class SdCliServerBuilder extends EventEmitter {
|
|
|
254
255
|
].map((p) => path.dirname(p));
|
|
255
256
|
}
|
|
256
257
|
|
|
257
|
-
private
|
|
258
|
+
private async _getWebpackConfigAsync(watch: boolean, extModules: { name: string; exists: boolean }[]): Promise<webpack.Configuration> {
|
|
258
259
|
const projNpmConfig = this._getNpmConfig(this._projRootPath)!;
|
|
259
260
|
const projName = projNpmConfig.name;
|
|
260
261
|
|
|
@@ -367,7 +368,7 @@ export class SdCliServerBuilder extends EventEmitter {
|
|
|
367
368
|
{
|
|
368
369
|
test: /\.[cm]?jsx?$/,
|
|
369
370
|
enforce: "pre" as const,
|
|
370
|
-
loader: "source-map-loader",
|
|
371
|
+
loader: fileURLToPath(await import.meta.resolve!("source-map-loader")),
|
|
371
372
|
options: {
|
|
372
373
|
filterSourceMappingUrl: (mapUri: string, resourcePath: string) => {
|
|
373
374
|
const projRegex = new RegExp(`node_modules[\\\\/]@${projName}[\\\\/]`);
|
|
@@ -381,7 +382,7 @@ export class SdCliServerBuilder extends EventEmitter {
|
|
|
381
382
|
{
|
|
382
383
|
test: /\.[cm]?tsx?$/,
|
|
383
384
|
exclude: /node_modules/,
|
|
384
|
-
loader: "ts-loader",
|
|
385
|
+
loader: fileURLToPath(await import.meta.resolve!("ts-loader")),
|
|
385
386
|
options: {
|
|
386
387
|
configFile: this._tsconfigFilePath,
|
|
387
388
|
errorFormatter: (msg: ErrorInfo) => {
|
|
@@ -35,8 +35,8 @@ export class SdCliProjectGenerator {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
public async initAsync(opt: { name?: string; description: string; author: string; gitUrl: string }): Promise<void> {
|
|
38
|
-
if ((await FsUtil.readdirAsync(this._rootPath)).filter((item) => ![".idea", "yarn.lock", "package.json", ".yarn"].includes(path.basename(item))).length > 0) {
|
|
39
|
-
throw new Error("빈 디렉토리가 아닙니다. (.idea, yarn.lock, package.json, .yarn 외의 파일/폴더가 존재하는 경우, 초기화할 수 없습니다.)");
|
|
38
|
+
if ((await FsUtil.readdirAsync(this._rootPath)).filter((item) => ![".idea", "yarn.lock", "package.json", ".yarn", ".yarnrc.yml", "node_modules"].includes(path.basename(item))).length > 0) {
|
|
39
|
+
throw new Error("빈 디렉토리가 아닙니다. (.idea, yarn.lock, package.json, .yarn, .yarnrc.yml, node_modules 외의 파일/폴더가 존재하는 경우, 초기화할 수 없습니다.)");
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
const projName = opt.name ?? path.basename(this._rootPath);
|
|
@@ -54,7 +54,7 @@ export class SdCliProjectGenerator {
|
|
|
54
54
|
await FsUtil.writeFileAsync(path.resolve(this._rootPath, ".gitignore"), fc_project_gitignore());
|
|
55
55
|
|
|
56
56
|
this._logger.log(`[${projName}] '.yarnrc.yml' 파일 생성`);
|
|
57
|
-
await FsUtil.writeFileAsync(path.resolve(this._rootPath, ".
|
|
57
|
+
await FsUtil.writeFileAsync(path.resolve(this._rootPath, ".yarnrc.yml"), fc_project_yarnrc());
|
|
58
58
|
|
|
59
59
|
this._logger.log(`[${projName}] 'package.json' 파일 생성`);
|
|
60
60
|
let cliVersion: string | undefined;
|
|
@@ -87,6 +87,9 @@ export class SdCliProjectGenerator {
|
|
|
87
87
|
this._logger.log(`[${projName}] 'packages' 디렉토리 생성`);
|
|
88
88
|
await FsUtil.mkdirsAsync(path.resolve(this._rootPath, "packages"));
|
|
89
89
|
|
|
90
|
+
this._logger.log(`[${projName}] yarn plugin import interactive-tools`);
|
|
91
|
+
await SdProcess.spawnAsync("yarn plugin import interactive-tools", { cwd: this._rootPath }, true);
|
|
92
|
+
|
|
90
93
|
this._logger.log(`[${projName}] yarn install`);
|
|
91
94
|
await SdProcess.spawnAsync("yarn install", { cwd: this._rootPath }, true);
|
|
92
95
|
}
|
|
@@ -262,7 +265,8 @@ export class SdCliProjectGenerator {
|
|
|
262
265
|
isForAngular: true,
|
|
263
266
|
dependencies: {
|
|
264
267
|
"@angular/platform-browser": "^14.1.1",
|
|
265
|
-
"@angular/platform-browser-dynamic": "^14.1.1"
|
|
268
|
+
"@angular/platform-browser-dynamic": "^14.1.1",
|
|
269
|
+
"@angular/compiler": "^14.1.1"
|
|
266
270
|
},
|
|
267
271
|
tsconfigOptions: {
|
|
268
272
|
angularCompilerOptions: {
|
|
@@ -19,11 +19,11 @@ export const fc_project_npmconfig = (opt: { name: string; description: string; a
|
|
|
19
19
|
"test"
|
|
20
20
|
],
|
|
21
21
|
scripts: {
|
|
22
|
-
"watch": "sd-cli watch",
|
|
23
|
-
"build": "sd-cli build",
|
|
24
|
-
"publish": "sd-cli publish",
|
|
22
|
+
"watch": "npx sd-cli watch",
|
|
23
|
+
"build": "npx sd-cli build",
|
|
24
|
+
"publish": "npx sd-cli publish",
|
|
25
25
|
"----- utils": "",
|
|
26
|
-
"postinstall": "sd-cli prepare"
|
|
26
|
+
"postinstall": "npx sd-cli prepare"
|
|
27
27
|
},
|
|
28
28
|
devDependencies: {
|
|
29
29
|
"@simplysm/eslint-plugin": "~7.1.0",
|
|
@@ -13,7 +13,7 @@ export const fc_project_tsconfig = (): string => JSON.stringify({
|
|
|
13
13
|
noImplicitAny: false,
|
|
14
14
|
useUnknownInCatchVariables: false,
|
|
15
15
|
noFallthroughCasesInSwitch: true,
|
|
16
|
-
|
|
16
|
+
sourceMap: true,
|
|
17
17
|
skipDefaultLibCheck: true,
|
|
18
18
|
skipLibCheck: true,
|
|
19
19
|
forceConsistentCasingInFileNames: true,
|
|
@@ -502,7 +502,7 @@ export class SdCliNgModuleGenerator {
|
|
|
502
502
|
fnResult += " {\n";
|
|
503
503
|
fnResult += ` path: "${child.path}",\n`;
|
|
504
504
|
if ("target" in child) {
|
|
505
|
-
fnResult += ` loadChildren:
|
|
505
|
+
fnResult += ` loadChildren: () => import("${this._getFileImportModuleName(def.filePath, child.target.filePath)}").then((m) => m.${child.target.name})\n`;
|
|
506
506
|
}
|
|
507
507
|
else {
|
|
508
508
|
fnResult += ` children: ${fn(child.children).replace(/\n/g, "\n ")}\n`;
|