@simplysm/sd-cli 7.3.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 +18 -0
- 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 -0
- 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 +14 -0
- package/dist/builders/SdCliJsLibLinter.js.map +1 -0
- package/dist/builders/SdCliJsLibLinter.mjs +60 -0
- 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 +13 -0
- package/dist/builders/SdCliTsLibBuilder.js.map +1 -0
- package/dist/builders/SdCliTsLibBuilder.mjs +75 -0
- package/dist/commons.d.ts +20 -110
- package/dist/commons.js.map +1 -0
- package/dist/commons.mjs +1 -1
- package/dist/entry/SdCliProject.d.ts +29 -0
- package/dist/entry/SdCliProject.js.map +1 -0
- package/dist/entry/SdCliProject.mjs +353 -0
- package/dist/sd-cli.js.map +1 -0
- package/dist/sd-cli.mjs +119 -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/dist/utils/SdCliBuildResultUtil.d.ts +1 -4
- package/dist/utils/SdCliBuildResultUtil.js.map +1 -0
- package/dist/utils/SdCliBuildResultUtil.mjs +3 -29
- package/dist/utils/SdCliConfigUtil.js.map +1 -0
- package/dist/utils/SdCliConfigUtil.mjs +1 -1
- package/package.json +14 -56
- package/src/SdLinter.ts +41 -0
- package/src/SdTsIncrementalBuilder.ts +75 -0
- package/src/build-cluster.ts +133 -0
- package/src/builders/SdCliClientBuilder.ts +189 -0
- package/src/builders/SdCliJsLibLinter.ts +72 -0
- package/src/builders/SdCliServerBuilder.ts +191 -0
- package/src/builders/SdCliTsLibBuilder.ts +96 -0
- package/src/commons.ts +21 -112
- package/src/entry/SdCliProject.ts +467 -0
- package/src/sd-cli.ts +136 -0
- package/src/server-worker.ts +45 -0
- package/src/utils/SdCliBuildResultUtil.ts +5 -38
- package/tsconfig.json +9 -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 -72
- 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 -769
- 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/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/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 -85
- 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 -879
- 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
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { FsUtil, Logger, SdProcess } from "@simplysm/sd-core-node";
|
|
3
|
+
import { SdCliConfigUtil } from "../utils/SdCliConfigUtil";
|
|
4
|
+
import cp from "child_process";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
import { SdCliBuildResultUtil } from "../utils/SdCliBuildResultUtil";
|
|
7
|
+
import semver from "semver";
|
|
8
|
+
import { NotImplementError, Wait } from "@simplysm/sd-core-common";
|
|
9
|
+
export class SdCliProject {
|
|
10
|
+
static async watchAsync(opt) {
|
|
11
|
+
const logger = Logger.get(["simplysm", "sd-cli", "SdCliProject", "watchAsync"]);
|
|
12
|
+
logger.debug("프로젝트 설정 가져오기...");
|
|
13
|
+
const projConf = await SdCliConfigUtil.loadConfigAsync(path.resolve(opt.rootPath, opt.confFileRelPath), false, opt.optNames);
|
|
14
|
+
logger.debug("프로젝트 package.json 가져오기...");
|
|
15
|
+
const projNpmConf = FsUtil.readJson(path.resolve(opt.rootPath, "package.json"));
|
|
16
|
+
logger.debug("패키지 목록 구성...");
|
|
17
|
+
const allPkgPaths = await projNpmConf.workspaces?.mapManyAsync(async (item) => await FsUtil.globAsync(item));
|
|
18
|
+
let pkgPaths = allPkgPaths.filter((pkgPath) => path.basename(pkgPath) in projConf.packages);
|
|
19
|
+
if (opt.pkgNames.length !== 0) {
|
|
20
|
+
pkgPaths = pkgPaths.filter((pkgPath) => opt.pkgNames.includes(path.basename(pkgPath)));
|
|
21
|
+
}
|
|
22
|
+
logger.debug("빌드 프로세스 준비...");
|
|
23
|
+
const cluster = await this._prepareClusterAsync();
|
|
24
|
+
logger.debug("빌드 프로세스 이벤트 준비...");
|
|
25
|
+
const resultCache = new Map();
|
|
26
|
+
let busyCount = 0;
|
|
27
|
+
const serverInfoMap = new Map();
|
|
28
|
+
cluster.on("message", (message) => {
|
|
29
|
+
if (message.type === "change") {
|
|
30
|
+
if (busyCount === 0) {
|
|
31
|
+
logger.log("빌드를 시작합니다...");
|
|
32
|
+
}
|
|
33
|
+
busyCount++;
|
|
34
|
+
}
|
|
35
|
+
else if (message.type === "complete") {
|
|
36
|
+
for (const affectedFilePath of message.result.affectedFilePaths) {
|
|
37
|
+
resultCache.delete(affectedFilePath);
|
|
38
|
+
}
|
|
39
|
+
for (const buildResult of message.result.buildResults) {
|
|
40
|
+
const cacheItem = resultCache.getOrCreate(buildResult.filePath ?? "none", []);
|
|
41
|
+
cacheItem.push(buildResult);
|
|
42
|
+
}
|
|
43
|
+
if (message.req.pkgConf.type === "server") {
|
|
44
|
+
const pkgName = path.basename(message.req.pkgPath);
|
|
45
|
+
const serverInfo = serverInfoMap.getOrCreate(pkgName, {
|
|
46
|
+
hasChanges: false,
|
|
47
|
+
pathProxy: {},
|
|
48
|
+
changeFilePaths: []
|
|
49
|
+
});
|
|
50
|
+
serverInfo.pkgPath = message.req.pkgPath;
|
|
51
|
+
serverInfo.hasChanges = true;
|
|
52
|
+
}
|
|
53
|
+
if (message.req.pkgConf.type === "client" && message.req.pkgConf.server !== undefined) {
|
|
54
|
+
const pkgName = path.basename(message.req.pkgPath);
|
|
55
|
+
const serverInfo = serverInfoMap.getOrCreate(message.req.pkgConf.server, {
|
|
56
|
+
hasChanges: false,
|
|
57
|
+
pathProxy: {},
|
|
58
|
+
changeFilePaths: []
|
|
59
|
+
});
|
|
60
|
+
serverInfo.pathProxy[pkgName] = message.result.port;
|
|
61
|
+
serverInfo.changeFilePaths.push(...message.result.affectedFilePaths);
|
|
62
|
+
}
|
|
63
|
+
setTimeout(async () => {
|
|
64
|
+
busyCount--;
|
|
65
|
+
if (busyCount === 0) {
|
|
66
|
+
for (const serverPkgName of serverInfoMap.keys()) {
|
|
67
|
+
const serverInfo = serverInfoMap.get(serverPkgName);
|
|
68
|
+
if (serverInfo.pkgPath !== undefined && serverInfo.hasChanges) {
|
|
69
|
+
logger.debug("서버 재시작...");
|
|
70
|
+
try {
|
|
71
|
+
const restartServerResult = await this._restartServerAsync(serverInfo.pkgPath, serverInfo.worker);
|
|
72
|
+
serverInfo.worker = restartServerResult.worker;
|
|
73
|
+
serverInfo.port = restartServerResult.port;
|
|
74
|
+
serverInfo.hasChanges = false;
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
logger.error(err);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (serverInfo.worker) {
|
|
81
|
+
logger.debug("클라이언트 설정...");
|
|
82
|
+
serverInfo.worker.send({
|
|
83
|
+
type: "setPathProxy",
|
|
84
|
+
pathProxy: serverInfo.pathProxy
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const clientPaths = [];
|
|
89
|
+
for (const serverInfo of serverInfoMap.values()) {
|
|
90
|
+
for (const proxyPath of Object.keys(serverInfo.pathProxy)) {
|
|
91
|
+
clientPaths.push(`http://localhost:${serverInfo.port}/${proxyPath}/`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (clientPaths.length > 0) {
|
|
95
|
+
logger.info("클라이언트 개발 서버 접속 주소\n" + clientPaths.join("\n"));
|
|
96
|
+
}
|
|
97
|
+
const buildResults = Array.from(resultCache.values()).mapMany();
|
|
98
|
+
this._logging(buildResults, logger);
|
|
99
|
+
}
|
|
100
|
+
}, 300);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
logger.debug("빌드 프로세스 명령 전송...");
|
|
104
|
+
busyCount++;
|
|
105
|
+
logger.log("빌드를 시작합니다...");
|
|
106
|
+
await pkgPaths.parallelAsync(async (pkgPath) => {
|
|
107
|
+
await this._runCommandAsync(cluster, "watch", pkgPath, projConf.packages[path.basename(pkgPath)]);
|
|
108
|
+
});
|
|
109
|
+
busyCount--;
|
|
110
|
+
if (busyCount === 0) {
|
|
111
|
+
const buildResults = Array.from(resultCache.values()).mapMany();
|
|
112
|
+
this._logging(buildResults, logger);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
static async buildAsync(opt) {
|
|
116
|
+
const logger = Logger.get(["simplysm", "sd-cli", "SdCliProject", "buildAsync"]);
|
|
117
|
+
logger.debug("프로젝트 설정 가져오기...");
|
|
118
|
+
const projConf = await SdCliConfigUtil.loadConfigAsync(path.resolve(opt.rootPath, opt.confFileRelPath), false, opt.optNames);
|
|
119
|
+
logger.debug("프로젝트 package.json 가져오기...");
|
|
120
|
+
const projNpmConf = FsUtil.readJson(path.resolve(opt.rootPath, "package.json"));
|
|
121
|
+
logger.debug("패키지 목록 구성...");
|
|
122
|
+
const allPkgPaths = await projNpmConf.workspaces?.mapManyAsync(async (item) => await FsUtil.globAsync(item));
|
|
123
|
+
let pkgPaths = allPkgPaths.filter((pkgPath) => path.basename(pkgPath) in projConf.packages);
|
|
124
|
+
if (opt.pkgNames.length !== 0) {
|
|
125
|
+
pkgPaths = pkgPaths.filter((pkgPath) => opt.pkgNames.includes(path.basename(pkgPath)));
|
|
126
|
+
}
|
|
127
|
+
logger.debug("프로젝트 및 패키지 버전 설정...");
|
|
128
|
+
await this._upgradeVersionAsync(opt.rootPath, projNpmConf, allPkgPaths);
|
|
129
|
+
logger.debug("빌드 프로세스 준비...");
|
|
130
|
+
const cluster = await this._prepareClusterAsync();
|
|
131
|
+
logger.debug("빌드 프로세스 명령 전달...");
|
|
132
|
+
const results = (await pkgPaths.parallelAsync(async (pkgPath) => {
|
|
133
|
+
return await this._runCommandAsync(cluster, "build", pkgPath, projConf.packages[path.basename(pkgPath)]);
|
|
134
|
+
})).mapMany();
|
|
135
|
+
logger.debug("빌드 프로세스 닫기...");
|
|
136
|
+
this._closeCluster(cluster);
|
|
137
|
+
this._logging(results, logger);
|
|
138
|
+
}
|
|
139
|
+
static async publishAsync(opt) {
|
|
140
|
+
const logger = Logger.get(["simplysm", "sd-cli", "SdCliProject", "publishAsync"]);
|
|
141
|
+
logger.debug("프로젝트 설정 가져오기...");
|
|
142
|
+
const projConf = await SdCliConfigUtil.loadConfigAsync(path.resolve(opt.rootPath, opt.confFileRelPath), false, opt.optNames);
|
|
143
|
+
logger.debug("프로젝트 package.json 가져오기...");
|
|
144
|
+
const projNpmConf = FsUtil.readJson(path.resolve(opt.rootPath, "package.json"));
|
|
145
|
+
if (opt.noBuild) {
|
|
146
|
+
logger.warn("빌드하지 않고, 배포하는것은 상당히 위험합니다.");
|
|
147
|
+
await this._waitSecMessageAsync("프로세스를 중지하려면, 'CTRL+C'를 누르세요.", 5);
|
|
148
|
+
}
|
|
149
|
+
// GIT 사용중일 경우, 커밋되지 않은 수정사항이 있는지 확인
|
|
150
|
+
if (FsUtil.exists(path.resolve(process.cwd(), ".git"))) {
|
|
151
|
+
logger.debug("GIT 커밋여부 확인...");
|
|
152
|
+
const gitStatusResult = await SdProcess.spawnAsync("git status");
|
|
153
|
+
if (gitStatusResult.includes("Changes") || gitStatusResult.includes("Untracked")) {
|
|
154
|
+
throw new Error("커밋되지 않은 정보가 있습니다.\n" + gitStatusResult);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
logger.debug("패키지 목록 구성...");
|
|
158
|
+
const allPkgPaths = await projNpmConf.workspaces?.mapManyAsync(async (item) => await FsUtil.globAsync(item));
|
|
159
|
+
let pkgPaths = allPkgPaths.filter((pkgPath) => path.basename(pkgPath) in projConf.packages);
|
|
160
|
+
if (opt.pkgNames.length !== 0) {
|
|
161
|
+
pkgPaths = pkgPaths.filter((pkgPath) => opt.pkgNames.includes(path.basename(pkgPath)));
|
|
162
|
+
}
|
|
163
|
+
logger.debug("프로젝트 및 패키지 버전 설정...");
|
|
164
|
+
await this._upgradeVersionAsync(opt.rootPath, projNpmConf, allPkgPaths);
|
|
165
|
+
// 빌드
|
|
166
|
+
if (!opt.noBuild) {
|
|
167
|
+
logger.debug("빌드 프로세스 준비...");
|
|
168
|
+
const cluster = await this._prepareClusterAsync();
|
|
169
|
+
logger.debug("빌드 프로세스 명령 전달...");
|
|
170
|
+
const results = (await pkgPaths.parallelAsync(async (pkgPath) => {
|
|
171
|
+
return await this._runCommandAsync(cluster, "build", pkgPath, projConf.packages[path.basename(pkgPath)]);
|
|
172
|
+
})).mapMany();
|
|
173
|
+
logger.debug("빌드 프로세스 닫기...");
|
|
174
|
+
this._closeCluster(cluster);
|
|
175
|
+
this._logging(results, logger);
|
|
176
|
+
}
|
|
177
|
+
// GIT 사용중일경우, 새 버전 커밋 및 TAG 생성
|
|
178
|
+
if (FsUtil.exists(path.resolve(process.cwd(), ".git"))) {
|
|
179
|
+
logger.debug("새 버전 커밋 및 TAG 생성...");
|
|
180
|
+
await SdProcess.spawnAsync("git add .");
|
|
181
|
+
await SdProcess.spawnAsync(`git commit -m "v${projNpmConf.version}"`);
|
|
182
|
+
await SdProcess.spawnAsync(`git tag -a "v${projNpmConf.version}" -m "v${projNpmConf.version}"`);
|
|
183
|
+
logger.debug("새 버전 푸쉬...");
|
|
184
|
+
await SdProcess.spawnAsync("git push");
|
|
185
|
+
await SdProcess.spawnAsync("git push --tags");
|
|
186
|
+
}
|
|
187
|
+
logger.debug("배포 시작...");
|
|
188
|
+
await pkgPaths.parallelAsync(async (pkgPath) => {
|
|
189
|
+
const pkgName = path.basename(pkgPath);
|
|
190
|
+
const pkgConf = projConf.packages[pkgName];
|
|
191
|
+
if (pkgConf?.publish == null)
|
|
192
|
+
return;
|
|
193
|
+
logger.debug(`[${pkgName}] 배포 시작...`);
|
|
194
|
+
await this._publishPkgAsync(pkgPath, pkgConf.publish);
|
|
195
|
+
logger.debug(`[${pkgName}] 배포 완료`);
|
|
196
|
+
});
|
|
197
|
+
logger.info(`모든 배포가 완료되었습니다. (v${projNpmConf.version})`);
|
|
198
|
+
}
|
|
199
|
+
static async _publishPkgAsync(pkgPath, pkgPubConf) {
|
|
200
|
+
if (pkgPubConf === "npm") {
|
|
201
|
+
await SdProcess.spawnAsync("yarn npm publish --access public", { cwd: pkgPath });
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
throw new NotImplementError();
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
static async _waitSecMessageAsync(msg, sec) {
|
|
208
|
+
for (let i = sec; i > 0; i--) {
|
|
209
|
+
if (i !== sec) {
|
|
210
|
+
process.stdout.cursorTo(0);
|
|
211
|
+
}
|
|
212
|
+
process.stdout.write(`${msg} ${i}`);
|
|
213
|
+
await Wait.time(1000);
|
|
214
|
+
}
|
|
215
|
+
process.stdout.cursorTo(0);
|
|
216
|
+
process.stdout.clearLine(0);
|
|
217
|
+
}
|
|
218
|
+
static async _upgradeVersionAsync(projPath, projNpmConf, allPkgPaths) {
|
|
219
|
+
// 작업공간 package.json 버전 설정
|
|
220
|
+
const newVersion = semver.inc(projNpmConf.version, "patch");
|
|
221
|
+
projNpmConf.version = newVersion;
|
|
222
|
+
const pkgNames = await allPkgPaths.mapAsync(async (pkgPath) => {
|
|
223
|
+
const pkgNpmConf = await FsUtil.readJsonAsync(path.resolve(pkgPath, "package.json"));
|
|
224
|
+
return pkgNpmConf.name;
|
|
225
|
+
});
|
|
226
|
+
const updateDepVersion = (deps) => {
|
|
227
|
+
if (!deps)
|
|
228
|
+
return;
|
|
229
|
+
for (const depName of Object.keys(deps)) {
|
|
230
|
+
if (pkgNames.includes(depName)) {
|
|
231
|
+
deps[depName] = newVersion;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
updateDepVersion(projNpmConf.dependencies);
|
|
236
|
+
updateDepVersion(projNpmConf.optionalDependencies);
|
|
237
|
+
updateDepVersion(projNpmConf.devDependencies);
|
|
238
|
+
updateDepVersion(projNpmConf.peerDependencies);
|
|
239
|
+
const projNpmConfFilePath = path.resolve(projPath, "package.json");
|
|
240
|
+
await FsUtil.writeJsonAsync(projNpmConfFilePath, projNpmConf, { space: 2 });
|
|
241
|
+
// 각 패키지 package.json 버전 설정
|
|
242
|
+
await allPkgPaths.parallelAsync(async (pkgPath) => {
|
|
243
|
+
const pkgNpmConfFilePath = path.resolve(pkgPath, "package.json");
|
|
244
|
+
const pkgNpmConf = await FsUtil.readJsonAsync(pkgNpmConfFilePath);
|
|
245
|
+
pkgNpmConf.version = newVersion;
|
|
246
|
+
updateDepVersion(pkgNpmConf.dependencies);
|
|
247
|
+
updateDepVersion(pkgNpmConf.optionalDependencies);
|
|
248
|
+
updateDepVersion(pkgNpmConf.devDependencies);
|
|
249
|
+
updateDepVersion(pkgNpmConf.peerDependencies);
|
|
250
|
+
await FsUtil.writeJsonAsync(pkgNpmConfFilePath, pkgNpmConf, { space: 2 });
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
static _logging(buildResults, logger) {
|
|
254
|
+
const messages = buildResults.filter((item) => item.severity === "message");
|
|
255
|
+
const suggestions = buildResults.filter((item) => item.severity === "suggestion");
|
|
256
|
+
const warnings = buildResults.filter((item) => item.severity === "warning");
|
|
257
|
+
const errors = buildResults.filter((item) => item.severity === "error");
|
|
258
|
+
if (messages.length > 0) {
|
|
259
|
+
logger.log("\n" + messages.map((item) => SdCliBuildResultUtil.getMessage(item)).join("\n"));
|
|
260
|
+
}
|
|
261
|
+
if (suggestions.length > 0) {
|
|
262
|
+
logger.info("\n" + suggestions.map((item) => SdCliBuildResultUtil.getMessage(item)).join("\n"));
|
|
263
|
+
}
|
|
264
|
+
if (warnings.length > 0) {
|
|
265
|
+
logger.warn("\n" + warnings.map((item) => SdCliBuildResultUtil.getMessage(item)).join("\n"));
|
|
266
|
+
}
|
|
267
|
+
if (errors.length > 0) {
|
|
268
|
+
logger.error("\n" + errors.map((item) => SdCliBuildResultUtil.getMessage(item)).join("\n"));
|
|
269
|
+
}
|
|
270
|
+
logger.info("모든 빌드가 완료되었습니다.");
|
|
271
|
+
}
|
|
272
|
+
static async _prepareClusterAsync() {
|
|
273
|
+
const logger = Logger.get(["simplysm", "sd-cli", "SdCliProject", "_runBuildClusterAsync"]);
|
|
274
|
+
return await new Promise(async (resolve, reject) => {
|
|
275
|
+
const cluster = cp.fork(fileURLToPath(await import.meta.resolve("../build-cluster")), [], {
|
|
276
|
+
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
|
277
|
+
env: process.env
|
|
278
|
+
});
|
|
279
|
+
cluster.stdout.pipe(process.stdout);
|
|
280
|
+
cluster.stderr.pipe(process.stderr);
|
|
281
|
+
cluster.on("exit", (code) => {
|
|
282
|
+
if (code != null && code !== 0) {
|
|
283
|
+
const err = new Error(`오류와 함께 닫힘 (${code})`);
|
|
284
|
+
logger.error(err);
|
|
285
|
+
reject(err);
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
cluster.on("error", (err) => {
|
|
290
|
+
logger.error(err);
|
|
291
|
+
reject(err);
|
|
292
|
+
});
|
|
293
|
+
cluster.on("message", (message) => {
|
|
294
|
+
if (message === "ready") {
|
|
295
|
+
logger.debug("빌드 클러스터 프로세스가 준비되었습니다.");
|
|
296
|
+
resolve(cluster);
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
static async _runCommandAsync(cluster, cmd, pkgPath, pkgConf) {
|
|
302
|
+
return await new Promise((resolve) => {
|
|
303
|
+
const cb = (message) => {
|
|
304
|
+
if (cmd === "watch" && message.type === "ready" && message.req.cmd === cmd && message.req.pkgPath === pkgPath) {
|
|
305
|
+
cluster.off("message", cb);
|
|
306
|
+
resolve();
|
|
307
|
+
}
|
|
308
|
+
else if (cmd === "build" && message.type === "complete" && message.req.cmd === cmd && message.req.pkgPath === pkgPath) {
|
|
309
|
+
cluster.off("message", cb);
|
|
310
|
+
resolve(message.result?.buildResults);
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
cluster.on("message", cb);
|
|
314
|
+
cluster.send({ cmd, pkgPath, pkgConf });
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
static _closeCluster(cluster) {
|
|
318
|
+
cluster.kill("SIGKILL");
|
|
319
|
+
}
|
|
320
|
+
static async _restartServerAsync(pkgPath, prevServerProcess) {
|
|
321
|
+
const logger = Logger.get(["simplysm", "sd-cli", "SdCliProject", "_restartServerAsync"]);
|
|
322
|
+
if (prevServerProcess) {
|
|
323
|
+
prevServerProcess.kill("SIGKILL");
|
|
324
|
+
}
|
|
325
|
+
return await new Promise(async (resolve, reject) => {
|
|
326
|
+
const worker = cp.fork(fileURLToPath(await import.meta.resolve("../server-worker")), [pkgPath], {
|
|
327
|
+
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
|
328
|
+
env: process.env
|
|
329
|
+
});
|
|
330
|
+
worker.stdout.pipe(process.stdout);
|
|
331
|
+
worker.stderr.pipe(process.stderr);
|
|
332
|
+
worker.on("exit", (code) => {
|
|
333
|
+
if (code != null && code !== 0) {
|
|
334
|
+
const err = new Error(`오류와 함께 닫힘 (${code})`);
|
|
335
|
+
logger.error(err);
|
|
336
|
+
reject(err);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
worker.on("error", (err) => {
|
|
341
|
+
logger.error(err);
|
|
342
|
+
reject(err);
|
|
343
|
+
});
|
|
344
|
+
worker.on("message", (message) => {
|
|
345
|
+
if ("port" in message) {
|
|
346
|
+
logger.debug("서버가 시작되었습니다.");
|
|
347
|
+
resolve({ worker, port: message.port });
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
//# sourceMappingURL=SdCliProject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sd-cli.js","sourceRoot":"","sources":["../../../src/sd-cli.ts"],"names":[],"mappings":"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"}
|
package/dist/sd-cli.mjs
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import yargs from "yargs";
|
|
2
|
+
import { hideBin } from "yargs/helpers";
|
|
3
|
+
import { SdCliProject } from "./entry/SdCliProject";
|
|
4
|
+
import { Logger, LoggerSeverity } from "@simplysm/sd-core-node";
|
|
5
|
+
import { EventEmitter } from "events";
|
|
6
|
+
Error.stackTraceLimit = Infinity;
|
|
7
|
+
EventEmitter.defaultMaxListeners = 0;
|
|
8
|
+
const argv = (await yargs(hideBin(process.argv))
|
|
9
|
+
.help("help", "도움말")
|
|
10
|
+
.alias("help", "h")
|
|
11
|
+
.options({
|
|
12
|
+
debug: {
|
|
13
|
+
type: "boolean",
|
|
14
|
+
describe: "디버그 로그를 표시할 것인지 여부",
|
|
15
|
+
default: false
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
.command("watch", "프로젝트의 각 패키지에 대한 변경감지 빌드를 수행합니다.", (cmd) => cmd.version(false).hide("help").hide("debug")
|
|
19
|
+
.options({
|
|
20
|
+
config: {
|
|
21
|
+
string: true,
|
|
22
|
+
describe: "simplysm.json 파일 경로"
|
|
23
|
+
},
|
|
24
|
+
options: {
|
|
25
|
+
string: true,
|
|
26
|
+
array: true,
|
|
27
|
+
describe: "옵션 설정 (설정파일에서 @로 시작하는 부분)"
|
|
28
|
+
},
|
|
29
|
+
packages: {
|
|
30
|
+
string: true,
|
|
31
|
+
array: true,
|
|
32
|
+
describe: "수행할 패키지 설정"
|
|
33
|
+
}
|
|
34
|
+
}))
|
|
35
|
+
.command("build", "프로젝트의 각 패키지에 대한 빌드를 수행합니다.", (cmd) => cmd.version(false).hide("help").hide("debug")
|
|
36
|
+
.options({
|
|
37
|
+
config: {
|
|
38
|
+
string: true,
|
|
39
|
+
describe: "simplysm.json 파일 경로"
|
|
40
|
+
},
|
|
41
|
+
options: {
|
|
42
|
+
string: true,
|
|
43
|
+
array: true,
|
|
44
|
+
describe: "옵션 설정 (설정파일에서 @로 시작하는 부분)"
|
|
45
|
+
},
|
|
46
|
+
packages: {
|
|
47
|
+
string: true,
|
|
48
|
+
array: true,
|
|
49
|
+
describe: "수행할 패키지 설정"
|
|
50
|
+
}
|
|
51
|
+
}))
|
|
52
|
+
.command("publish", "프로젝트의 각 패키지를 배포합니다.", (cmd) => cmd.version(false).hide("help").hide("debug")
|
|
53
|
+
.options({
|
|
54
|
+
noBuild: {
|
|
55
|
+
type: "boolean",
|
|
56
|
+
describe: "빌드를 하지않고 배포합니다.",
|
|
57
|
+
default: false
|
|
58
|
+
},
|
|
59
|
+
config: {
|
|
60
|
+
type: "string",
|
|
61
|
+
describe: "simplysm.json 파일 경로"
|
|
62
|
+
},
|
|
63
|
+
options: {
|
|
64
|
+
type: "string",
|
|
65
|
+
array: true,
|
|
66
|
+
describe: "옵션 설정 (설정파일에서 @로 시작하는 부분)"
|
|
67
|
+
},
|
|
68
|
+
packages: {
|
|
69
|
+
type: "string",
|
|
70
|
+
array: true,
|
|
71
|
+
describe: "수행할 패키지 설정"
|
|
72
|
+
}
|
|
73
|
+
}))
|
|
74
|
+
.parseAsync());
|
|
75
|
+
if (Boolean(argv.debug)) {
|
|
76
|
+
process.env["SD_DEBUG"] = "true";
|
|
77
|
+
Logger.setConfig({
|
|
78
|
+
console: {
|
|
79
|
+
level: LoggerSeverity.debug
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
Logger.setConfig({
|
|
85
|
+
dot: true
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (argv._[0] === "watch") {
|
|
89
|
+
await SdCliProject
|
|
90
|
+
.watchAsync({
|
|
91
|
+
rootPath: process.cwd(),
|
|
92
|
+
confFileRelPath: argv.config ?? "simplysm.json",
|
|
93
|
+
optNames: argv.options ?? [],
|
|
94
|
+
pkgNames: argv.packages ?? []
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
else if (argv._[0] === "build") {
|
|
98
|
+
await SdCliProject
|
|
99
|
+
.buildAsync({
|
|
100
|
+
rootPath: process.cwd(),
|
|
101
|
+
confFileRelPath: argv.config ?? "simplysm.json",
|
|
102
|
+
optNames: argv.options ?? [],
|
|
103
|
+
pkgNames: argv.packages ?? []
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
else if (argv._[0] === "publish") {
|
|
107
|
+
await SdCliProject
|
|
108
|
+
.publishAsync({
|
|
109
|
+
rootPath: process.cwd(),
|
|
110
|
+
noBuild: argv.noBuild,
|
|
111
|
+
confFileRelPath: argv.config ?? "simplysm.json",
|
|
112
|
+
optNames: argv.options ?? [],
|
|
113
|
+
pkgNames: argv.packages ?? []
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
throw new Error(`명령어가 잘못 되었습니다.\n\t${argv._[0]}\n`);
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=sd-cli.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TPropertyDecoratorReturn } from "./decorator-return-types";
|
|
2
|
+
/**
|
|
3
|
+
* 속성에 설정하여, 동일 클래스의 {@link INotifyPropertyChange.onPropertyChange} 호출
|
|
4
|
+
*/
|
|
5
|
+
export declare function NotifyPropertyChange(): TPropertyDecoratorReturn<any>;
|
|
6
|
+
/**
|
|
7
|
+
* {@link NotifyPropertyChange}가 설정된 속성이 변경될때, 상속한 클래스의 {@link onPropertyChange} 호출
|
|
8
|
+
*/
|
|
9
|
+
export interface INotifyPropertyChange {
|
|
10
|
+
/**
|
|
11
|
+
* {@link NotifyPropertyChange}가 설정된 속성이 변경될때, 상속한 클래스의 {@link onPropertyChange} 호출
|
|
12
|
+
*
|
|
13
|
+
* @template K 속성명 타입
|
|
14
|
+
*
|
|
15
|
+
* @param propertyName 속성명
|
|
16
|
+
* @param oldValue 변경 이전 값
|
|
17
|
+
* @param newValue 변경 이후 값
|
|
18
|
+
*/
|
|
19
|
+
onPropertyChange<K extends keyof this>(propertyName: K, oldValue: this[K], newValue: this[K]): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotifyPropertyChange.js","sourceRoot":"","sources":["../../../../../sd-core-common/src/decorators/NotifyPropertyChange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAG5E;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,2BAA2B,CAAC;QACjC,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE;YACrD,MAAM,CAAC,gBAAgB,CAAC,YAAY,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC5D,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PropertyGetSetDecoratorBase } from "./PropertyGetSetDecoratorBase";
|
|
2
|
+
/**
|
|
3
|
+
* 속성에 설정하여, 동일 클래스의 {@link INotifyPropertyChange.onPropertyChange} 호출
|
|
4
|
+
*/
|
|
5
|
+
export function NotifyPropertyChange() {
|
|
6
|
+
return PropertyGetSetDecoratorBase({
|
|
7
|
+
afterSet: (target, propertyName, oldValue, newValue) => {
|
|
8
|
+
target.onPropertyChange(propertyName, oldValue, newValue);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=NotifyPropertyChange.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { TPropertyDecoratorReturn } from "./decorator-return-types";
|
|
2
|
+
/**
|
|
3
|
+
* 속성의 GET/SET 을 Interupt 하여 사용하는 Decorator를 위한 기본 함수
|
|
4
|
+
*
|
|
5
|
+
* @template O 클래스 타입
|
|
6
|
+
* @template K 클래스내 속성명
|
|
7
|
+
*/
|
|
8
|
+
export declare function PropertyGetSetDecoratorBase<O extends object, K extends keyof O>(arg: IPropertyGetSetDecoratorBaseParam<O, K>): TPropertyDecoratorReturn<O, K>;
|
|
9
|
+
/**
|
|
10
|
+
* {@link PropertyGetSetDecoratorBase} 의 Parameter
|
|
11
|
+
*
|
|
12
|
+
* @template O 클래스 타입
|
|
13
|
+
* @template K 클래스내 속성명
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
export interface IPropertyGetSetDecoratorBaseParam<O extends object, K extends keyof O> {
|
|
17
|
+
/**
|
|
18
|
+
* 값이 설정 되기 전에 수행할 함수
|
|
19
|
+
*
|
|
20
|
+
* @param target 객체
|
|
21
|
+
* @param propertyName 속성명
|
|
22
|
+
* @param oldValue SET 이전값
|
|
23
|
+
* @param newValue SET 이후값
|
|
24
|
+
*/
|
|
25
|
+
beforeSet?: (target: O, propertyName: K, oldValue: O[K], newValue: O[K]) => (O[K] | undefined);
|
|
26
|
+
/**
|
|
27
|
+
* 값이 설정 된 직후, 수행할 함수
|
|
28
|
+
*
|
|
29
|
+
* @param target 객체
|
|
30
|
+
* @param propertyName 속성명
|
|
31
|
+
* @param oldValue SET 이전값
|
|
32
|
+
* @param newValue SET 이후값
|
|
33
|
+
*/
|
|
34
|
+
afterSet?: (target: O, propertyName: K, oldValue: O[K], newValue: O[K]) => void;
|
|
35
|
+
/**
|
|
36
|
+
* 누군가 GET 을 시도할때, GET 되기 전, 수행할 함수
|
|
37
|
+
*
|
|
38
|
+
* @param target 객체
|
|
39
|
+
* @param propertyName 속성명
|
|
40
|
+
* @param value GET 처리될 현재 값
|
|
41
|
+
*/
|
|
42
|
+
get?: (target: O, propertyName: K, value: O[K]) => void;
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyGetSetDecoratorBase.js","sourceRoot":"","sources":["../../../../../sd-core-common/src/decorators/PropertyGetSetDecoratorBase.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG,kBAAkB,CAAC;AAElC;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAsC,GAA4C;IAC3H,OAAO,UAAU,MAAS,EAAE,YAAe,EAAE,eAAoC;QAC/E,MAAM,cAAc,GAAG,eAAe,IAAI,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAChG,MAAM,UAAU,GAAG,cAAc,EAAE,GAAG,CAAC;QACvC,MAAM,UAAU,GAAG,cAAc,EAAE,GAAG,CAAC;QAEvC,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,YAAsB,CAAC,CAAC;QAErF,MAAM,MAAM,GAAG;YACb,MAAM,KAAK,GAAG,UAAU,KAAK,SAAS;gBACpC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBACzB,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,YAAsB,CAAC,CAAC;YAE9D,IAAI,GAAG,CAAC,GAAG,KAAK,SAAS,EAAE;gBACzB,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;aACpC;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAC;QAEF,MAAM,MAAM,GAAG,UAAmB,KAAW;YAC3C,MAAM,SAAS,GAAG,UAAU,KAAK,SAAS;gBACxC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBACzB,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,YAAsB,CAAC,CAAC;YAE9D,IAAI,SAAS,GAAG,KAAK,CAAC;YACtB,IAAI,GAAG,CAAC,SAAS,KAAK,SAAS,EAAE;gBAC/B,MAAM,eAAe,GAAG,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;gBAChF,IAAI,eAAe,KAAK,SAAS,EAAE;oBACjC,SAAS,GAAG,eAAe,CAAC;iBAC7B;aACF;YAED,IAAI,UAAU,KAAK,SAAS,EAAE;gBAC5B,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC;aAClC;iBACI;gBACH,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,YAAsB,CAAC,CAAC;aACzE;YAED,IAAI,GAAG,CAAC,QAAQ,KAAK,SAAS,EAAE;gBAC9B,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;aACxD;QACH,CAAC,CAAC;QAEF,IAAI,OAAO,MAAM,CAAC,YAAY,CAAC,EAAE;YAC/B,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE;gBAC1C,GAAG,EAAE,MAAM;gBACX,GAAG,EAAE,MAAM;gBACX,UAAU,EAAE,IAAI;gBAChB,YAAY,EAAE,IAAI;aACnB,CAAC,CAAC;SACJ;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const symbol = "sd-type-validate";
|
|
2
|
+
/**
|
|
3
|
+
* 속성의 GET/SET 을 Interupt 하여 사용하는 Decorator를 위한 기본 함수
|
|
4
|
+
*
|
|
5
|
+
* @template O 클래스 타입
|
|
6
|
+
* @template K 클래스내 속성명
|
|
7
|
+
*/
|
|
8
|
+
export function PropertyGetSetDecoratorBase(arg) {
|
|
9
|
+
return function (target, propertyName, inputDescriptor) {
|
|
10
|
+
const prevDescriptor = inputDescriptor ?? Object.getOwnPropertyDescriptor(target, propertyName);
|
|
11
|
+
const prevGetter = prevDescriptor?.get;
|
|
12
|
+
const prevSetter = prevDescriptor?.set;
|
|
13
|
+
Reflect.defineMetadata(symbol, target[propertyName], target, propertyName);
|
|
14
|
+
const getter = function () {
|
|
15
|
+
const value = prevGetter !== undefined
|
|
16
|
+
? prevGetter.bind(this)()
|
|
17
|
+
: Reflect.getMetadata(symbol, this, propertyName);
|
|
18
|
+
if (arg.get !== undefined) {
|
|
19
|
+
arg.get(this, propertyName, value);
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
const setter = function (value) {
|
|
24
|
+
const prevValue = prevGetter !== undefined
|
|
25
|
+
? prevGetter.bind(this)()
|
|
26
|
+
: Reflect.getMetadata(symbol, this, propertyName);
|
|
27
|
+
let realValue = value;
|
|
28
|
+
if (arg.beforeSet !== undefined) {
|
|
29
|
+
const beforeSetResult = arg.beforeSet(this, propertyName, prevValue, realValue);
|
|
30
|
+
if (beforeSetResult !== undefined) {
|
|
31
|
+
realValue = beforeSetResult;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (prevSetter !== undefined) {
|
|
35
|
+
prevSetter.bind(this)(realValue);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
Reflect.defineMetadata(symbol, realValue, this, propertyName);
|
|
39
|
+
}
|
|
40
|
+
if (arg.afterSet !== undefined) {
|
|
41
|
+
arg.afterSet(this, propertyName, prevValue, realValue);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
if (delete target[propertyName]) {
|
|
45
|
+
Object.defineProperty(target, propertyName, {
|
|
46
|
+
get: getter,
|
|
47
|
+
set: setter,
|
|
48
|
+
enumerable: true,
|
|
49
|
+
configurable: true
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=PropertyGetSetDecoratorBase.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TValidateDef } from "../utils/ObjectUtil";
|
|
2
|
+
import { TPropertyDecoratorReturn } from "./decorator-return-types";
|
|
3
|
+
/**
|
|
4
|
+
* 속성값이 설정될 때, 기대되는 값인지 확인 하는 Decorator
|
|
5
|
+
*
|
|
6
|
+
* @param def Validation 설정
|
|
7
|
+
* @param replacer 체크하기전에 값을 변경하는 함수
|
|
8
|
+
*/
|
|
9
|
+
export declare function PropertyValidate(def: TValidateDef<any>, replacer?: TPropertyValidateReplacer): TPropertyDecoratorReturn<any>;
|
|
10
|
+
/**
|
|
11
|
+
* 체크하기전에 값을 변경하는 함수
|
|
12
|
+
*
|
|
13
|
+
* @param value 입력값
|
|
14
|
+
* @returns 출력값
|
|
15
|
+
*/
|
|
16
|
+
export type TPropertyValidateReplacer = (value: any) => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyValidate.js","sourceRoot":"","sources":["../../../../../sd-core-common/src/decorators/PropertyValidate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAgB,MAAM,qBAAqB,CAAC;AAG/D;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAsB,EAAE,QAAoC;IAC3F,OAAO,2BAA2B,CAAC;QACjC,SAAS,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE;YACxD,MAAM,iBAAiB,GAAG,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACnF,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC;YAC1D,IAAI,KAAK,KAAK,SAAS,EAAE;gBACvB,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,KAAK,IAAI,CAAC,SAAS,CAAC;oBACjG,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI;oBAClC,YAAY;oBACZ,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;iBAC5C,CAAC,EAAE,CAAC,CAAC;aACP;YAED,OAAO,iBAAiB,CAAC;QAC3B,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|