@simplysm/sd-cli 10.0.4 → 10.0.21
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 +1 -1
- package/dist/SdLinter.d.ts +5 -0
- package/dist/SdLinter.js.map +1 -0
- package/dist/SdLinter.mjs +37 -0
- package/dist/SdTsIncrementalBuilder.d.ts +16 -0
- package/dist/SdTsIncrementalBuilder.js.map +1 -0
- package/dist/SdTsIncrementalBuilder.mjs +54 -0
- package/dist/build-cluster.js.map +1 -1
- package/dist/build-cluster.mjs +124 -0
- package/dist/builders/SdCliClientBuilder.d.ts +13 -0
- package/dist/builders/SdCliClientBuilder.js.map +1 -0
- package/dist/builders/SdCliClientBuilder.mjs +167 -0
- package/dist/builders/SdCliJsLibLinter.d.ts +3 -7
- package/dist/builders/SdCliJsLibLinter.js.map +1 -1
- package/dist/builders/{SdCliJsLibLinter.js → SdCliJsLibLinter.mjs} +8 -17
- package/dist/builders/SdCliServerBuilder.d.ts +14 -0
- package/dist/builders/SdCliServerBuilder.js.map +1 -0
- package/dist/builders/SdCliServerBuilder.mjs +171 -0
- package/dist/builders/SdCliTsLibBuilder.d.ts +3 -10
- package/dist/builders/SdCliTsLibBuilder.js.map +1 -1
- package/dist/builders/SdCliTsLibBuilder.mjs +75 -0
- package/dist/commons.d.ts +27 -2
- package/dist/entry/SdCliProject.d.ts +1 -0
- package/dist/entry/SdCliProject.js.map +1 -1
- package/dist/entry/{SdCliProject.js → SdCliProject.mjs} +94 -10
- package/dist/sd-cli.js.map +1 -1
- package/dist/{sd-cli.js → sd-cli.mjs} +1 -0
- package/dist/sd-core-common/src/decorators/NotifyPropertyChange.d.ts +20 -0
- package/dist/sd-core-common/src/decorators/NotifyPropertyChange.js.map +1 -0
- package/dist/sd-core-common/src/decorators/NotifyPropertyChange.mjs +12 -0
- package/dist/sd-core-common/src/decorators/PropertyGetSetDecoratorBase.d.ts +43 -0
- package/dist/sd-core-common/src/decorators/PropertyGetSetDecoratorBase.js.map +1 -0
- package/dist/sd-core-common/src/decorators/PropertyGetSetDecoratorBase.mjs +54 -0
- package/dist/sd-core-common/src/decorators/PropertyValidate.d.ts +16 -0
- package/dist/sd-core-common/src/decorators/PropertyValidate.js.map +1 -0
- package/dist/sd-core-common/src/decorators/PropertyValidate.mjs +26 -0
- package/dist/sd-core-common/src/decorators/decorator-return-types.d.ts +14 -0
- package/dist/sd-core-common/src/decorators/decorator-return-types.js.map +1 -0
- package/dist/sd-core-common/src/decorators/decorator-return-types.mjs +2 -0
- package/dist/sd-core-common/src/errors/ArgumentError.d.ts +10 -0
- package/dist/sd-core-common/src/errors/ArgumentError.js.map +1 -0
- package/dist/sd-core-common/src/errors/ArgumentError.mjs +13 -0
- package/dist/sd-core-common/src/errors/NeverEntryError.d.ts +10 -0
- package/dist/sd-core-common/src/errors/NeverEntryError.js.map +1 -0
- package/dist/sd-core-common/src/errors/NeverEntryError.mjs +13 -0
- package/dist/sd-core-common/src/errors/NotImplementError.d.ts +10 -0
- package/dist/sd-core-common/src/errors/NotImplementError.js.map +1 -0
- package/dist/sd-core-common/src/errors/NotImplementError.mjs +13 -0
- package/dist/sd-core-common/src/errors/SdError.d.ts +23 -0
- package/dist/sd-core-common/src/errors/SdError.js.map +1 -0
- package/dist/sd-core-common/src/errors/SdError.mjs +40 -0
- package/dist/sd-core-common/src/errors/TimeoutError.d.ts +11 -0
- package/dist/sd-core-common/src/errors/TimeoutError.js.map +1 -0
- package/dist/sd-core-common/src/errors/TimeoutError.mjs +16 -0
- package/dist/sd-core-common/src/extensions/ArrayExtension.d.ts +147 -0
- package/dist/sd-core-common/src/extensions/ArrayExtension.js.map +1 -0
- package/dist/sd-core-common/src/extensions/ArrayExtension.mjs +448 -0
- package/dist/sd-core-common/src/extensions/MapExtension.d.ts +4 -0
- package/dist/sd-core-common/src/extensions/MapExtension.js.map +1 -0
- package/dist/sd-core-common/src/extensions/MapExtension.mjs +15 -0
- package/dist/sd-core-common/src/extensions/SetExtension.d.ts +3 -0
- package/dist/sd-core-common/src/extensions/SetExtension.js.map +1 -0
- package/dist/sd-core-common/src/extensions/SetExtension.mjs +10 -0
- package/dist/sd-core-common/src/index.d.ts +32 -0
- package/dist/sd-core-common/src/index.js.map +1 -0
- package/dist/sd-core-common/src/index.mjs +33 -0
- package/dist/sd-core-common/src/types/DateOnly.d.ts +135 -0
- package/dist/sd-core-common/src/types/DateOnly.js.map +1 -0
- package/dist/sd-core-common/src/types/DateOnly.mjs +220 -0
- package/dist/sd-core-common/src/types/DateTime.d.ts +42 -0
- package/dist/sd-core-common/src/types/DateTime.js.map +1 -0
- package/dist/sd-core-common/src/types/DateTime.mjs +156 -0
- package/dist/sd-core-common/src/types/DeepPartial.d.ts +3 -0
- package/dist/sd-core-common/src/types/DeepPartial.js.map +1 -0
- package/dist/sd-core-common/src/types/DeepPartial.mjs +2 -0
- package/dist/sd-core-common/src/types/ObjectSet.d.ts +4 -0
- package/dist/sd-core-common/src/types/ObjectSet.js.map +1 -0
- package/dist/sd-core-common/src/types/ObjectSet.mjs +18 -0
- package/dist/sd-core-common/src/types/Time.d.ts +27 -0
- package/dist/sd-core-common/src/types/Time.js.map +1 -0
- package/dist/sd-core-common/src/types/Time.mjs +108 -0
- package/dist/sd-core-common/src/types/Type.d.ts +7 -0
- package/dist/sd-core-common/src/types/Type.js.map +1 -0
- package/dist/sd-core-common/src/types/Type.mjs +2 -0
- package/dist/sd-core-common/src/types/UnwrappedType.d.ts +1 -0
- package/dist/sd-core-common/src/types/UnwrappedType.js.map +1 -0
- package/dist/sd-core-common/src/types/UnwrappedType.mjs +2 -0
- package/dist/sd-core-common/src/types/Uuid.d.ts +8 -0
- package/dist/sd-core-common/src/types/Uuid.js.map +1 -0
- package/dist/sd-core-common/src/types/Uuid.mjs +26 -0
- package/dist/sd-core-common/src/types/WrappedType.d.ts +1 -0
- package/dist/sd-core-common/src/types/WrappedType.js.map +1 -0
- package/dist/sd-core-common/src/types/WrappedType.mjs +2 -0
- package/dist/sd-core-common/src/utils/DateTimeFormatUtil.d.ts +12 -0
- package/dist/sd-core-common/src/utils/DateTimeFormatUtil.js.map +1 -0
- package/dist/sd-core-common/src/utils/DateTimeFormatUtil.mjs +67 -0
- package/dist/sd-core-common/src/utils/FunctionQueue.d.ts +8 -0
- package/dist/sd-core-common/src/utils/FunctionQueue.js.map +1 -0
- package/dist/sd-core-common/src/utils/FunctionQueue.mjs +46 -0
- package/dist/sd-core-common/src/utils/FunctionUtil.d.ts +6 -0
- package/dist/sd-core-common/src/utils/FunctionUtil.js.map +1 -0
- package/dist/sd-core-common/src/utils/FunctionUtil.mjs +31 -0
- package/dist/sd-core-common/src/utils/JsonConvert.d.ts +8 -0
- package/dist/sd-core-common/src/utils/JsonConvert.js.map +1 -0
- package/dist/sd-core-common/src/utils/JsonConvert.mjs +78 -0
- package/dist/sd-core-common/src/utils/MathUtil.d.ts +3 -0
- package/dist/sd-core-common/src/utils/MathUtil.js.map +1 -0
- package/dist/sd-core-common/src/utils/MathUtil.mjs +6 -0
- package/dist/sd-core-common/src/utils/NumberUtil.d.ts +6 -0
- package/dist/sd-core-common/src/utils/NumberUtil.js.map +1 -0
- package/dist/sd-core-common/src/utils/NumberUtil.mjs +32 -0
- package/dist/sd-core-common/src/utils/ObjectUtil.d.ts +80 -0
- package/dist/sd-core-common/src/utils/ObjectUtil.js.map +1 -0
- package/dist/sd-core-common/src/utils/ObjectUtil.mjs +452 -0
- package/dist/sd-core-common/src/utils/SdSyncEventEmitter.d.ts +6 -0
- package/dist/sd-core-common/src/utils/SdSyncEventEmitter.js.map +1 -0
- package/dist/sd-core-common/src/utils/SdSyncEventEmitter.mjs +27 -0
- package/dist/sd-core-common/src/utils/StringUtil.d.ts +8 -0
- package/dist/sd-core-common/src/utils/StringUtil.js.map +1 -0
- package/dist/sd-core-common/src/utils/StringUtil.mjs +77 -0
- package/dist/sd-core-common/src/utils/Wait.d.ts +4 -0
- package/dist/sd-core-common/src/utils/Wait.js.map +1 -0
- package/dist/sd-core-common/src/utils/Wait.mjs +23 -0
- package/dist/sd-core-node/src/index.d.ts +6 -0
- package/dist/sd-core-node/src/index.js.map +1 -0
- package/dist/sd-core-node/src/index.mjs +7 -0
- package/dist/sd-core-node/src/utils/FsUtil.d.ts +44 -0
- package/dist/sd-core-node/src/utils/FsUtil.js.map +1 -0
- package/dist/sd-core-node/src/utils/FsUtil.mjs +493 -0
- package/dist/sd-core-node/src/utils/Logger.d.ts +91 -0
- package/dist/sd-core-node/src/utils/Logger.js.map +1 -0
- package/dist/sd-core-node/src/utils/Logger.mjs +185 -0
- package/dist/sd-core-node/src/utils/PathUtil.d.ts +6 -0
- package/dist/sd-core-node/src/utils/PathUtil.js.map +1 -0
- package/dist/sd-core-node/src/utils/PathUtil.mjs +24 -0
- package/dist/sd-core-node/src/utils/SdFsWatcher.d.ts +15 -0
- package/dist/sd-core-node/src/utils/SdFsWatcher.js.map +1 -0
- package/dist/sd-core-node/src/utils/SdFsWatcher.mjs +43 -0
- package/dist/sd-core-node/src/utils/SdProcess.d.ts +5 -0
- package/dist/sd-core-node/src/utils/SdProcess.js.map +1 -0
- package/dist/sd-core-node/src/utils/SdProcess.mjs +36 -0
- package/dist/sd-orm-common/src/CaseQueryHelper.d.ts +12 -0
- package/dist/sd-orm-common/src/CaseQueryHelper.js.map +1 -0
- package/dist/sd-orm-common/src/CaseQueryHelper.mjs +19 -0
- package/dist/sd-orm-common/src/CaseWhenQueryHelper.d.ts +12 -0
- package/dist/sd-orm-common/src/CaseWhenQueryHelper.js.map +1 -0
- package/dist/sd-orm-common/src/CaseWhenQueryHelper.mjs +20 -0
- package/dist/sd-orm-common/src/DbContext.d.ts +81 -0
- package/dist/sd-orm-common/src/DbContext.js.map +1 -0
- package/dist/sd-orm-common/src/DbContext.mjs +635 -0
- package/dist/sd-orm-common/src/IDbConnection.d.ts +15 -0
- package/dist/sd-orm-common/src/IDbConnection.js.map +1 -0
- package/dist/sd-orm-common/src/IDbConnection.mjs +2 -0
- package/dist/sd-orm-common/src/IDbContextExecutor.d.ts +17 -0
- package/dist/sd-orm-common/src/IDbContextExecutor.js.map +1 -0
- package/dist/sd-orm-common/src/IDbContextExecutor.mjs +2 -0
- package/dist/sd-orm-common/src/IDbMigration.d.ts +4 -0
- package/dist/sd-orm-common/src/IDbMigration.js.map +1 -0
- package/dist/sd-orm-common/src/IDbMigration.mjs +2 -0
- package/dist/sd-orm-common/src/QueryBuilder.d.ts +48 -0
- package/dist/sd-orm-common/src/QueryBuilder.js.map +1 -0
- package/dist/sd-orm-common/src/QueryBuilder.mjs +1022 -0
- package/dist/sd-orm-common/src/QueryHelper.d.ts +75 -0
- package/dist/sd-orm-common/src/QueryHelper.js.map +1 -0
- package/dist/sd-orm-common/src/QueryHelper.mjs +627 -0
- package/dist/sd-orm-common/src/QueryUnit.d.ts +10 -0
- package/dist/sd-orm-common/src/QueryUnit.js.map +1 -0
- package/dist/sd-orm-common/src/QueryUnit.mjs +16 -0
- package/dist/sd-orm-common/src/Queryable.d.ts +105 -0
- package/dist/sd-orm-common/src/Queryable.js.map +1 -0
- package/dist/sd-orm-common/src/Queryable.mjs +1375 -0
- package/dist/sd-orm-common/src/SdOrmDataType.d.ts +21 -0
- package/dist/sd-orm-common/src/SdOrmDataType.js.map +1 -0
- package/dist/sd-orm-common/src/SdOrmDataType.mjs +2 -0
- package/dist/sd-orm-common/src/commons.d.ts +400 -0
- package/dist/sd-orm-common/src/commons.js.map +1 -0
- package/dist/sd-orm-common/src/commons.mjs +8 -0
- package/dist/sd-orm-common/src/decorators.d.ts +29 -0
- package/dist/sd-orm-common/src/decorators.js.map +1 -0
- package/dist/sd-orm-common/src/decorators.mjs +89 -0
- package/dist/sd-orm-common/src/index.d.ts +17 -0
- package/dist/sd-orm-common/src/index.js.map +1 -0
- package/dist/sd-orm-common/src/index.mjs +18 -0
- package/dist/sd-orm-common/src/models/SystemMigration.d.ts +3 -0
- package/dist/sd-orm-common/src/models/SystemMigration.js.map +1 -0
- package/dist/sd-orm-common/src/models/SystemMigration.mjs +13 -0
- package/dist/sd-orm-common/src/utils/DbDefinitionUtil.d.ts +14 -0
- package/dist/sd-orm-common/src/utils/DbDefinitionUtil.js.map +1 -0
- package/dist/sd-orm-common/src/utils/DbDefinitionUtil.mjs +66 -0
- package/dist/sd-orm-common/src/utils/SdOrmUtil.d.ts +8 -0
- package/dist/sd-orm-common/src/utils/SdOrmUtil.js.map +1 -0
- package/dist/sd-orm-common/src/utils/SdOrmUtil.mjs +248 -0
- package/dist/sd-orm-node/src/DbConnectionFactory.d.ts +4 -0
- package/dist/sd-orm-node/src/DbConnectionFactory.js.map +1 -0
- package/dist/sd-orm-node/src/DbConnectionFactory.mjs +17 -0
- package/dist/sd-orm-node/src/NodeDbContextExecutor.d.ts +19 -0
- package/dist/sd-orm-node/src/NodeDbContextExecutor.js.map +1 -0
- package/dist/sd-orm-node/src/NodeDbContextExecutor.mjs +71 -0
- package/dist/sd-orm-node/src/SdOrm.d.ts +10 -0
- package/dist/sd-orm-node/src/SdOrm.js.map +1 -0
- package/dist/sd-orm-node/src/SdOrm.mjs +25 -0
- package/dist/sd-orm-node/src/index.d.ts +4 -0
- package/dist/sd-orm-node/src/index.js.map +1 -0
- package/dist/sd-orm-node/src/index.mjs +5 -0
- package/dist/sd-orm-node-mssql/src/MssqlDbConnection.d.ts +25 -0
- package/dist/sd-orm-node-mssql/src/MssqlDbConnection.js.map +1 -0
- package/dist/sd-orm-node-mssql/src/MssqlDbConnection.mjs +321 -0
- package/dist/sd-orm-node-mssql/src/index.d.ts +2 -0
- package/dist/sd-orm-node-mssql/src/index.js.map +1 -0
- package/dist/sd-orm-node-mssql/src/index.mjs +3 -0
- package/dist/sd-orm-node-mysql/src/MysqlDbConnection.d.ts +22 -0
- package/dist/sd-orm-node-mysql/src/MysqlDbConnection.js.map +1 -0
- package/dist/sd-orm-node-mysql/src/MysqlDbConnection.mjs +200 -0
- package/dist/sd-orm-node-mysql/src/index.d.ts +2 -0
- package/dist/sd-orm-node-mysql/src/index.js.map +1 -0
- package/dist/sd-orm-node-mysql/src/index.mjs +3 -0
- package/dist/sd-orm-node-sqlite/src/SqliteDbConnection.d.ts +22 -0
- package/dist/sd-orm-node-sqlite/src/SqliteDbConnection.js.map +1 -0
- package/dist/sd-orm-node-sqlite/src/SqliteDbConnection.mjs +172 -0
- package/dist/sd-orm-node-sqlite/src/index.d.ts +2 -0
- package/dist/sd-orm-node-sqlite/src/index.js.map +1 -0
- package/dist/sd-orm-node-sqlite/src/index.mjs +3 -0
- package/dist/sd-service-common/src/commons-orm.d.ts +4 -0
- package/dist/sd-service-common/src/commons-orm.js.map +1 -0
- package/dist/sd-service-common/src/commons-orm.mjs +2 -0
- package/dist/sd-service-common/src/commons-smtp.d.ts +29 -0
- package/dist/sd-service-common/src/commons-smtp.js.map +1 -0
- package/dist/sd-service-common/src/commons-smtp.mjs +2 -0
- package/dist/sd-service-common/src/commons.d.ts +57 -0
- package/dist/sd-service-common/src/commons.js.map +1 -0
- package/dist/sd-service-common/src/commons.mjs +3 -0
- package/dist/sd-service-common/src/index.d.ts +3 -0
- package/dist/sd-service-common/src/index.js.map +1 -0
- package/dist/sd-service-common/src/index.mjs +4 -0
- package/dist/sd-service-server/src/ApiServiceError.d.ts +12 -0
- package/dist/sd-service-server/src/ApiServiceError.js.map +1 -0
- package/dist/sd-service-server/src/ApiServiceError.mjs +15 -0
- package/dist/sd-service-server/src/SdServiceServer.d.ts +39 -0
- package/dist/sd-service-server/src/SdServiceServer.js.map +1 -0
- package/dist/sd-service-server/src/SdServiceServer.mjs +513 -0
- package/dist/sd-service-server/src/commons.d.ts +23 -0
- package/dist/sd-service-server/src/commons.js.map +1 -0
- package/dist/sd-service-server/src/commons.mjs +3 -0
- package/dist/sd-service-server/src/index.d.ts +8 -0
- package/dist/sd-service-server/src/index.js.map +1 -0
- package/dist/sd-service-server/src/index.mjs +9 -0
- package/dist/sd-service-server/src/services/SdAutoUpdateService.d.ts +4 -0
- package/dist/sd-service-server/src/services/SdAutoUpdateService.js.map +1 -0
- package/dist/sd-service-server/src/services/SdAutoUpdateService.mjs +20 -0
- package/dist/sd-service-server/src/services/SdCryptoService.d.ts +7 -0
- package/dist/sd-service-server/src/services/SdCryptoService.js.map +1 -0
- package/dist/sd-service-server/src/services/SdCryptoService.mjs +39 -0
- package/dist/sd-service-server/src/services/SdOrmService.d.ts +22 -0
- package/dist/sd-service-server/src/services/SdOrmService.js.map +1 -0
- package/dist/sd-service-server/src/services/SdOrmService.mjs +115 -0
- package/dist/sd-service-server/src/services/SdSmtpClientService.d.ts +6 -0
- package/dist/sd-service-server/src/services/SdSmtpClientService.js.map +1 -0
- package/dist/sd-service-server/src/services/SdSmtpClientService.mjs +44 -0
- package/dist/sd-service-server/src/utils/SdServiceServerConfigUtil.d.ts +4 -0
- package/dist/sd-service-server/src/utils/SdServiceServerConfigUtil.js.map +1 -0
- package/dist/sd-service-server/src/utils/SdServiceServerConfigUtil.mjs +36 -0
- package/dist/server-worker.d.ts +1 -0
- package/dist/server-worker.js.map +1 -0
- package/dist/server-worker.mjs +36 -0
- package/package.json +11 -4
- package/src/SdLinter.ts +41 -0
- package/src/SdTsIncrementalBuilder.ts +75 -0
- package/src/build-cluster.ts +69 -18
- package/src/builders/SdCliClientBuilder.ts +189 -0
- package/src/builders/SdCliJsLibLinter.ts +11 -23
- package/src/builders/SdCliServerBuilder.ts +191 -0
- package/src/builders/SdCliTsLibBuilder.ts +33 -202
- package/src/commons.ts +32 -2
- package/src/entry/SdCliProject.ts +133 -17
- package/src/sd-cli.ts +1 -0
- package/src/server-worker.ts +45 -0
- package/tsconfig.json +1 -10
- package/dist/build-cluster.js +0 -75
- package/dist/builders/SdCliTsLibBuilder.js +0 -205
- /package/dist/{commons.js → commons.mjs} +0 -0
- /package/dist/utils/{SdCliBuildResultUtil.js → SdCliBuildResultUtil.mjs} +0 -0
- /package/dist/utils/{SdCliConfigUtil.js → SdCliConfigUtil.mjs} +0 -0
package/dist/build-cluster.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import cluster from "node:cluster";
|
|
2
|
-
import { SdCliTsLibBuilder } from "./builders/SdCliTsLibBuilder";
|
|
3
|
-
import { FsUtil, Logger, LoggerSeverity } from "@simplysm/sd-core-node";
|
|
4
|
-
import path from "path";
|
|
5
|
-
import { SdCliJsLibLinter } from "./builders/SdCliJsLibLinter";
|
|
6
|
-
if (Boolean(process.env["SD_DEBUG"])) {
|
|
7
|
-
Logger.setConfig({
|
|
8
|
-
console: {
|
|
9
|
-
level: LoggerSeverity.debug
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
Logger.setConfig({
|
|
15
|
-
dot: true
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
const logger = Logger.get(["simplysm", "sd-cli", "build-cluster"]);
|
|
19
|
-
if (cluster.isPrimary) {
|
|
20
|
-
logger.debug(`메인 프로세스 ${process.pid} 시작`);
|
|
21
|
-
cluster.on("exit", (worker, code) => {
|
|
22
|
-
logger.debug(`워커 프로세스 ${worker.process.pid} 종료 (code: ${code})`);
|
|
23
|
-
});
|
|
24
|
-
cluster.on("message", (worker, message) => {
|
|
25
|
-
process.send(message);
|
|
26
|
-
});
|
|
27
|
-
process.on("message", (message) => {
|
|
28
|
-
cluster.fork({
|
|
29
|
-
"SD_CLUSTER_MESSAGE": JSON.stringify(message)
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
process.send("ready");
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
const message = JSON.parse(process.env["SD_CLUSTER_MESSAGE"]);
|
|
36
|
-
if (message.cmd === "watch") {
|
|
37
|
-
// javascript
|
|
38
|
-
if (!FsUtil.exists(path.resolve(message.pkgPath, "tsconfig.json"))) {
|
|
39
|
-
await new SdCliJsLibLinter(message.pkgPath)
|
|
40
|
-
.on("change", () => {
|
|
41
|
-
process.send({ type: "change", ...message });
|
|
42
|
-
})
|
|
43
|
-
.on("complete", (result) => {
|
|
44
|
-
process.send({ type: "complete", result, ...message });
|
|
45
|
-
})
|
|
46
|
-
.watchAsync();
|
|
47
|
-
process.send({ type: "ready", ...message });
|
|
48
|
-
}
|
|
49
|
-
// typescript
|
|
50
|
-
else {
|
|
51
|
-
await new SdCliTsLibBuilder(message.pkgPath)
|
|
52
|
-
.on("change", () => {
|
|
53
|
-
process.send({ type: "change", ...message });
|
|
54
|
-
})
|
|
55
|
-
.on("complete", (result) => {
|
|
56
|
-
process.send({ type: "complete", result, ...message });
|
|
57
|
-
})
|
|
58
|
-
.watchAsync();
|
|
59
|
-
process.send({ type: "ready", ...message });
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
else { // build
|
|
63
|
-
// javascript
|
|
64
|
-
if (!FsUtil.exists(path.resolve(message.pkgPath, "tsconfig.json"))) {
|
|
65
|
-
const result = await new SdCliJsLibLinter(message.pkgPath).buildAsync();
|
|
66
|
-
process.send({ type: "complete", result, ...message });
|
|
67
|
-
}
|
|
68
|
-
// typescript
|
|
69
|
-
else {
|
|
70
|
-
const result = await new SdCliTsLibBuilder(message.pkgPath).buildAsync();
|
|
71
|
-
process.send({ type: "complete", result, ...message });
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=build-cluster.js.map
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { FsUtil, Logger, PathUtil, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
3
|
-
import path from "path";
|
|
4
|
-
import { SdCliBuildResultUtil } from "../utils/SdCliBuildResultUtil";
|
|
5
|
-
import { EventEmitter } from "events";
|
|
6
|
-
import { ESLint } from "eslint";
|
|
7
|
-
import { FunctionQueue } from "@simplysm/sd-core-common";
|
|
8
|
-
export class SdCliTsLibBuilder extends EventEmitter {
|
|
9
|
-
constructor(_pkgPath) {
|
|
10
|
-
super();
|
|
11
|
-
this._pkgPath = _pkgPath;
|
|
12
|
-
this._logger = Logger.get(["simplysm", "sd-cli", "SdCliTsLibBuilder"]);
|
|
13
|
-
this._writeFileCache = new Map();
|
|
14
|
-
this._pkgName = path.basename(_pkgPath);
|
|
15
|
-
}
|
|
16
|
-
on(event, listener) {
|
|
17
|
-
super.on(event, listener);
|
|
18
|
-
return this;
|
|
19
|
-
}
|
|
20
|
-
async buildAsync() {
|
|
21
|
-
this._debug("빌드 준비...");
|
|
22
|
-
const srcGlobPath = path.resolve(this._pkgPath, "src/**/*.ts");
|
|
23
|
-
const parsedTsConfig = ts.parseJsonConfigFileContent(await FsUtil.readJsonAsync(path.resolve(this._pkgPath, "tsconfig.json")), ts.sys, this._pkgPath, {
|
|
24
|
-
outDir: path.resolve(this._pkgPath, "dist"),
|
|
25
|
-
incremental: true,
|
|
26
|
-
tsBuildInfoFile: path.resolve(this._pkgPath, ".cache/tsbuildinfo.json"),
|
|
27
|
-
});
|
|
28
|
-
const host = ts.createIncrementalCompilerHost(parsedTsConfig.options, ts.sys);
|
|
29
|
-
this._debug("dist 초기화...");
|
|
30
|
-
await FsUtil.removeAsync(path.resolve(this._pkgPath, "dist"));
|
|
31
|
-
this._debug("빌드...");
|
|
32
|
-
const srcFilePaths = await FsUtil.globAsync(srcGlobPath);
|
|
33
|
-
const emitResult = this._emitIncrementalProgram({
|
|
34
|
-
rootNames: srcFilePaths,
|
|
35
|
-
options: parsedTsConfig.options,
|
|
36
|
-
host: host
|
|
37
|
-
});
|
|
38
|
-
this._debug("LINT...");
|
|
39
|
-
const lintResults = await this._lintAsync(emitResult.program.getProgram(), srcFilePaths);
|
|
40
|
-
this._debug(`빌드 완료`);
|
|
41
|
-
return [...emitResult.buildResults, ...lintResults];
|
|
42
|
-
}
|
|
43
|
-
async watchAsync() {
|
|
44
|
-
this.emit("change");
|
|
45
|
-
this._debug("빌드 준비...");
|
|
46
|
-
const srcGlobPath = path.resolve(this._pkgPath, "src/**/*.ts");
|
|
47
|
-
const parsedTsConfig = ts.parseJsonConfigFileContent(await FsUtil.readJsonAsync(path.resolve(this._pkgPath, "tsconfig.json")), ts.sys, this._pkgPath, {
|
|
48
|
-
outDir: path.resolve(this._pkgPath, "dist"),
|
|
49
|
-
incremental: true,
|
|
50
|
-
tsBuildInfoFile: path.resolve(this._pkgPath, ".cache/tsbuildinfo.json"),
|
|
51
|
-
});
|
|
52
|
-
const host = ts.createIncrementalCompilerHost(parsedTsConfig.options, ts.sys);
|
|
53
|
-
this._debug("dist 초기화...");
|
|
54
|
-
await FsUtil.removeAsync(path.resolve(this._pkgPath, "dist"));
|
|
55
|
-
this._debug("빌드...");
|
|
56
|
-
const srcFilePaths = await FsUtil.globAsync(srcGlobPath);
|
|
57
|
-
const emitResult = this._emitIncrementalProgram({
|
|
58
|
-
rootNames: srcFilePaths,
|
|
59
|
-
options: parsedTsConfig.options,
|
|
60
|
-
host: host
|
|
61
|
-
});
|
|
62
|
-
this._debug("LINT...");
|
|
63
|
-
const lintResults = await this._lintAsync(emitResult.program.getProgram(), srcFilePaths);
|
|
64
|
-
this._debug(`빌드 완료`);
|
|
65
|
-
this.emit("complete", {
|
|
66
|
-
affectedFilePaths: srcFilePaths,
|
|
67
|
-
buildResults: [...emitResult.buildResults, ...lintResults]
|
|
68
|
-
});
|
|
69
|
-
const fnQ = new FunctionQueue();
|
|
70
|
-
SdFsWatcher
|
|
71
|
-
.watch([
|
|
72
|
-
...emitResult.program.getSourceFiles().map((item) => item.fileName),
|
|
73
|
-
srcGlobPath
|
|
74
|
-
])
|
|
75
|
-
.onChange({
|
|
76
|
-
delay: 100
|
|
77
|
-
}, () => {
|
|
78
|
-
fnQ.runLast(async () => {
|
|
79
|
-
this.emit("change");
|
|
80
|
-
this._debug(`빌드...`);
|
|
81
|
-
const watchSrcFilePaths = await FsUtil.globAsync(srcGlobPath);
|
|
82
|
-
const watchResult = this._emitIncrementalProgram({
|
|
83
|
-
rootNames: await FsUtil.globAsync(srcGlobPath),
|
|
84
|
-
options: parsedTsConfig.options,
|
|
85
|
-
host: host
|
|
86
|
-
});
|
|
87
|
-
const watchAffectedSrcFilePaths = watchResult.affectedFileNames.map((item) => path.resolve(item)).filter((item) => watchSrcFilePaths.includes(item));
|
|
88
|
-
this._debug("LINT...");
|
|
89
|
-
const watchLintResults = await this._lintAsync(watchResult.program.getProgram(), watchAffectedSrcFilePaths);
|
|
90
|
-
this._debug(`빌드 완료`);
|
|
91
|
-
this.emit("complete", {
|
|
92
|
-
affectedFilePaths: watchAffectedSrcFilePaths,
|
|
93
|
-
buildResults: [...watchResult.buildResults, ...watchLintResults]
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
_emitIncrementalProgram(opt) {
|
|
99
|
-
const program = ts.createIncrementalProgram({
|
|
100
|
-
rootNames: opt.rootNames,
|
|
101
|
-
options: opt.options,
|
|
102
|
-
host: opt.host,
|
|
103
|
-
createProgram: ts.createSemanticDiagnosticsBuilderProgram
|
|
104
|
-
});
|
|
105
|
-
const diagnostics = [];
|
|
106
|
-
const affectedFileNames = [];
|
|
107
|
-
diagnostics.push(...program.getOptionsDiagnostics(), ...program.getGlobalDiagnostics());
|
|
108
|
-
while (true) {
|
|
109
|
-
const semanticResult = program.getSemanticDiagnosticsOfNextAffectedFile(undefined, (sourceFile) => {
|
|
110
|
-
return !opt.rootNames.includes(path.resolve(sourceFile.fileName));
|
|
111
|
-
});
|
|
112
|
-
if (!semanticResult)
|
|
113
|
-
break;
|
|
114
|
-
diagnostics.push(...semanticResult.result);
|
|
115
|
-
/*const result = program.emitNextAffectedFile((filePath, data, writeByteOrderMark) => {
|
|
116
|
-
if (this._writeFileCache.get(filePath) !== data) {
|
|
117
|
-
ts.sys.writeFile(filePath, data, writeByteOrderMark);
|
|
118
|
-
}
|
|
119
|
-
this._writeFileCache.set(filePath, data);
|
|
120
|
-
});
|
|
121
|
-
if (!result) break;*/
|
|
122
|
-
if ("fileName" in semanticResult.affected) {
|
|
123
|
-
const emitResult = program.emit(program.getSourceFile(semanticResult.affected.fileName), (filePath, data, writeByteOrderMark) => {
|
|
124
|
-
let realFilePath = filePath;
|
|
125
|
-
if (PathUtil.isChildPath(realFilePath, path.resolve(this._pkgPath, "dist", this._pkgName, "src"))) {
|
|
126
|
-
realFilePath = path.resolve(this._pkgPath, "dist", path.relative(path.resolve(this._pkgPath, "dist", this._pkgName, "src"), realFilePath));
|
|
127
|
-
}
|
|
128
|
-
if (this._writeFileCache.get(realFilePath) !== data) {
|
|
129
|
-
ts.sys.writeFile(realFilePath, data, writeByteOrderMark);
|
|
130
|
-
}
|
|
131
|
-
this._writeFileCache.set(realFilePath, data);
|
|
132
|
-
});
|
|
133
|
-
diagnostics.push(...emitResult.diagnostics);
|
|
134
|
-
affectedFileNames.push(semanticResult.affected.fileName);
|
|
135
|
-
diagnostics.push(...program.getSyntacticDiagnostics(semanticResult.affected));
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
const buildResults = diagnostics.map((item) => SdCliBuildResultUtil.convertFromTsDiag(item));
|
|
139
|
-
return {
|
|
140
|
-
program,
|
|
141
|
-
buildResults,
|
|
142
|
-
affectedFileNames
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
/*private readonly _linter = new ESLint({
|
|
146
|
-
overrideConfig: {
|
|
147
|
-
overrides: [
|
|
148
|
-
{
|
|
149
|
-
files: ["*.ts"],
|
|
150
|
-
parserOptions: {
|
|
151
|
-
tsconfigRootDir: this._pkgPath,
|
|
152
|
-
project: "tsconfig.json"
|
|
153
|
-
},
|
|
154
|
-
settings: {
|
|
155
|
-
"import/resolver": {
|
|
156
|
-
"typescript": {
|
|
157
|
-
project: path.resolve(this._pkgPath, "tsconfig.json")
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
]
|
|
163
|
-
}
|
|
164
|
-
});*/
|
|
165
|
-
async _lintAsync(program, srcFilePaths) {
|
|
166
|
-
const linter = new ESLint({
|
|
167
|
-
overrideConfig: {
|
|
168
|
-
overrides: [
|
|
169
|
-
{
|
|
170
|
-
files: ["*.ts"],
|
|
171
|
-
parserOptions: {
|
|
172
|
-
programs: [program],
|
|
173
|
-
tsconfigRootDir: null,
|
|
174
|
-
project: null,
|
|
175
|
-
// tsconfigRootDir: this._pkgPath,
|
|
176
|
-
// project: "tsconfig.json"
|
|
177
|
-
},
|
|
178
|
-
settings: {
|
|
179
|
-
"import/resolver": {
|
|
180
|
-
"typescript": {
|
|
181
|
-
programs: [program],
|
|
182
|
-
project: null,
|
|
183
|
-
// project: path.resolve(this._pkgPath, "tsconfig.json"),
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
]
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
const lintResults = await linter.lintFiles(srcFilePaths);
|
|
192
|
-
return lintResults.mapMany((lintResult) => lintResult.messages.map((msg) => ({
|
|
193
|
-
filePath: lintResult.filePath,
|
|
194
|
-
line: msg.line,
|
|
195
|
-
char: msg.column,
|
|
196
|
-
code: msg.ruleId ?? undefined,
|
|
197
|
-
severity: msg.severity === 1 ? "warning" : "error",
|
|
198
|
-
message: msg.message
|
|
199
|
-
})));
|
|
200
|
-
}
|
|
201
|
-
_debug(msg) {
|
|
202
|
-
this._logger.debug(`[${this._pkgName}] ${msg}`);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
//# sourceMappingURL=SdCliTsLibBuilder.js.map
|
|
File without changes
|
|
File without changes
|
|
File without changes
|