@simplysm/sd-cli 7.3.2 → 10.0.4
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.cjs +18 -0
- package/dist/build-cluster.js +75 -0
- package/dist/build-cluster.js.map +1 -0
- package/dist/builders/SdCliJsLibLinter.d.ts +18 -0
- package/dist/builders/SdCliJsLibLinter.js +69 -0
- package/dist/builders/SdCliJsLibLinter.js.map +1 -0
- package/dist/builders/SdCliTsLibBuilder.d.ts +20 -0
- package/dist/builders/SdCliTsLibBuilder.js +205 -0
- package/dist/builders/SdCliTsLibBuilder.js.map +1 -0
- package/dist/commons.d.ts +3 -117
- package/dist/commons.js +2 -0
- package/dist/commons.js.map +1 -0
- package/dist/entry/SdCliProject.d.ts +28 -0
- package/dist/entry/SdCliProject.js +269 -0
- package/dist/entry/SdCliProject.js.map +1 -0
- package/dist/sd-cli.js +118 -0
- package/dist/sd-cli.js.map +1 -0
- package/dist/utils/SdCliBuildResultUtil.d.ts +1 -4
- package/dist/utils/SdCliBuildResultUtil.js +37 -0
- package/dist/utils/SdCliBuildResultUtil.js.map +1 -0
- package/dist/utils/SdCliConfigUtil.js +69 -0
- package/dist/utils/SdCliConfigUtil.js.map +1 -0
- package/package.json +10 -59
- package/src/build-cluster.ts +82 -0
- package/src/builders/SdCliJsLibLinter.ts +84 -0
- package/src/builders/SdCliTsLibBuilder.ts +265 -0
- package/src/commons.ts +3 -123
- package/src/entry/SdCliProject.ts +351 -0
- package/src/sd-cli.ts +135 -0
- package/src/utils/SdCliBuildResultUtil.ts +5 -38
- package/tsconfig.json +18 -0
- package/README.md +0 -105
- package/assets/client-files/assets/icons/icon-128x128.png +0 -0
- package/assets/client-files/assets/icons/icon-144x144.png +0 -0
- package/assets/client-files/assets/icons/icon-152x152.png +0 -0
- package/assets/client-files/assets/icons/icon-192x192.png +0 -0
- package/assets/client-files/assets/icons/icon-384x384.png +0 -0
- package/assets/client-files/assets/icons/icon-512x512.png +0 -0
- package/assets/client-files/assets/icons/icon-72x72.png +0 -0
- package/assets/client-files/assets/icons/icon-96x96.png +0 -0
- package/assets/client-files/favicon.ico +0 -0
- package/dist/SdCliBuildResultError.d.ts +0 -5
- package/dist/SdCliBuildResultError.mjs +0 -8
- package/dist/bin/sd-cli.d.ts +0 -2
- package/dist/bin/sd-cli.mjs +0 -410
- package/dist/build-tool/SdCliCacheCompilerHost.d.ts +0 -10
- package/dist/build-tool/SdCliCacheCompilerHost.mjs +0 -51
- package/dist/build-tool/SdCliCordova.d.ts +0 -16
- package/dist/build-tool/SdCliCordova.mjs +0 -212
- package/dist/build-tool/SdCliElectron.d.ts +0 -9
- package/dist/build-tool/SdCliElectron.mjs +0 -71
- package/dist/build-tool/SdCliGithubApi.d.ts +0 -13
- package/dist/build-tool/SdCliGithubApi.mjs +0 -92
- package/dist/build-tool/SdCliIndexFileGenerator.d.ts +0 -13
- package/dist/build-tool/SdCliIndexFileGenerator.mjs +0 -62
- package/dist/build-tool/SdCliNgCacheCompilerHost.d.ts +0 -12
- package/dist/build-tool/SdCliNgCacheCompilerHost.mjs +0 -43
- package/dist/build-tool/SdCliPackageLinter.d.ts +0 -8
- package/dist/build-tool/SdCliPackageLinter.mjs +0 -62
- package/dist/builder/SdCliClientBuilder.d.ts +0 -26
- package/dist/builder/SdCliClientBuilder.mjs +0 -761
- package/dist/builder/SdCliJsLibBuilder.d.ts +0 -14
- package/dist/builder/SdCliJsLibBuilder.mjs +0 -54
- package/dist/builder/SdCliServerBuilder.d.ts +0 -28
- package/dist/builder/SdCliServerBuilder.mjs +0 -482
- package/dist/builder/SdCliTsLibBuilder.d.ts +0 -35
- package/dist/builder/SdCliTsLibBuilder.mjs +0 -317
- package/dist/commons.mjs +0 -2
- package/dist/entry-points/SdCliFileCrypto.d.ts +0 -7
- package/dist/entry-points/SdCliFileCrypto.mjs +0 -72
- package/dist/entry-points/SdCliLocalUpdate.d.ts +0 -13
- package/dist/entry-points/SdCliLocalUpdate.mjs +0 -100
- package/dist/entry-points/SdCliPrepare.d.ts +0 -5
- package/dist/entry-points/SdCliPrepare.mjs +0 -86
- package/dist/entry-points/SdCliProject.d.ts +0 -34
- package/dist/entry-points/SdCliProject.mjs +0 -416
- package/dist/entry-points/SdCliProjectGenerator.d.ts +0 -44
- package/dist/entry-points/SdCliProjectGenerator.mjs +0 -326
- package/dist/entry-points/file/base/fc_package_eslintrc.d.ts +0 -3
- package/dist/entry-points/file/base/fc_package_eslintrc.mjs +0 -31
- package/dist/entry-points/file/base/fc_package_npmconfig.d.ts +0 -9
- package/dist/entry-points/file/base/fc_package_npmconfig.mjs +0 -32
- package/dist/entry-points/file/base/fc_package_tsconfig.d.ts +0 -5
- package/dist/entry-points/file/base/fc_package_tsconfig.mjs +0 -13
- package/dist/entry-points/file/client/fc_package_AppModule.d.ts +0 -1
- package/dist/entry-points/file/client/fc_package_AppModule.mjs +0 -37
- package/dist/entry-points/file/client/fc_package_AppPage.d.ts +0 -1
- package/dist/entry-points/file/client/fc_package_AppPage.mjs +0 -14
- package/dist/entry-points/file/client/fc_package_Page.d.ts +0 -4
- package/dist/entry-points/file/client/fc_package_Page.mjs +0 -19
- package/dist/entry-points/file/client/fc_package_client_main.d.ts +0 -1
- package/dist/entry-points/file/client/fc_package_client_main.mjs +0 -19
- package/dist/entry-points/file/client/fc_package_index.d.ts +0 -3
- package/dist/entry-points/file/client/fc_package_index.mjs +0 -88
- package/dist/entry-points/file/client/fc_package_manifest.d.ts +0 -5
- package/dist/entry-points/file/client/fc_package_manifest.mjs +0 -54
- package/dist/entry-points/file/client/fc_package_polyfills.d.ts +0 -1
- package/dist/entry-points/file/client/fc_package_polyfills.mjs +0 -11
- package/dist/entry-points/file/client/fc_package_styles.d.ts +0 -1
- package/dist/entry-points/file/client/fc_package_styles.mjs +0 -7
- package/dist/entry-points/file/db/fc_package_DbContext.d.ts +0 -3
- package/dist/entry-points/file/db/fc_package_DbContext.mjs +0 -14
- package/dist/entry-points/file/db/fc_package_DbModel.d.ts +0 -4
- package/dist/entry-points/file/db/fc_package_DbModel.mjs +0 -12
- package/dist/entry-points/file/project/fc_project_editor_config.d.ts +0 -1
- package/dist/entry-points/file/project/fc_project_editor_config.mjs +0 -22
- package/dist/entry-points/file/project/fc_project_eslintrc.d.ts +0 -1
- package/dist/entry-points/file/project/fc_project_eslintrc.mjs +0 -30
- package/dist/entry-points/file/project/fc_project_gitattributes.d.ts +0 -1
- package/dist/entry-points/file/project/fc_project_gitattributes.mjs +0 -6
- package/dist/entry-points/file/project/fc_project_gitignore.d.ts +0 -1
- package/dist/entry-points/file/project/fc_project_gitignore.mjs +0 -27
- package/dist/entry-points/file/project/fc_project_npmconfig.d.ts +0 -7
- package/dist/entry-points/file/project/fc_project_npmconfig.mjs +0 -37
- package/dist/entry-points/file/project/fc_project_readme.d.ts +0 -3
- package/dist/entry-points/file/project/fc_project_readme.mjs +0 -13
- package/dist/entry-points/file/project/fc_project_simplysm.d.ts +0 -1
- package/dist/entry-points/file/project/fc_project_simplysm.mjs +0 -2
- package/dist/entry-points/file/project/fc_project_tsconfig.d.ts +0 -1
- package/dist/entry-points/file/project/fc_project_tsconfig.mjs +0 -25
- package/dist/entry-points/file/server/fc_package_server_main.d.ts +0 -5
- package/dist/entry-points/file/server/fc_package_server_main.mjs +0 -60
- package/dist/index.d.ts +0 -54
- package/dist/index.mjs +0 -55
- package/dist/ng-tools/SdCliNgModuleGenerator.d.ts +0 -29
- package/dist/ng-tools/SdCliNgModuleGenerator.mjs +0 -502
- package/dist/ng-tools/babel/SdCliBbFileMetadata.d.ts +0 -25
- package/dist/ng-tools/babel/SdCliBbFileMetadata.mjs +0 -539
- package/dist/ng-tools/babel/SdCliBbRootMetadata.d.ts +0 -23
- package/dist/ng-tools/babel/SdCliBbRootMetadata.mjs +0 -247
- package/dist/ng-tools/babel/SdCliBbUtil.d.ts +0 -5
- package/dist/ng-tools/babel/SdCliBbUtil.mjs +0 -14
- package/dist/ng-tools/babel/TSdCliBbNgMetadata.d.ts +0 -42
- package/dist/ng-tools/babel/TSdCliBbNgMetadata.mjs +0 -216
- package/dist/ng-tools/babel/TSdCliBbTypeMetadata.d.ts +0 -55
- package/dist/ng-tools/babel/TSdCliBbTypeMetadata.mjs +0 -151
- package/dist/ng-tools/commons.d.ts +0 -9
- package/dist/ng-tools/commons.mjs +0 -2
- package/dist/ng-tools/typescript/SdCliTsFileMetadata.d.ts +0 -61
- package/dist/ng-tools/typescript/SdCliTsFileMetadata.mjs +0 -325
- package/dist/ng-tools/typescript/SdCliTsRootMetadata.d.ts +0 -8
- package/dist/ng-tools/typescript/SdCliTsRootMetadata.mjs +0 -28
- package/dist/ng-tools/typescript/SdCliTsUtil.d.ts +0 -5
- package/dist/ng-tools/typescript/SdCliTsUtil.mjs +0 -28
- package/dist/packages/SdCliPackage.d.ts +0 -22
- package/dist/packages/SdCliPackage.mjs +0 -206
- package/dist/utils/SdCliBuildResultUtil.mjs +0 -63
- package/dist/utils/SdCliConfigUtil.mjs +0 -69
- package/dist/utils/SdCliNpmConfigUtil.d.ts +0 -7
- package/dist/utils/SdCliNpmConfigUtil.mjs +0 -15
- package/dist/worker/build-worker.mjs +0 -67
- package/dist/worker/server-worker.mjs +0 -67
- package/docs/client-add-page.md +0 -8
- package/docs/client-router.md +0 -85
- package/docs/client-sw.md +0 -101
- package/docs/conf-orm.md +0 -81
- package/docs/conf-usage.md +0 -5
- package/docs/lib-local-update.md +0 -50
- package/docs/lib-ts-paths.md +0 -25
- package/lib/cordova-entry.js +0 -22
- package/src/SdCliBuildResultError.ts +0 -9
- package/src/bin/sd-cli.ts +0 -493
- package/src/build-tool/SdCliCacheCompilerHost.ts +0 -79
- package/src/build-tool/SdCliCordova.ts +0 -263
- package/src/build-tool/SdCliElectron.ts +0 -84
- package/src/build-tool/SdCliGithubApi.ts +0 -111
- package/src/build-tool/SdCliIndexFileGenerator.ts +0 -79
- package/src/build-tool/SdCliNgCacheCompilerHost.ts +0 -58
- package/src/build-tool/SdCliPackageLinter.ts +0 -74
- package/src/builder/SdCliClientBuilder.ts +0 -871
- package/src/builder/SdCliJsLibBuilder.ts +0 -70
- package/src/builder/SdCliServerBuilder.ts +0 -552
- package/src/builder/SdCliTsLibBuilder.ts +0 -450
- package/src/entry-points/SdCliFileCrypto.ts +0 -87
- package/src/entry-points/SdCliLocalUpdate.ts +0 -121
- package/src/entry-points/SdCliPrepare.ts +0 -86
- package/src/entry-points/SdCliProject.ts +0 -491
- package/src/entry-points/SdCliProjectGenerator.ts +0 -402
- package/src/entry-points/file/base/fc_package_eslintrc.ts +0 -30
- package/src/entry-points/file/base/fc_package_npmconfig.ts +0 -43
- package/src/entry-points/file/base/fc_package_tsconfig.ts +0 -12
- package/src/entry-points/file/client/fc_package_AppModule.ts +0 -36
- package/src/entry-points/file/client/fc_package_AppPage.ts +0 -13
- package/src/entry-points/file/client/fc_package_Page.ts +0 -19
- package/src/entry-points/file/client/fc_package_client_main.ts +0 -18
- package/src/entry-points/file/client/fc_package_index.ts +0 -87
- package/src/entry-points/file/client/fc_package_manifest.ts +0 -53
- package/src/entry-points/file/client/fc_package_polyfills.ts +0 -10
- package/src/entry-points/file/client/fc_package_styles.ts +0 -6
- package/src/entry-points/file/db/fc_package_DbContext.ts +0 -14
- package/src/entry-points/file/db/fc_package_DbModel.ts +0 -11
- package/src/entry-points/file/project/fc_project_editor_config.ts +0 -21
- package/src/entry-points/file/project/fc_project_eslintrc.ts +0 -29
- package/src/entry-points/file/project/fc_project_gitattributes.ts +0 -5
- package/src/entry-points/file/project/fc_project_gitignore.ts +0 -26
- package/src/entry-points/file/project/fc_project_npmconfig.ts +0 -36
- package/src/entry-points/file/project/fc_project_readme.ts +0 -12
- package/src/entry-points/file/project/fc_project_simplysm.ts +0 -1
- package/src/entry-points/file/project/fc_project_tsconfig.ts +0 -24
- package/src/entry-points/file/server/fc_package_server_main.ts +0 -62
- package/src/index.ts +0 -54
- package/src/ng-tools/SdCliNgModuleGenerator.ts +0 -672
- package/src/ng-tools/babel/SdCliBbFileMetadata.ts +0 -629
- package/src/ng-tools/babel/SdCliBbRootMetadata.ts +0 -292
- package/src/ng-tools/babel/SdCliBbUtil.ts +0 -15
- package/src/ng-tools/babel/TSdCliBbNgMetadata.ts +0 -251
- package/src/ng-tools/babel/TSdCliBbTypeMetadata.ts +0 -212
- package/src/ng-tools/commons.ts +0 -3
- package/src/ng-tools/typescript/SdCliTsFileMetadata.ts +0 -384
- package/src/ng-tools/typescript/SdCliTsRootMetadata.ts +0 -32
- package/src/ng-tools/typescript/SdCliTsUtil.ts +0 -29
- package/src/packages/SdCliPackage.ts +0 -259
- package/src/utils/SdCliNpmConfigUtil.ts +0 -16
- package/src/worker/build-worker.ts +0 -73
- package/src/worker/server-worker.ts +0 -72
- /package/dist/{worker/build-worker.d.ts → build-cluster.d.ts} +0 -0
- /package/dist/{worker/server-worker.d.ts → sd-cli.d.ts} +0 -0
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { ISdCliPackageBuildResult } from "../commons";
|
|
2
|
-
import { EventEmitter } from "events";
|
|
3
|
-
import { FsUtil, Logger, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
4
|
-
import path from "path";
|
|
5
|
-
import { SdCliPackageLinter } from "../build-tool/SdCliPackageLinter";
|
|
6
|
-
|
|
7
|
-
export class SdCliJsLibBuilder extends EventEmitter {
|
|
8
|
-
private readonly _logger = Logger.get(["simplysm", "sd-cli", this.constructor.name]);
|
|
9
|
-
|
|
10
|
-
private readonly _linter: SdCliPackageLinter;
|
|
11
|
-
|
|
12
|
-
public constructor(private readonly _rootPath: string) {
|
|
13
|
-
super();
|
|
14
|
-
this._linter = new SdCliPackageLinter(this._rootPath);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
public override on(event: "change", listener: () => void): this;
|
|
18
|
-
public override on(event: "complete", listener: (results: ISdCliPackageBuildResult[]) => void): this;
|
|
19
|
-
public override on(event: string | symbol, listener: (...args: any[]) => void): this {
|
|
20
|
-
return super.on(event, listener);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public async watchAsync(): Promise<void> {
|
|
24
|
-
this.emit("change");
|
|
25
|
-
|
|
26
|
-
const relatedPaths = await this.getRelatedPathsAsync();
|
|
27
|
-
const watcher = SdFsWatcher.watch(relatedPaths);
|
|
28
|
-
watcher.onChange({}, async (changedInfos) => {
|
|
29
|
-
const changeFilePaths = changedInfos.filter((item) => ["add", "change", "unlink"].includes(item.event)).map((item) => item.path);
|
|
30
|
-
if (changeFilePaths.length === 0) return;
|
|
31
|
-
|
|
32
|
-
this._logger.debug("파일 변경 감지");
|
|
33
|
-
this.emit("change");
|
|
34
|
-
const watchBuildResults: ISdCliPackageBuildResult[] = [];
|
|
35
|
-
|
|
36
|
-
const lintFilePaths = changedInfos.filter((item) => ["add", "change"].includes(item.event)).map((item) => item.path);
|
|
37
|
-
if (lintFilePaths.length > 0) {
|
|
38
|
-
watchBuildResults.push(...await this._linter.lintAsync(lintFilePaths));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const watchRelatedPaths = await this.getRelatedPathsAsync();
|
|
42
|
-
watcher.add(watchRelatedPaths);
|
|
43
|
-
|
|
44
|
-
this.emit("complete", watchBuildResults);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
// 빌드
|
|
48
|
-
const buildResults = await this._linter.lintAsync(relatedPaths);
|
|
49
|
-
|
|
50
|
-
this.emit("complete", buildResults);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public async buildAsync(): Promise<ISdCliPackageBuildResult[]> {
|
|
54
|
-
const relatedPaths = await this.getRelatedPathsAsync();
|
|
55
|
-
return await this._linter.lintAsync(relatedPaths);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
private async getRelatedPathsAsync(): Promise<string[]> {
|
|
59
|
-
const mySourceGlobPath = path.resolve(this._rootPath, "**", "+(*.js|*.cjs|*.mjs)");
|
|
60
|
-
const mySourceFilePaths = await FsUtil.globAsync(mySourceGlobPath, {
|
|
61
|
-
ignore: [
|
|
62
|
-
"**/node_modules/**",
|
|
63
|
-
"**/dist/**",
|
|
64
|
-
"**/.*/**"
|
|
65
|
-
]
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
return [...mySourceFilePaths, path.resolve(this._rootPath, ".eslintrc.cjs")].distinct();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1,552 +0,0 @@
|
|
|
1
|
-
import { INpmConfig, ISdCliPackageBuildResult, ISdCliServerPackageConfig, ITsconfig } from "../commons";
|
|
2
|
-
import { EventEmitter } from "events";
|
|
3
|
-
import { FsUtil, Logger, PathUtil } from "@simplysm/sd-core-node";
|
|
4
|
-
import webpack from "webpack";
|
|
5
|
-
import path from "path";
|
|
6
|
-
import ts from "typescript";
|
|
7
|
-
import { SdCliBuildResultUtil } from "../utils/SdCliBuildResultUtil";
|
|
8
|
-
import { ErrorInfo } from "ts-loader/dist/interfaces";
|
|
9
|
-
import os from "os";
|
|
10
|
-
import { ESLint } from "eslint";
|
|
11
|
-
import TerserPlugin from "terser-webpack-plugin";
|
|
12
|
-
import { ObjectUtil, StringUtil } from "@simplysm/sd-core-common";
|
|
13
|
-
import ESLintWebpackPlugin from "eslint-webpack-plugin";
|
|
14
|
-
import CopyWebpackPlugin from "copy-webpack-plugin";
|
|
15
|
-
import { LicenseWebpackPlugin } from "license-webpack-plugin";
|
|
16
|
-
import { SdCliNpmConfigUtil } from "../utils/SdCliNpmConfigUtil";
|
|
17
|
-
import { createHash } from "crypto";
|
|
18
|
-
import { fileURLToPath } from "url";
|
|
19
|
-
import LintResult = ESLint.LintResult;
|
|
20
|
-
|
|
21
|
-
export class SdCliServerBuilder extends EventEmitter {
|
|
22
|
-
private readonly _logger = Logger.get(["simplysm", "sd-cli", this.constructor.name]);
|
|
23
|
-
|
|
24
|
-
private readonly _tsconfigFilePath: string;
|
|
25
|
-
private readonly _tsconfig: ITsconfig;
|
|
26
|
-
private readonly _parsedTsconfig: ts.ParsedCommandLine;
|
|
27
|
-
private readonly _npmConfigMap = new Map<string, INpmConfig>();
|
|
28
|
-
|
|
29
|
-
private readonly _cacheBasePath = path.resolve(this._rootPath, ".cache");
|
|
30
|
-
|
|
31
|
-
public constructor(private readonly _rootPath: string,
|
|
32
|
-
private readonly _config: ISdCliServerPackageConfig,
|
|
33
|
-
private readonly _projRootPath: string) {
|
|
34
|
-
super();
|
|
35
|
-
|
|
36
|
-
// tsconfig
|
|
37
|
-
this._tsconfigFilePath = path.resolve(this._rootPath, "tsconfig-build.json");
|
|
38
|
-
this._tsconfig = FsUtil.readJson(this._tsconfigFilePath);
|
|
39
|
-
this._parsedTsconfig = ts.parseJsonConfigFileContent(this._tsconfig, ts.sys, this._rootPath);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public override on(event: "change", listener: () => void): this;
|
|
43
|
-
public override on(event: "complete", listener: (results: ISdCliPackageBuildResult[]) => void): this;
|
|
44
|
-
public override on(event: string | symbol, listener: (...args: any[]) => void): this {
|
|
45
|
-
return super.on(event, listener);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
private async _checkCacheAsync(watch: boolean): Promise<void> {
|
|
49
|
-
const projPkgLockContent = await FsUtil.readFileAsync(path.resolve(this._projRootPath, "yarn.lock"));
|
|
50
|
-
|
|
51
|
-
// const cachePath = path.resolve(cacheBasePath, pkgVersion);
|
|
52
|
-
|
|
53
|
-
const versionHash = createHash("sha1")
|
|
54
|
-
.update(projPkgLockContent)
|
|
55
|
-
.update(JSON.stringify(this._parsedTsconfig.options))
|
|
56
|
-
.update(JSON.stringify(this._config))
|
|
57
|
-
.update(watch.toString())
|
|
58
|
-
.digest("hex");
|
|
59
|
-
if (
|
|
60
|
-
!FsUtil.exists(path.resolve(this._cacheBasePath, "version")) // 버전파일이 없거나
|
|
61
|
-
|| (
|
|
62
|
-
FsUtil.exists(path.resolve(this._cacheBasePath, "version")) &&
|
|
63
|
-
await FsUtil.readFileAsync(path.resolve(this._cacheBasePath, "version")) !== versionHash
|
|
64
|
-
) // 버전이 현재 버전과 다르면
|
|
65
|
-
) {
|
|
66
|
-
// 캐시 삭제
|
|
67
|
-
await FsUtil.removeAsync(path.resolve(this._cacheBasePath));
|
|
68
|
-
}
|
|
69
|
-
// 버전쓰기
|
|
70
|
-
await FsUtil.writeFileAsync(path.resolve(this._cacheBasePath, "version"), versionHash);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
public async watchAsync(): Promise<void> {
|
|
74
|
-
// DIST 비우기
|
|
75
|
-
await FsUtil.removeAsync(this._parsedTsconfig.options.outDir!);
|
|
76
|
-
|
|
77
|
-
// 캐시체크
|
|
78
|
-
await this._checkCacheAsync(true);
|
|
79
|
-
|
|
80
|
-
// 빌드 준비
|
|
81
|
-
const extModules = this._getExternalModules();
|
|
82
|
-
const webpackConfig = await this._getWebpackConfigAsync(true, extModules);
|
|
83
|
-
const compiler = webpack(webpackConfig);
|
|
84
|
-
await new Promise<void>((resolve, reject) => {
|
|
85
|
-
compiler.hooks.watchRun.tapAsync(this.constructor.name, (args, callback) => {
|
|
86
|
-
this.emit("change");
|
|
87
|
-
this._logger.debug("Webpack 빌드 수행...");
|
|
88
|
-
callback();
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
compiler.watch({}, async (err, stats) => {
|
|
92
|
-
if (err != null || stats == null) {
|
|
93
|
-
this.emit("complete", [{
|
|
94
|
-
filePath: undefined,
|
|
95
|
-
line: undefined,
|
|
96
|
-
char: undefined,
|
|
97
|
-
code: undefined,
|
|
98
|
-
severity: "error",
|
|
99
|
-
message: err?.stack ?? "알 수 없는 오류 (stats=null)"
|
|
100
|
-
}]);
|
|
101
|
-
reject(err);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// .config.json 파일 쓰기
|
|
106
|
-
await this._writeDistConfigFileAsync();
|
|
107
|
-
|
|
108
|
-
// 결과 반환
|
|
109
|
-
this._logger.debug("Webpack 빌드 완료");
|
|
110
|
-
const results = SdCliBuildResultUtil.convertFromWebpackStats(stats);
|
|
111
|
-
this.emit("complete", results);
|
|
112
|
-
resolve();
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
public async buildAsync(): Promise<ISdCliPackageBuildResult[]> {
|
|
118
|
-
// DIST 비우기
|
|
119
|
-
await FsUtil.removeAsync(this._parsedTsconfig.options.outDir!);
|
|
120
|
-
|
|
121
|
-
// 빌드
|
|
122
|
-
this._logger.debug("Webpack 빌드 수행...");
|
|
123
|
-
const extModules = this._getExternalModules();
|
|
124
|
-
const webpackConfig = await this._getWebpackConfigAsync(false, extModules);
|
|
125
|
-
const compiler = webpack(webpackConfig);
|
|
126
|
-
const buildResults = await new Promise<ISdCliPackageBuildResult[]>((resolve, reject) => {
|
|
127
|
-
compiler.run((err, stats) => {
|
|
128
|
-
if (err != null || stats == null) {
|
|
129
|
-
reject(err);
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// 결과 반환
|
|
134
|
-
const results = SdCliBuildResultUtil.convertFromWebpackStats(stats);
|
|
135
|
-
resolve(results);
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
// .config.json 파일 쓰기
|
|
140
|
-
await this._writeDistConfigFileAsync();
|
|
141
|
-
|
|
142
|
-
// pm2.json 파일 쓰기
|
|
143
|
-
await this._writeDistPm2ConfigFileAsync();
|
|
144
|
-
|
|
145
|
-
// iis web.config 파일 쓰기
|
|
146
|
-
await this._writeDistIisConfigFileAsync();
|
|
147
|
-
|
|
148
|
-
// 배포용 package.json 파일 생성
|
|
149
|
-
await this._writeDistNpmConfigFileAsync(extModules.filter((item) => item.exists).map((item) => item.name));
|
|
150
|
-
|
|
151
|
-
// 마무리
|
|
152
|
-
this._logger.debug("Webpack 빌드 완료");
|
|
153
|
-
return buildResults;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
private async _writeDistConfigFileAsync(): Promise<void> {
|
|
157
|
-
const configDistPath = path.resolve(this._parsedTsconfig.options.outDir!, ".config.json");
|
|
158
|
-
await FsUtil.writeFileAsync(configDistPath, JSON.stringify(this._config.configs ?? {}, undefined, 2));
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
private async _writeDistPm2ConfigFileAsync(): Promise<void> {
|
|
162
|
-
if (this._config.pm2 === undefined || this._config.pm2 === false) return;
|
|
163
|
-
|
|
164
|
-
const npmConfig = this._getNpmConfig(this._rootPath)!;
|
|
165
|
-
const pm2DistPath = path.resolve(this._parsedTsconfig.options.outDir!, typeof this._config.pm2 !== "boolean" ? this._config.pm2.fileName ?? "pm2.json" : "pm2.json");
|
|
166
|
-
await FsUtil.writeFileAsync(
|
|
167
|
-
pm2DistPath,
|
|
168
|
-
JSON.stringify(
|
|
169
|
-
ObjectUtil.merge(
|
|
170
|
-
{
|
|
171
|
-
"name": npmConfig.name.replace(/@/g, "").replace(/\//g, "-"),
|
|
172
|
-
"script": path.basename(path.resolve(this._parsedTsconfig.options.outDir!, "main.js")),
|
|
173
|
-
"node_args": "--max-old-space-size=8192",
|
|
174
|
-
// "script": path.basename(path.resolve(this._parsedTsconfig.options.outDir!, "main.mjs")),
|
|
175
|
-
// "node_args": "--experimental-specifier-resolution=node --experimental-import-meta-resolve",
|
|
176
|
-
"watch": true,
|
|
177
|
-
"watch_delay": 2000,
|
|
178
|
-
"ignore_watch": [
|
|
179
|
-
"node_modules",
|
|
180
|
-
"www"
|
|
181
|
-
].distinct(),
|
|
182
|
-
...typeof this._config.pm2 !== "boolean" && this._config.pm2.noInterpreter ? {} : {
|
|
183
|
-
"interpreter": "node@" + process.versions.node,
|
|
184
|
-
},
|
|
185
|
-
"env": {
|
|
186
|
-
NODE_ENV: "production",
|
|
187
|
-
SD_VERSION: npmConfig.version,
|
|
188
|
-
TZ: "Asia/Seoul",
|
|
189
|
-
...this._config.env ? this._config.env : {}
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
(typeof this._config.pm2 !== "boolean") ? this._config.pm2.config : {},
|
|
193
|
-
{
|
|
194
|
-
arrayProcess: "concat",
|
|
195
|
-
useDelTargetNull: true
|
|
196
|
-
}),
|
|
197
|
-
undefined,
|
|
198
|
-
2
|
|
199
|
-
)
|
|
200
|
-
);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
private async _writeDistIisConfigFileAsync(): Promise<void> {
|
|
204
|
-
if (this._config.iis === undefined || this._config.iis === false) return;
|
|
205
|
-
|
|
206
|
-
const iisDistPath = path.resolve(this._parsedTsconfig.options.outDir!, "web.config");
|
|
207
|
-
const serverExeFilePath = (this._config.iis !== true && "serverExeFilePath" in this._config.iis)
|
|
208
|
-
? (this._config.iis.serverExeFilePath ?? "C:\\Program Files\\nodejs\\node.exe")
|
|
209
|
-
: "C:\\Program Files\\nodejs\\node.exe";
|
|
210
|
-
await FsUtil.writeFileAsync(iisDistPath, `
|
|
211
|
-
<configuration>
|
|
212
|
-
<system.webServer>
|
|
213
|
-
<handlers>
|
|
214
|
-
<add name="iisnode" path="main.js" verb="*" modules="iisnode" />
|
|
215
|
-
</handlers>
|
|
216
|
-
<iisnode nodeProcessCommandLine="${serverExeFilePath}"
|
|
217
|
-
watchedFiles="web.config;*.js"
|
|
218
|
-
loggingEnabled="true"
|
|
219
|
-
devErrorsEnabled="true" />
|
|
220
|
-
<rewrite>
|
|
221
|
-
<rules>
|
|
222
|
-
<rule name="main">
|
|
223
|
-
<action type="Rewrite" url="main.js" />
|
|
224
|
-
</rule>
|
|
225
|
-
</rules>
|
|
226
|
-
</rewrite>
|
|
227
|
-
<httpErrors errorMode="Detailed" />
|
|
228
|
-
</system.webServer>
|
|
229
|
-
</configuration>
|
|
230
|
-
|
|
231
|
-
`.trim());
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
private async _writeDistNpmConfigFileAsync(deps: string[]): Promise<void> {
|
|
235
|
-
const distNpmConfig = ObjectUtil.clone(this._getNpmConfig(this._rootPath))!;
|
|
236
|
-
distNpmConfig.dependencies = {};
|
|
237
|
-
for (const dep of deps) {
|
|
238
|
-
distNpmConfig.dependencies[dep] = "*";
|
|
239
|
-
}
|
|
240
|
-
delete distNpmConfig.optionalDependencies;
|
|
241
|
-
delete distNpmConfig.devDependencies;
|
|
242
|
-
delete distNpmConfig.peerDependencies;
|
|
243
|
-
|
|
244
|
-
if (this._config.pm2 !== undefined && (typeof this._config.pm2 === "boolean" || !this._config.pm2.noStartScript)) {
|
|
245
|
-
distNpmConfig.scripts = { "start": "pm2 start pm2.json" };
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
await FsUtil.writeFileAsync(
|
|
249
|
-
path.resolve(this._parsedTsconfig.options.outDir!, "package.json"),
|
|
250
|
-
JSON.stringify(distNpmConfig, undefined, 2)
|
|
251
|
-
);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
private _getInternalModuleCachePaths(projName: string): string[] {
|
|
255
|
-
return [
|
|
256
|
-
...FsUtil.findAllParentChildDirPaths("node_modules/*/package.json", this._rootPath, this._projRootPath),
|
|
257
|
-
...FsUtil.findAllParentChildDirPaths(`node_modules/!(@simplysm|@${projName})/*/package.json`, this._rootPath, this._projRootPath),
|
|
258
|
-
].map((p) => path.dirname(p));
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
private async _getWebpackConfigAsync(watch: boolean, extModules: { name: string; exists: boolean }[]): Promise<webpack.Configuration> {
|
|
262
|
-
const projNpmConfig = this._getNpmConfig(this._projRootPath)!;
|
|
263
|
-
const projName = projNpmConfig.name;
|
|
264
|
-
|
|
265
|
-
const internalModuleCachePaths = watch ? this._getInternalModuleCachePaths(projName) : undefined;
|
|
266
|
-
|
|
267
|
-
const npmConfig = this._getNpmConfig(this._rootPath)!;
|
|
268
|
-
const pkgKey = npmConfig.name.split("/").last()!;
|
|
269
|
-
// const pkgVersion = npmConfig.version;
|
|
270
|
-
|
|
271
|
-
const entries: Record<string, [string]> = {
|
|
272
|
-
main: [path.resolve(this._rootPath, "src/main.ts")]
|
|
273
|
-
};
|
|
274
|
-
if (this._tsconfig.files) {
|
|
275
|
-
for (const entryFileRelPath of this._tsconfig.files) {
|
|
276
|
-
const entryFileBaseName = entryFileRelPath.slice(4, -path.extname(entryFileRelPath).length);
|
|
277
|
-
entries[entryFileBaseName] = [path.resolve(this._rootPath, entryFileRelPath)];
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
let prevProgressMessage = "";
|
|
282
|
-
return {
|
|
283
|
-
mode: watch ? "development" : "production",
|
|
284
|
-
devtool: false,
|
|
285
|
-
target: ["node", "es2020"],
|
|
286
|
-
profile: false,
|
|
287
|
-
resolve: {
|
|
288
|
-
roots: [this._rootPath],
|
|
289
|
-
extensions: [".ts", ".js", ".mjs", ".cjs"],
|
|
290
|
-
symlinks: true,
|
|
291
|
-
modules: [this._projRootPath, "node_modules"],
|
|
292
|
-
mainFields: ["es2020", "default", "module", "main"],
|
|
293
|
-
conditionNames: ["es2020", "..."]
|
|
294
|
-
},
|
|
295
|
-
resolveLoader: {
|
|
296
|
-
symlinks: true
|
|
297
|
-
},
|
|
298
|
-
context: this._projRootPath,
|
|
299
|
-
entry: entries,
|
|
300
|
-
output: {
|
|
301
|
-
uniqueName: pkgKey,
|
|
302
|
-
hashFunction: "xxhash64",
|
|
303
|
-
clean: true,
|
|
304
|
-
path: this._parsedTsconfig.options.outDir,
|
|
305
|
-
filename: "[name].js",
|
|
306
|
-
chunkFilename: "[name].js",
|
|
307
|
-
// filename: "[name].mjs",
|
|
308
|
-
// chunkFilename: "[name].mjs",
|
|
309
|
-
assetModuleFilename: "res/[name][ext][query]",
|
|
310
|
-
libraryTarget: "commonjs2"
|
|
311
|
-
// library: {
|
|
312
|
-
// type: "module"
|
|
313
|
-
// },
|
|
314
|
-
// module: true
|
|
315
|
-
},
|
|
316
|
-
/*experiments: {
|
|
317
|
-
outputModule: true
|
|
318
|
-
},*/
|
|
319
|
-
watch: false,
|
|
320
|
-
watchOptions: { poll: undefined, ignored: undefined },
|
|
321
|
-
performance: { hints: false },
|
|
322
|
-
infrastructureLogging: { level: "error" },
|
|
323
|
-
stats: "errors-warnings",
|
|
324
|
-
externals: extModules.toObject((item) => item.name, (item) => "commonjs2 " + item.name),
|
|
325
|
-
// externals: extModules.toObject((item) => item.name, (item) => item.exists ? "commonjs2 " + item.name : `var {name: '${item.name}'}`),
|
|
326
|
-
// externals: extModules.toObject((item) => item.name, (item) => "node-commonjs " + item.name),
|
|
327
|
-
cache: {
|
|
328
|
-
type: "filesystem",
|
|
329
|
-
profile: watch ? undefined : false,
|
|
330
|
-
cacheDirectory: this._cacheBasePath,
|
|
331
|
-
maxMemoryGenerations: 1,
|
|
332
|
-
name: "webpack"
|
|
333
|
-
},
|
|
334
|
-
snapshot: {
|
|
335
|
-
immutablePaths: internalModuleCachePaths,
|
|
336
|
-
managedPaths: internalModuleCachePaths
|
|
337
|
-
},
|
|
338
|
-
node: false,
|
|
339
|
-
optimization: {
|
|
340
|
-
minimizer: watch ? [] : [
|
|
341
|
-
new TerserPlugin({
|
|
342
|
-
extractComments: false,
|
|
343
|
-
terserOptions: {
|
|
344
|
-
compress: true,
|
|
345
|
-
ecma: 2020,
|
|
346
|
-
sourceMap: false,
|
|
347
|
-
keep_classnames: true,
|
|
348
|
-
keep_fnames: true,
|
|
349
|
-
ie8: false,
|
|
350
|
-
safari10: false,
|
|
351
|
-
// module: true,
|
|
352
|
-
format: {
|
|
353
|
-
comments: false
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
})
|
|
357
|
-
],
|
|
358
|
-
moduleIds: "deterministic",
|
|
359
|
-
chunkIds: watch ? "named" : "deterministic",
|
|
360
|
-
emitOnErrors: watch
|
|
361
|
-
},
|
|
362
|
-
module: {
|
|
363
|
-
strictExportPresence: true,
|
|
364
|
-
parser: {
|
|
365
|
-
javascript: {
|
|
366
|
-
importMeta: false
|
|
367
|
-
}
|
|
368
|
-
},
|
|
369
|
-
rules: [
|
|
370
|
-
{
|
|
371
|
-
test: /\.[cm]?[tj]sx?$/,
|
|
372
|
-
resolve: {
|
|
373
|
-
fullySpecified: false
|
|
374
|
-
}
|
|
375
|
-
},
|
|
376
|
-
...watch ? [
|
|
377
|
-
{
|
|
378
|
-
test: /\.[cm]?jsx?$/,
|
|
379
|
-
enforce: "pre" as const,
|
|
380
|
-
loader: fileURLToPath(await import.meta.resolve!("source-map-loader")),
|
|
381
|
-
options: {
|
|
382
|
-
filterSourceMappingUrl: (mapUri: string, resourcePath: string) => {
|
|
383
|
-
const projRegex = new RegExp(`node_modules[\\\\/]@${projName}[\\\\/]`);
|
|
384
|
-
return !resourcePath.includes("node_modules")
|
|
385
|
-
|| (/node_modules[\\/]@simplysm[\\/]/).test(resourcePath)
|
|
386
|
-
|| projRegex.test(resourcePath);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
] : [],
|
|
391
|
-
{
|
|
392
|
-
test: /\.[cm]?tsx?$/,
|
|
393
|
-
exclude: /node_modules/,
|
|
394
|
-
loader: fileURLToPath(await import.meta.resolve!("ts-loader")),
|
|
395
|
-
options: {
|
|
396
|
-
configFile: this._tsconfigFilePath,
|
|
397
|
-
errorFormatter: (msg: ErrorInfo) => {
|
|
398
|
-
return SdCliBuildResultUtil.getMessage({
|
|
399
|
-
filePath: msg.file,
|
|
400
|
-
line: msg.line,
|
|
401
|
-
char: msg.character,
|
|
402
|
-
code: "TS" + msg.code.toString(),
|
|
403
|
-
severity: msg.severity,
|
|
404
|
-
message: msg.content
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
},
|
|
409
|
-
{
|
|
410
|
-
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico|otf|csv|xlsx?|pptx?|docx?|zip|pfx|pkl)$/,
|
|
411
|
-
type: "asset/resource"
|
|
412
|
-
}
|
|
413
|
-
]
|
|
414
|
-
},
|
|
415
|
-
plugins: [
|
|
416
|
-
...watch ? [] : [
|
|
417
|
-
new LicenseWebpackPlugin({
|
|
418
|
-
stats: { warnings: false, errors: false },
|
|
419
|
-
perChunkOutput: false,
|
|
420
|
-
outputFilename: "3rd_party_licenses.txt",
|
|
421
|
-
skipChildCompilers: true
|
|
422
|
-
}) as any
|
|
423
|
-
],
|
|
424
|
-
new CopyWebpackPlugin({
|
|
425
|
-
patterns: ["assets/"].map((item) => ({
|
|
426
|
-
context: this._rootPath,
|
|
427
|
-
to: item,
|
|
428
|
-
from: `src/${item}`,
|
|
429
|
-
noErrorOnMissing: true,
|
|
430
|
-
force: true,
|
|
431
|
-
globOptions: {
|
|
432
|
-
dot: true,
|
|
433
|
-
followSymbolicLinks: false,
|
|
434
|
-
ignore: [
|
|
435
|
-
".gitkeep",
|
|
436
|
-
"**/.DS_Store",
|
|
437
|
-
"**/Thumbs.db"
|
|
438
|
-
].map((i) => PathUtil.posix(this._rootPath, i))
|
|
439
|
-
},
|
|
440
|
-
priority: 0
|
|
441
|
-
}))
|
|
442
|
-
}),
|
|
443
|
-
new webpack.EnvironmentPlugin({
|
|
444
|
-
SD_VERSION: this._getNpmConfig(this._rootPath)!.version,
|
|
445
|
-
...this._config.env
|
|
446
|
-
}),
|
|
447
|
-
new ESLintWebpackPlugin({
|
|
448
|
-
context: this._rootPath,
|
|
449
|
-
eslintPath: path.resolve(this._projRootPath, "node_modules", "eslint"),
|
|
450
|
-
exclude: ["node_modules"],
|
|
451
|
-
extensions: ["ts", "js", "mjs", "cjs"],
|
|
452
|
-
fix: false,
|
|
453
|
-
threads: false,
|
|
454
|
-
lintDirtyModulesOnly: watch,
|
|
455
|
-
formatter: (results: LintResult[]) => {
|
|
456
|
-
const resultMessages: string[] = [];
|
|
457
|
-
for (const result of results) {
|
|
458
|
-
for (const msg of result.messages) {
|
|
459
|
-
const severity = msg.severity === 1 ? "warning" : msg.severity === 2 ? "error" : undefined;
|
|
460
|
-
if (severity === undefined) continue;
|
|
461
|
-
|
|
462
|
-
resultMessages.push(SdCliBuildResultUtil.getMessage({
|
|
463
|
-
filePath: result.filePath,
|
|
464
|
-
line: msg.line,
|
|
465
|
-
char: msg.column,
|
|
466
|
-
code: msg.ruleId?.toString(),
|
|
467
|
-
severity,
|
|
468
|
-
message: msg.message
|
|
469
|
-
}));
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
return resultMessages.join(os.EOL);
|
|
473
|
-
}
|
|
474
|
-
}),
|
|
475
|
-
new webpack.ProgressPlugin({
|
|
476
|
-
handler: (per: number, msg: string, ...args: string[]) => {
|
|
477
|
-
const phaseText = msg ? ` - phase: ${msg}` : "";
|
|
478
|
-
const argsText = args.length > 0 ? ` - args: [${args.join(", ")}]` : "";
|
|
479
|
-
const progressMessage = `Webpack 빌드 수행중...(${Math.round(per * 100)}%)${phaseText}${argsText}`;
|
|
480
|
-
if (progressMessage !== prevProgressMessage) {
|
|
481
|
-
prevProgressMessage = progressMessage;
|
|
482
|
-
this._logger.debug(progressMessage);
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
})
|
|
486
|
-
]
|
|
487
|
-
};
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
private _getExternalModules(): { name: string; exists: boolean }[] {
|
|
491
|
-
const loadedModuleNames: string[] = [];
|
|
492
|
-
const results: { name: string; exists: boolean }[] = [];
|
|
493
|
-
|
|
494
|
-
const fn = (currPath: string): void => {
|
|
495
|
-
const npmConfig = this._getNpmConfig(currPath);
|
|
496
|
-
if (!npmConfig) return;
|
|
497
|
-
|
|
498
|
-
const deps = SdCliNpmConfigUtil.getDependencies(npmConfig);
|
|
499
|
-
for (const moduleName of deps.defaults) {
|
|
500
|
-
if (loadedModuleNames.includes(moduleName)) continue;
|
|
501
|
-
loadedModuleNames.push(moduleName);
|
|
502
|
-
|
|
503
|
-
const modulePath = FsUtil.findAllParentChildDirPaths("node_modules/" + moduleName, currPath, this._projRootPath).first();
|
|
504
|
-
if (StringUtil.isNullOrEmpty(modulePath)) {
|
|
505
|
-
continue;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
if (FsUtil.glob(path.resolve(modulePath, "**/binding.gyp")).length > 0) {
|
|
509
|
-
results.push({ name: moduleName, exists: true });
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
if (this._config.externalNodeModules?.includes(moduleName)) {
|
|
513
|
-
results.push({ name: moduleName, exists: true });
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
fn(modulePath);
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
for (const optModuleName of deps.optionals) {
|
|
520
|
-
if (loadedModuleNames.includes(optModuleName)) continue;
|
|
521
|
-
loadedModuleNames.push(optModuleName);
|
|
522
|
-
|
|
523
|
-
const optModulePath = FsUtil.findAllParentChildDirPaths("node_modules/" + optModuleName, currPath, this._projRootPath).first();
|
|
524
|
-
if (StringUtil.isNullOrEmpty(optModulePath)) {
|
|
525
|
-
results.push({ name: optModuleName, exists: false });
|
|
526
|
-
continue;
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
if (FsUtil.glob(path.resolve(optModulePath, "**/binding.gyp")).length > 0) {
|
|
530
|
-
results.push({ name: optModuleName, exists: true });
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
if (this._config.externalNodeModules?.includes(optModuleName)) {
|
|
534
|
-
results.push({ name: optModuleName, exists: true });
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
fn(optModulePath);
|
|
538
|
-
}
|
|
539
|
-
};
|
|
540
|
-
|
|
541
|
-
fn(this._rootPath);
|
|
542
|
-
|
|
543
|
-
return results;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
private _getNpmConfig(pkgPath: string): INpmConfig | undefined {
|
|
547
|
-
if (!this._npmConfigMap.has(pkgPath)) {
|
|
548
|
-
this._npmConfigMap.set(pkgPath, FsUtil.readJson(path.resolve(pkgPath, "package.json")));
|
|
549
|
-
}
|
|
550
|
-
return this._npmConfigMap.get(pkgPath);
|
|
551
|
-
}
|
|
552
|
-
}
|