@simplysm/sd-cli 6.0.19 → 6.0.27
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/.eslintrc.js +1 -2
- package/dist-node/bin/sd-cli.js +25 -8
- package/dist-node/bin/sd-cli.js.map +1 -1
- package/dist-node/build-tools/SdCliIndexFileGenerator.js +51 -0
- package/dist-node/build-tools/SdCliIndexFileGenerator.js.map +1 -0
- package/dist-node/build-tools/SdCliNgModuleFilesGenerator.js +621 -0
- package/dist-node/build-tools/SdCliNgModuleFilesGenerator.js.map +1 -0
- package/dist-node/build-tools/metadata/SdAotMetadataReader.js +270 -0
- package/dist-node/build-tools/metadata/SdAotMetadataReader.js.map +1 -0
- package/dist-node/build-tools/metadata/SdIvyMetadataReader.js +101 -0
- package/dist-node/build-tools/metadata/SdIvyMetadataReader.js.map +1 -0
- package/dist-node/build-tools/metadata/SdMyMetadataReader.js +298 -0
- package/dist-node/build-tools/metadata/SdMyMetadataReader.js.map +1 -0
- package/dist-node/{build-tools → builders}/SdCliJavascriptLinter.js +1 -1
- package/dist-node/builders/SdCliJavascriptLinter.js.map +1 -0
- package/dist-node/{build-tools → builders}/SdCliNgClientBuilder.js +176 -102
- package/dist-node/builders/SdCliNgClientBuilder.js.map +1 -0
- package/dist-node/builders/SdCliNgLibraryBuilder.js +238 -0
- package/dist-node/builders/SdCliNgLibraryBuilder.js.map +1 -0
- package/dist-node/{build-tools → builders}/SdCliPublisher.js +0 -0
- package/dist-node/builders/SdCliPublisher.js.map +1 -0
- package/dist-node/{build-tools → builders}/SdCliServerBuilder.js +8 -6
- package/dist-node/builders/SdCliServerBuilder.js.map +1 -0
- package/dist-node/builders/SdCliTypescriptBuilder.js +304 -0
- package/dist-node/builders/SdCliTypescriptBuilder.js.map +1 -0
- package/dist-node/entry-points/SdCliLocalUpdater.js +9 -8
- package/dist-node/entry-points/SdCliLocalUpdater.js.map +1 -1
- package/dist-node/entry-points/SdCliProject.js +11 -9
- package/dist-node/entry-points/SdCliProject.js.map +1 -1
- package/dist-node/packages/SdCliClientPackage.js +12 -2
- package/dist-node/packages/SdCliClientPackage.js.map +1 -1
- package/dist-node/packages/SdCliLibraryPackage.js +17 -9
- package/dist-node/packages/SdCliLibraryPackage.js.map +1 -1
- package/dist-node/packages/SdCliServerPackage.js +2 -2
- package/dist-node/packages/SdCliServerPackage.js.map +1 -1
- package/dist-node/utils/SdCliFileCrypto.js +76 -0
- package/dist-node/utils/SdCliFileCrypto.js.map +1 -0
- package/dist-node/utils/SdProjectConfigUtil.js +1 -1
- package/dist-node/utils/SdProjectConfigUtil.js.map +1 -1
- package/dist-node/utils/SdWebpackUtil.js +12 -3
- package/dist-node/utils/SdWebpackUtil.js.map +1 -1
- package/dist-node/workers/lib-build-worker.js +7 -6
- package/dist-node/workers/lib-build-worker.js.map +1 -1
- package/dist-types/build-tools/SdCliIndexFileGenerator.d.ts +12 -0
- package/dist-types/build-tools/SdCliNgModuleFilesGenerator.d.ts +42 -0
- package/dist-types/build-tools/metadata/SdAotMetadataReader.d.ts +57 -0
- package/dist-types/build-tools/metadata/SdIvyMetadataReader.d.ts +41 -0
- package/dist-types/build-tools/metadata/SdMyMetadataReader.d.ts +57 -0
- package/dist-types/{build-tools → builders}/SdCliJavascriptLinter.d.ts +0 -0
- package/dist-types/{build-tools → builders}/SdCliNgClientBuilder.d.ts +1 -1
- package/dist-types/builders/SdCliNgLibraryBuilder.d.ts +27 -0
- package/dist-types/{build-tools → builders}/SdCliPublisher.d.ts +0 -0
- package/dist-types/{build-tools → builders}/SdCliServerBuilder.d.ts +0 -0
- package/dist-types/builders/SdCliTypescriptBuilder.d.ts +46 -0
- package/dist-types/commons.d.ts +11 -3
- package/dist-types/packages/SdCliClientPackage.d.ts +1 -1
- package/dist-types/utils/SdCliFileCrypto.d.ts +7 -0
- package/dist-types/utils/SdWebpackUtil.d.ts +1 -0
- package/package.json +10 -7
- package/schema/schema.json +247 -0
- package/src/bin/sd-cli.ts +37 -14
- package/src/build-tools/SdCliIndexFileGenerator.ts +61 -0
- package/src/build-tools/SdCliNgModuleFilesGenerator.ts +837 -0
- package/src/build-tools/metadata/SdAotMetadataReader.ts +368 -0
- package/src/build-tools/metadata/SdIvyMetadataReader.ts +152 -0
- package/src/build-tools/metadata/SdMyMetadataReader.ts +379 -0
- package/src/{build-tools → builders}/SdCliJavascriptLinter.ts +1 -1
- package/src/{build-tools → builders}/SdCliNgClientBuilder.ts +209 -111
- package/src/builders/SdCliNgLibraryBuilder.ts +336 -0
- package/src/{build-tools → builders}/SdCliPublisher.ts +0 -0
- package/src/{build-tools → builders}/SdCliServerBuilder.ts +14 -8
- package/src/builders/SdCliTypescriptBuilder.ts +488 -0
- package/src/commons.ts +11 -3
- package/src/entry-points/SdCliLocalUpdater.ts +9 -8
- package/src/entry-points/SdCliProject.ts +12 -9
- package/src/packages/SdCliClientPackage.ts +14 -3
- package/src/packages/SdCliLibraryPackage.ts +19 -11
- package/src/packages/SdCliServerPackage.ts +2 -2
- package/src/utils/SdCliFileCrypto.ts +87 -0
- package/src/utils/SdCliUtils.ts +56 -0
- package/src/utils/SdProjectConfigUtil.ts +1 -1
- package/src/utils/SdWebpackUtil.ts +13 -3
- package/src/workers/lib-build-worker.ts +8 -7
- package/dist-node/build-tools/SdCliJavascriptLinter.js.map +0 -1
- package/dist-node/build-tools/SdCliNgClientBuilder.js.map +0 -1
- package/dist-node/build-tools/SdCliNgLibraryBuilder.js +0 -164
- package/dist-node/build-tools/SdCliNgLibraryBuilder.js.map +0 -1
- package/dist-node/build-tools/SdCliPublisher.js.map +0 -1
- package/dist-node/build-tools/SdCliServerBuilder.js.map +0 -1
- package/dist-node/build-tools/SdCliTypescriptBuilder.js +0 -316
- package/dist-node/build-tools/SdCliTypescriptBuilder.js.map +0 -1
- package/dist-node/build-tools/SdCliTypescriptIndexFileGenerator.js +0 -75
- package/dist-node/build-tools/SdCliTypescriptIndexFileGenerator.js.map +0 -1
- package/dist-types/build-tools/SdCliNgLibraryBuilder.d.ts +0 -23
- package/dist-types/build-tools/SdCliTypescriptBuilder.d.ts +0 -37
- package/dist-types/build-tools/SdCliTypescriptIndexFileGenerator.d.ts +0 -12
- package/src/build-tools/SdCliNgLibraryBuilder.ts +0 -225
- package/src/build-tools/SdCliTypescriptBuilder.ts +0 -424
- package/src/build-tools/SdCliTypescriptIndexFileGenerator.ts +0 -93
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { FsUtil, PathUtil, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
import { ISdAutoIndexConfig, ITsconfig } from "../commons";
|
|
4
|
-
import * as os from "os";
|
|
5
|
-
|
|
6
|
-
export class SdCliTypescriptIndexFileGenerator {
|
|
7
|
-
private _contentCache?: string;
|
|
8
|
-
private readonly _indexFilePath: string;
|
|
9
|
-
|
|
10
|
-
public constructor(public rootPath: string, public autoIndex: ISdAutoIndexConfig) {
|
|
11
|
-
this._indexFilePath = path.resolve(this.rootPath, "src/index.ts");
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public async generateAsync(watch: boolean): Promise<void> {
|
|
15
|
-
if (watch) {
|
|
16
|
-
const watchPaths = await this._getWatchPathsAsync();
|
|
17
|
-
const watcher = new SdFsWatcher();
|
|
18
|
-
watcher
|
|
19
|
-
.on("change", async (changeInfos) => {
|
|
20
|
-
const dirtyFilePaths = changeInfos
|
|
21
|
-
.map((changeInfo) => changeInfo.filePath)
|
|
22
|
-
.filter((item) => (
|
|
23
|
-
path.basename(item).includes(".")
|
|
24
|
-
&& item !== this._indexFilePath
|
|
25
|
-
))
|
|
26
|
-
.distinct();
|
|
27
|
-
|
|
28
|
-
if (dirtyFilePaths.length === 0) return;
|
|
29
|
-
|
|
30
|
-
const watchPaths2 = await this._getWatchPathsAsync();
|
|
31
|
-
watcher.replaceWatchPaths(watchPaths2);
|
|
32
|
-
|
|
33
|
-
await this._generateAsync();
|
|
34
|
-
})
|
|
35
|
-
.watch(watchPaths);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
await this._generateAsync();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
private async _getWatchPathsAsync(): Promise<string[]> {
|
|
42
|
-
return (await FsUtil.globAsync(path.resolve(this.rootPath, "src/**/*.ts")))
|
|
43
|
-
.filter((item) => (
|
|
44
|
-
!item.includes("node_modules")
|
|
45
|
-
&& FsUtil.exists(item)
|
|
46
|
-
&& FsUtil.isDirectory(item)
|
|
47
|
-
));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
private async _generateAsync(): Promise<void> {
|
|
51
|
-
const importTexts: string[] = [];
|
|
52
|
-
|
|
53
|
-
// simplysm.json 에 등록된 polyfills 를 모두 import
|
|
54
|
-
if (this.autoIndex.polyfills) {
|
|
55
|
-
for (const polyfill of this.autoIndex.polyfills) {
|
|
56
|
-
importTexts.push(`import "${polyfill}";`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// 파일들 import
|
|
61
|
-
const filePaths = await this._getFilePathsAsync();
|
|
62
|
-
for (const filePath of filePaths) {
|
|
63
|
-
const requirePath = PathUtil.posix(path.relative(path.dirname(this._indexFilePath), filePath))
|
|
64
|
-
.replace(/\.ts$/, "")
|
|
65
|
-
.replace(/\/index$/, "");
|
|
66
|
-
|
|
67
|
-
const sourceTsFileContent = await FsUtil.readFileAsync(filePath);
|
|
68
|
-
if (sourceTsFileContent.split("\n").some((line) => line.startsWith("export "))) {
|
|
69
|
-
importTexts.push(`export * from "./${requirePath}";`);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
importTexts.push(`import "./${requirePath}";`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const content = importTexts.join(os.EOL) + os.EOL;
|
|
77
|
-
if (content !== this._contentCache) {
|
|
78
|
-
this._contentCache = content;
|
|
79
|
-
await FsUtil.writeFileAsync(this._indexFilePath, content);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
private async _getFilePathsAsync(): Promise<string[]> {
|
|
84
|
-
const tsconfig: ITsconfig = await FsUtil.readJsonAsync(path.resolve(this.rootPath, "tsconfig.json"));
|
|
85
|
-
const entryFilePaths = tsconfig.files?.map((item) => path.resolve(this.rootPath, item)) ?? [];
|
|
86
|
-
|
|
87
|
-
return (await FsUtil.globAsync(path.resolve(this.rootPath, "src/**/*.ts"), { nodir: true }))
|
|
88
|
-
.filter((item) => (
|
|
89
|
-
!entryFilePaths.includes(item)
|
|
90
|
-
&& item !== this._indexFilePath
|
|
91
|
-
));
|
|
92
|
-
}
|
|
93
|
-
}
|