@simplysm/sd-cli 7.1.10 → 7.1.14
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 +19 -73
- package/dist/builder/SdCliServerBuilder.d.ts +1 -1
- package/dist/builder/SdCliServerBuilder.mjs +8 -7
- package/dist/commons.d.ts +0 -1
- 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 -14
- 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 -18
- package/src/bin/sd-cli.ts +1 -1
- package/src/builder/SdCliClientBuilder.ts +18 -79
- package/src/builder/SdCliServerBuilder.ts +7 -6
- package/src/commons.ts +0 -1
- 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 -13
- package/src/ng-tools/SdCliNgModuleGenerator.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/sd-cli",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.14",
|
|
4
4
|
"description": "심플리즘 패키지 - CLI",
|
|
5
5
|
"author": "김석래",
|
|
6
6
|
"repository": {
|
|
@@ -20,31 +20,30 @@
|
|
|
20
20
|
"**/*"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@angular-
|
|
24
|
-
"@angular
|
|
25
|
-
"@angular/
|
|
26
|
-
"@angular/compiler": "^14.1.
|
|
27
|
-
"@angular/
|
|
28
|
-
"@angular/core": "^14.1.2",
|
|
23
|
+
"@angular-devkit/build-angular": "^14.1.3",
|
|
24
|
+
"@angular/common": "^14.1.3",
|
|
25
|
+
"@angular/compiler": "^14.1.3",
|
|
26
|
+
"@angular/compiler-cli": "^14.1.3",
|
|
27
|
+
"@angular/core": "^14.1.3",
|
|
29
28
|
"@babel/parser": "^7.18.11",
|
|
30
29
|
"@babel/types": "^7.18.10",
|
|
31
30
|
"@compodoc/compodoc": "^1.1.19",
|
|
32
|
-
"@ngtools/webpack": "^14.1.
|
|
33
|
-
"@simplysm/sd-core-common": "7.1.
|
|
34
|
-
"@simplysm/sd-core-node": "7.1.
|
|
35
|
-
"@simplysm/sd-service-common": "7.1.
|
|
36
|
-
"@simplysm/sd-service-server": "7.1.
|
|
37
|
-
"@simplysm/sd-storage": "7.1.
|
|
31
|
+
"@ngtools/webpack": "^14.1.3",
|
|
32
|
+
"@simplysm/sd-core-common": "7.1.14",
|
|
33
|
+
"@simplysm/sd-core-node": "7.1.14",
|
|
34
|
+
"@simplysm/sd-service-common": "7.1.14",
|
|
35
|
+
"@simplysm/sd-service-server": "7.1.14",
|
|
36
|
+
"@simplysm/sd-storage": "7.1.14",
|
|
38
37
|
"browserslist": "^4.21.3",
|
|
39
38
|
"chokidar": "^3.5.3",
|
|
40
39
|
"connect": "^3.7.0",
|
|
41
40
|
"copy-webpack-plugin": "^11.0.0",
|
|
42
41
|
"cordova": "^11.0.0",
|
|
43
42
|
"css-loader": "^6.7.1",
|
|
44
|
-
"electron": "^20.0.
|
|
43
|
+
"electron": "^20.0.3",
|
|
45
44
|
"electron-builder": "^23.3.3",
|
|
46
45
|
"electron-rebuild": "^3.2.9",
|
|
47
|
-
"eslint": "^8.
|
|
46
|
+
"eslint": "^8.22.0",
|
|
48
47
|
"eslint-webpack-plugin": "^3.2.0",
|
|
49
48
|
"jsdom": "^20.0.0",
|
|
50
49
|
"jszip": "^3.10.1",
|
|
@@ -59,20 +58,20 @@
|
|
|
59
58
|
"semver": "^7.3.7",
|
|
60
59
|
"source-map-loader": "^4.0.0",
|
|
61
60
|
"source-map-support": "^0.5.21",
|
|
62
|
-
"terser-webpack-plugin": "^5.3.
|
|
61
|
+
"terser-webpack-plugin": "^5.3.5",
|
|
63
62
|
"ts-loader": "^9.3.1",
|
|
64
63
|
"typedoc": "^0.23.10",
|
|
65
64
|
"typescript": "~4.7.4",
|
|
66
65
|
"webpack": "^5.74.0",
|
|
67
66
|
"xml2js": "^0.4.23",
|
|
68
67
|
"yargs": "^17.5.1",
|
|
69
|
-
"zone.js": "~0.11.
|
|
68
|
+
"zone.js": "~0.11.8"
|
|
70
69
|
},
|
|
71
70
|
"devDependencies": {
|
|
72
71
|
"@types/connect": "^3.4.35",
|
|
73
72
|
"@types/jsdom": "^20.0.0",
|
|
74
73
|
"@types/mime": "^3.0.1",
|
|
75
|
-
"@types/semver": "^7.3.
|
|
74
|
+
"@types/semver": "^7.3.12",
|
|
76
75
|
"@types/source-map-support": "^0.5.4",
|
|
77
76
|
"@types/xml2js": "^0.4.11",
|
|
78
77
|
"@types/yargs": "^17.0.11"
|
package/src/bin/sd-cli.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node --experimental-specifier-resolution=node --experimental-import-meta-resolve
|
|
1
|
+
#!/usr/bin/env node --no-warnings --experimental-specifier-resolution=node --experimental-import-meta-resolve
|
|
2
2
|
|
|
3
3
|
import yargs from "yargs";
|
|
4
4
|
import { hideBin } from "yargs/helpers";
|
|
@@ -33,7 +33,6 @@ import electronBuilder from "electron-builder";
|
|
|
33
33
|
import { fileURLToPath } from "url";
|
|
34
34
|
import { Entrypoint } from "@angular-devkit/build-angular/src/utils/index-file/augment-index-html";
|
|
35
35
|
import { StringUtil } from "@simplysm/sd-core-common";
|
|
36
|
-
import mf from "@angular-architects/module-federation/webpack";
|
|
37
36
|
import LintResult = ESLint.LintResult;
|
|
38
37
|
|
|
39
38
|
export class SdCliClientBuilder extends EventEmitter {
|
|
@@ -97,7 +96,7 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
97
96
|
}
|
|
98
97
|
|
|
99
98
|
private async _checkCacheAsync(watch: boolean): Promise<void> {
|
|
100
|
-
const projPkgLockContent = await FsUtil.readFileAsync(path.resolve(this._projRootPath, "
|
|
99
|
+
const projPkgLockContent = await FsUtil.readFileAsync(path.resolve(this._projRootPath, "yarn.lock"));
|
|
101
100
|
|
|
102
101
|
// const cachePath = path.resolve(cacheBasePath, pkgVersion);
|
|
103
102
|
|
|
@@ -140,8 +139,8 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
140
139
|
|
|
141
140
|
// 빌드 준비
|
|
142
141
|
const extModules = this._config.builder?.electron ? this._getExternalModules() : [];
|
|
143
|
-
const webpackConfigs = (Object.keys(this._config.builder ?? { web: {} }) as ("web" | "cordova" | "electron")[])
|
|
144
|
-
.
|
|
142
|
+
const webpackConfigs = await (Object.keys(this._config.builder ?? { web: {} }) as ("web" | "cordova" | "electron")[])
|
|
143
|
+
.mapAsync(async (builderType) => await this._getWebpackConfigAsync(true, builderType, extModules));
|
|
145
144
|
const multiCompiler = webpack(webpackConfigs);
|
|
146
145
|
await new Promise<void>((resolve, reject) => {
|
|
147
146
|
// const invalidFiles: string[] = [];
|
|
@@ -227,7 +226,7 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
227
226
|
this._logger.debug("Webpack 빌드 수행...");
|
|
228
227
|
const extModules = this._config.builder?.electron ? this._getExternalModules() : [];
|
|
229
228
|
const builderTypes = (Object.keys(this._config.builder ?? { web: {} }) as ("web" | "cordova" | "electron")[]);
|
|
230
|
-
const webpackConfigs = builderTypes.
|
|
229
|
+
const webpackConfigs = await builderTypes.mapAsync(async (builderType) => await this._getWebpackConfigAsync(false, builderType, extModules));
|
|
231
230
|
const multipleCompiler = webpack(webpackConfigs);
|
|
232
231
|
const buildResults = await new Promise<ISdCliPackageBuildResult[]>((resolve, reject) => {
|
|
233
232
|
multipleCompiler.run((err, multiStats) => {
|
|
@@ -302,7 +301,7 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
302
301
|
.toObject((item) => item, () => "*")
|
|
303
302
|
}
|
|
304
303
|
}, { space: 2 });
|
|
305
|
-
await FsUtil.writeFileAsync(path.resolve(electronSrcPath, "
|
|
304
|
+
await FsUtil.writeFileAsync(path.resolve(electronSrcPath, "yarn.lock"), "");
|
|
306
305
|
|
|
307
306
|
await FsUtil.writeFileAsync(path.resolve(electronSrcPath, `.env`), [
|
|
308
307
|
"NODE_ENV=production",
|
|
@@ -360,7 +359,7 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
360
359
|
].map((p) => path.dirname(p));
|
|
361
360
|
}
|
|
362
361
|
|
|
363
|
-
private
|
|
362
|
+
private async _getWebpackConfigAsync(watch: boolean, builderType: "web" | "cordova" | "electron", extModules: { name: string; exists: boolean }[]): Promise<webpack.Configuration> {
|
|
364
363
|
const projNpmConfig = this._getNpmConfig(this._projRootPath)!;
|
|
365
364
|
const projName = projNpmConfig.name;
|
|
366
365
|
|
|
@@ -368,7 +367,7 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
368
367
|
|
|
369
368
|
const npmConfig = this._getNpmConfig(this._rootPath)!;
|
|
370
369
|
|
|
371
|
-
const projPkgLockContent = FsUtil.readFile(path.resolve(this._projRootPath, "
|
|
370
|
+
const projPkgLockContent = FsUtil.readFile(path.resolve(this._projRootPath, "yarn.lock"));
|
|
372
371
|
|
|
373
372
|
const pkgKey = npmConfig.name.split("/").last()!;
|
|
374
373
|
const publicPath = builderType === "web" ? `/${pkgKey}/` : watch ? `/${pkgKey}/${builderType}/` : ``;
|
|
@@ -403,16 +402,6 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
403
402
|
// 버전쓰기
|
|
404
403
|
FsUtil.writeFile(path.resolve(this._cacheBasePath, "version"), versionHash);
|
|
405
404
|
|
|
406
|
-
// ModuleFederation 관련
|
|
407
|
-
const sharedMappings = new mf.SharedMappings();
|
|
408
|
-
sharedMappings.register(this._tsconfigFilePath, []);
|
|
409
|
-
|
|
410
|
-
const deps = SdCliNpmConfigUtil.getDependencies(npmConfig);
|
|
411
|
-
const shared = deps.defaults
|
|
412
|
-
.concat(deps.optionals)
|
|
413
|
-
.distinct()
|
|
414
|
-
.toObject((item) => item, () => ({ singleton: true, strictVersion: true, requiredVersion: "auto" }));
|
|
415
|
-
|
|
416
405
|
let prevProgressMessage = "";
|
|
417
406
|
return {
|
|
418
407
|
mode: watch ? "development" : "production",
|
|
@@ -425,11 +414,7 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
425
414
|
symlinks: true,
|
|
426
415
|
modules: [this._projRootPath, "node_modules"],
|
|
427
416
|
mainFields: ["es2020", "es2015", "browser", "module", "main"],
|
|
428
|
-
conditionNames: ["es2020", "es2015", "..."]
|
|
429
|
-
|
|
430
|
-
...this._config.moduleFederation ? {
|
|
431
|
-
alias: sharedMappings.getAliases()
|
|
432
|
-
} : {}
|
|
417
|
+
conditionNames: ["es2020", "es2015", "..."]
|
|
433
418
|
},
|
|
434
419
|
resolveLoader: {
|
|
435
420
|
symlinks: true
|
|
@@ -452,11 +437,7 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
452
437
|
libraryTarget: undefined,
|
|
453
438
|
crossOriginLoading: false,
|
|
454
439
|
trustedTypes: "angular#bundler",
|
|
455
|
-
scriptType: "module"
|
|
456
|
-
|
|
457
|
-
...this._config.moduleFederation ? {
|
|
458
|
-
publicPath: "auto"
|
|
459
|
-
} : {}
|
|
440
|
+
scriptType: "module"
|
|
460
441
|
},
|
|
461
442
|
watch: false,
|
|
462
443
|
watchOptions: {
|
|
@@ -472,8 +453,7 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
472
453
|
experiments: {
|
|
473
454
|
backCompat: false,
|
|
474
455
|
syncWebAssembly: true,
|
|
475
|
-
asyncWebAssembly: true
|
|
476
|
-
...this._config.moduleFederation ? { outputModule: true } : {}
|
|
456
|
+
asyncWebAssembly: true
|
|
477
457
|
},
|
|
478
458
|
infrastructureLogging: { level: "error" },
|
|
479
459
|
stats: "errors-warnings",
|
|
@@ -541,11 +521,7 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
541
521
|
test: /[\\/]node_modules[\\/]/
|
|
542
522
|
} : false
|
|
543
523
|
}
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
...this._config.moduleFederation ? {
|
|
547
|
-
runtimeChunk: false
|
|
548
|
-
} : {}
|
|
524
|
+
}
|
|
549
525
|
},
|
|
550
526
|
module: {
|
|
551
527
|
strictExportPresence: true,
|
|
@@ -566,7 +542,7 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
566
542
|
exclude: [/[/\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill)[/\\]/],
|
|
567
543
|
use: [
|
|
568
544
|
{
|
|
569
|
-
loader: "@angular-devkit/build-angular/src/babel/webpack-loader",
|
|
545
|
+
loader: fileURLToPath(await import.meta.resolve!("@angular-devkit/build-angular/src/babel/webpack-loader")),
|
|
570
546
|
options: {
|
|
571
547
|
cacheDirectory: path.resolve(this._cacheBasePath, "webpack-babel"),
|
|
572
548
|
scriptTarget: ts.ScriptTarget.ES2017,
|
|
@@ -581,7 +557,7 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
581
557
|
{
|
|
582
558
|
test: /\.[cm]?jsx?$/,
|
|
583
559
|
enforce: "pre" as const,
|
|
584
|
-
loader: "source-map-loader",
|
|
560
|
+
loader: fileURLToPath(await import.meta.resolve!("source-map-loader")),
|
|
585
561
|
options: {
|
|
586
562
|
filterSourceMappingUrl: (mapUri: string, resourcePath: string) => {
|
|
587
563
|
const projRegex = new RegExp(`node_modules[\\\\/]@${projName}[\\\\/]`);
|
|
@@ -594,7 +570,7 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
594
570
|
] : [],
|
|
595
571
|
{
|
|
596
572
|
test: /\.[cm]?tsx?$/,
|
|
597
|
-
loader: "@ngtools/webpack",
|
|
573
|
+
loader: fileURLToPath(await import.meta.resolve!("@ngtools/webpack")),
|
|
598
574
|
exclude: [/[/\\](?:css-loader|mini-css-extract-plugin|webpack)[/\\]/]
|
|
599
575
|
},
|
|
600
576
|
{
|
|
@@ -612,7 +588,7 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
612
588
|
loader: MiniCssExtractPlugin.loader
|
|
613
589
|
},
|
|
614
590
|
{
|
|
615
|
-
loader: "css-loader",
|
|
591
|
+
loader: fileURLToPath(await import.meta.resolve!("css-loader")),
|
|
616
592
|
options: { url: false, sourceMap: watch }
|
|
617
593
|
}
|
|
618
594
|
],
|
|
@@ -628,11 +604,11 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
628
604
|
{
|
|
629
605
|
use: [
|
|
630
606
|
{
|
|
631
|
-
loader: "resolve-url-loader",
|
|
607
|
+
loader: fileURLToPath(await import.meta.resolve!("resolve-url-loader")),
|
|
632
608
|
options: { sourceMap: watch }
|
|
633
609
|
},
|
|
634
610
|
{
|
|
635
|
-
loader: "sass-loader",
|
|
611
|
+
loader: fileURLToPath(await import.meta.resolve!("sass-loader")),
|
|
636
612
|
options: {
|
|
637
613
|
implementation: sassImplementation,
|
|
638
614
|
sourceMap: true,
|
|
@@ -818,44 +794,7 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
818
794
|
}
|
|
819
795
|
return resultMessages.join(os.EOL);
|
|
820
796
|
}
|
|
821
|
-
})
|
|
822
|
-
...this._config.moduleFederation === "remote" ? [
|
|
823
|
-
new webpack.container.ModuleFederationPlugin({
|
|
824
|
-
library: { type: "module" },
|
|
825
|
-
name: npmConfig.name.replace(/[^0-9A-z]/g, "_"),
|
|
826
|
-
filename: "remoteEntry.js",
|
|
827
|
-
exposes: {
|
|
828
|
-
"./AppMfeModule": path.resolve(this._rootPath, "src/AppMfeModule")
|
|
829
|
-
},
|
|
830
|
-
shared: mf.share({
|
|
831
|
-
/*"@angular/core": { singleton: true, strictVersion: true, requiredVersion: "auto" },
|
|
832
|
-
"@angular/common": { singleton: true, strictVersion: true, requiredVersion: "auto" },
|
|
833
|
-
"@angular/common/http": { singleton: true, strictVersion: true, requiredVersion: "auto" },
|
|
834
|
-
"@angular/router": { singleton: true, strictVersion: true, requiredVersion: "auto" },
|
|
835
|
-
"@simplysm/sd-angular": { singleton: true, strictVersion: true, requiredVersion: "auto" },*/
|
|
836
|
-
|
|
837
|
-
...shared,
|
|
838
|
-
...sharedMappings.getDescriptors()
|
|
839
|
-
} as any, path.resolve(this._rootPath, "package.json"))
|
|
840
|
-
}),
|
|
841
|
-
sharedMappings.getPlugin()
|
|
842
|
-
] : this._config.moduleFederation === "host" ? [
|
|
843
|
-
new webpack.container.ModuleFederationPlugin({
|
|
844
|
-
library: { type: "module" },
|
|
845
|
-
remotes: {},
|
|
846
|
-
shared: mf.share({
|
|
847
|
-
/*"@angular/core": { singleton: true, strictVersion: true, requiredVersion: "auto" },
|
|
848
|
-
"@angular/common": { singleton: true, strictVersion: true, requiredVersion: "auto" },
|
|
849
|
-
"@angular/common/http": { singleton: true, strictVersion: true, requiredVersion: "auto" },
|
|
850
|
-
"@angular/router": { singleton: true, strictVersion: true, requiredVersion: "auto" },
|
|
851
|
-
"@simplysm/sd-angular": { singleton: true, strictVersion: true, requiredVersion: "auto" },*/
|
|
852
|
-
|
|
853
|
-
...shared,
|
|
854
|
-
...sharedMappings.getDescriptors()
|
|
855
|
-
} as any, path.resolve(this._rootPath, "package.json"))
|
|
856
|
-
}),
|
|
857
|
-
sharedMappings.getPlugin()
|
|
858
|
-
] : []
|
|
797
|
+
})
|
|
859
798
|
] as any[]
|
|
860
799
|
};
|
|
861
800
|
}
|
|
@@ -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) => {
|
package/src/commons.ts
CHANGED
|
@@ -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,
|
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
export const fc_project_yarnrc = (): string => /* language=yml */ `
|
|
2
2
|
nodeLinker: node-modules
|
|
3
|
-
|
|
4
|
-
packageExtensions:
|
|
5
|
-
"@angular-architects/module-federation-runtime@*":
|
|
6
|
-
dependencies:
|
|
7
|
-
"@angular/common": ^14.0.0
|
|
8
|
-
"@angular/core": ^14.0.0
|
|
9
|
-
rxjs: ^7.4.0
|
|
10
|
-
zone.js: ~0.11.4
|
|
11
|
-
|
|
12
|
-
plugins:
|
|
13
|
-
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
|
14
|
-
spec: "@yarnpkg/plugin-interactive-tools"
|
|
15
|
-
|
|
16
3
|
yarnPath: .yarn/releases/yarn-3.2.2.cjs
|
|
17
4
|
|
|
18
5
|
`.trim();
|
|
@@ -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`;
|