@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
|
@@ -1,879 +0,0 @@
|
|
|
1
|
-
import { INpmConfig, ISdCliClientPackageConfig, ISdCliPackageBuildResult, 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 { NamedChunksPlugin } from "@angular-devkit/build-angular/src/webpack/plugins/named-chunks-plugin";
|
|
9
|
-
import {
|
|
10
|
-
DedupeModuleResolvePlugin,
|
|
11
|
-
JavaScriptOptimizerPlugin,
|
|
12
|
-
SuppressExtractedTextChunksWebpackPlugin
|
|
13
|
-
} from "@angular-devkit/build-angular/src/webpack/plugins";
|
|
14
|
-
import CopyWebpackPlugin from "copy-webpack-plugin";
|
|
15
|
-
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
|
16
|
-
import { AngularWebpackPlugin } from "@ngtools/webpack";
|
|
17
|
-
import { IndexHtmlWebpackPlugin } from "@angular-devkit/build-angular/src/webpack/plugins/index-html-webpack-plugin";
|
|
18
|
-
import { SassWorkerImplementation } from "@angular-devkit/build-angular/src/sass/sass-service";
|
|
19
|
-
import { LicenseWebpackPlugin } from "license-webpack-plugin";
|
|
20
|
-
import NodePolyfillPlugin from "node-polyfill-webpack-plugin";
|
|
21
|
-
import { createHash } from "crypto";
|
|
22
|
-
import ESLintWebpackPlugin from "eslint-webpack-plugin";
|
|
23
|
-
import os from "os";
|
|
24
|
-
import { ESLint } from "eslint";
|
|
25
|
-
import { TransferSizePlugin } from "@angular-devkit/build-angular/src/webpack/plugins/transfer-size-plugin";
|
|
26
|
-
import { CssOptimizerPlugin } from "@angular-devkit/build-angular/src/webpack/plugins/css-optimizer-plugin";
|
|
27
|
-
import browserslist from "browserslist";
|
|
28
|
-
import { augmentAppWithServiceWorker } from "@angular-devkit/build-angular/src/utils/service-worker";
|
|
29
|
-
import { SdCliNgModuleGenerator } from "../ng-tools/SdCliNgModuleGenerator";
|
|
30
|
-
import { SdCliCordova } from "../build-tool/SdCliCordova";
|
|
31
|
-
import { SdCliNpmConfigUtil } from "../utils/SdCliNpmConfigUtil";
|
|
32
|
-
import electronBuilder from "electron-builder";
|
|
33
|
-
import { fileURLToPath } from "url";
|
|
34
|
-
import { Entrypoint } from "@angular-devkit/build-angular/src/utils/index-file/augment-index-html";
|
|
35
|
-
import { StringUtil } from "@simplysm/sd-core-common";
|
|
36
|
-
import LintResult = ESLint.LintResult;
|
|
37
|
-
|
|
38
|
-
export class SdCliClientBuilder extends EventEmitter {
|
|
39
|
-
private readonly _logger: Logger;
|
|
40
|
-
|
|
41
|
-
private readonly _tsconfigFilePath: string;
|
|
42
|
-
private readonly _parsedTsconfig: ts.ParsedCommandLine;
|
|
43
|
-
private readonly _npmConfigMap = new Map<string, INpmConfig>();
|
|
44
|
-
private readonly _ngModuleGenerator: SdCliNgModuleGenerator;
|
|
45
|
-
|
|
46
|
-
private readonly _cordova?: SdCliCordova;
|
|
47
|
-
|
|
48
|
-
private readonly _hasAngularRoute: boolean;
|
|
49
|
-
|
|
50
|
-
private readonly _cacheBasePath = path.resolve(this._rootPath, ".cache");
|
|
51
|
-
|
|
52
|
-
public constructor(private readonly _rootPath: string,
|
|
53
|
-
private readonly _config: ISdCliClientPackageConfig,
|
|
54
|
-
private readonly _projRootPath: string) {
|
|
55
|
-
super();
|
|
56
|
-
|
|
57
|
-
const npmConfig = this._getNpmConfig(this._rootPath)!;
|
|
58
|
-
this._logger = Logger.get(["simplysm", "sd-cli", this.constructor.name, npmConfig.name]);
|
|
59
|
-
|
|
60
|
-
// tsconfig
|
|
61
|
-
this._tsconfigFilePath = path.resolve(this._rootPath, "tsconfig-build.json");
|
|
62
|
-
const tsconfig = FsUtil.readJson(this._tsconfigFilePath) as ITsconfig;
|
|
63
|
-
this._parsedTsconfig = ts.parseJsonConfigFileContent(tsconfig, ts.sys, this._rootPath, tsconfig.angularCompilerOptions);
|
|
64
|
-
|
|
65
|
-
// isAngular
|
|
66
|
-
this._hasAngularRoute = SdCliNpmConfigUtil.getDependencies(npmConfig).defaults.includes("@angular/router");
|
|
67
|
-
|
|
68
|
-
// NgModule 생성기 초기화
|
|
69
|
-
this._ngModuleGenerator = new SdCliNgModuleGenerator(this._rootPath, [
|
|
70
|
-
"controls",
|
|
71
|
-
"directives",
|
|
72
|
-
"guards",
|
|
73
|
-
"modals",
|
|
74
|
-
"providers",
|
|
75
|
-
"app",
|
|
76
|
-
"pages",
|
|
77
|
-
"print-templates",
|
|
78
|
-
"toasts",
|
|
79
|
-
"AppPage"
|
|
80
|
-
], this._hasAngularRoute ? {
|
|
81
|
-
glob: "**/*Page.ts",
|
|
82
|
-
fileEndsWith: "Page",
|
|
83
|
-
rootClassName: "AppPage"
|
|
84
|
-
} : undefined);
|
|
85
|
-
|
|
86
|
-
// CORDOVA
|
|
87
|
-
if (this._config.builder?.cordova) {
|
|
88
|
-
this._cordova = new SdCliCordova(this._rootPath, this._config.builder.cordova);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
public override on(event: "change", listener: () => void): this;
|
|
93
|
-
public override on(event: "complete", listener: (results: ISdCliPackageBuildResult[]) => void): this;
|
|
94
|
-
public override on(event: string | symbol, listener: (...args: any[]) => void): this {
|
|
95
|
-
return super.on(event, listener);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
private async _checkCacheAsync(watch: boolean): Promise<void> {
|
|
99
|
-
const projPkgLockContent = await FsUtil.readFileAsync(path.resolve(this._projRootPath, "yarn.lock"));
|
|
100
|
-
|
|
101
|
-
// const cachePath = path.resolve(cacheBasePath, pkgVersion);
|
|
102
|
-
|
|
103
|
-
const versionHash = createHash("sha1")
|
|
104
|
-
.update(projPkgLockContent)
|
|
105
|
-
.update(JSON.stringify(this._parsedTsconfig.options))
|
|
106
|
-
.update(JSON.stringify(this._config))
|
|
107
|
-
.update(watch.toString())
|
|
108
|
-
.digest("hex");
|
|
109
|
-
if (
|
|
110
|
-
!FsUtil.exists(path.resolve(this._cacheBasePath, "version")) // 버전파일이 없거나
|
|
111
|
-
|| (
|
|
112
|
-
FsUtil.exists(path.resolve(this._cacheBasePath, "version")) &&
|
|
113
|
-
await FsUtil.readFileAsync(path.resolve(this._cacheBasePath, "version")) !== versionHash
|
|
114
|
-
) // 버전이 현재 버전과 다르면
|
|
115
|
-
) {
|
|
116
|
-
// 캐시 삭제
|
|
117
|
-
await FsUtil.removeAsync(path.resolve(this._cacheBasePath));
|
|
118
|
-
}
|
|
119
|
-
// 버전쓰기
|
|
120
|
-
await FsUtil.writeFileAsync(path.resolve(this._cacheBasePath, "version"), versionHash);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
public async watchAsync(): Promise<void> {
|
|
124
|
-
// DIST 비우기
|
|
125
|
-
await FsUtil.removeAsync(path.resolve(this._rootPath, ".cache", "electron"));
|
|
126
|
-
await FsUtil.removeAsync(this._parsedTsconfig.options.outDir!);
|
|
127
|
-
|
|
128
|
-
// 캐시체크
|
|
129
|
-
await this._checkCacheAsync(true);
|
|
130
|
-
|
|
131
|
-
// NgModule 생성
|
|
132
|
-
await this._ngModuleGenerator.runAsync();
|
|
133
|
-
|
|
134
|
-
// CORDOVA 초기화
|
|
135
|
-
if (this._cordova) {
|
|
136
|
-
this._logger.debug("CORDOVA 구성...");
|
|
137
|
-
await this._cordova.initializeAsync();
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// 빌드 준비
|
|
141
|
-
const extModules = this._config.builder?.electron ? this._getExternalModules() : [];
|
|
142
|
-
const webpackConfigs = await (Object.keys(this._config.builder ?? { web: {} }) as ("web" | "cordova" | "electron")[])
|
|
143
|
-
.mapAsync(async (builderType) => await this._getWebpackConfigAsync(true, builderType, extModules));
|
|
144
|
-
const multiCompiler = webpack(webpackConfigs);
|
|
145
|
-
await new Promise<void>((resolve, reject) => {
|
|
146
|
-
// const invalidFiles: string[] = [];
|
|
147
|
-
multiCompiler.hooks.invalid.tap(this.constructor.name, (fileName) => {
|
|
148
|
-
if (fileName != null) {
|
|
149
|
-
this._logger.debug("파일변경 감지", fileName);
|
|
150
|
-
|
|
151
|
-
// NgModule 캐시 삭제
|
|
152
|
-
this._ngModuleGenerator.removeCaches([path.resolve(fileName)]);
|
|
153
|
-
|
|
154
|
-
// invalidFiles.push(fileName);
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
multiCompiler.hooks.watchRun.tapAsync(this.constructor.name, async (args, callback) => {
|
|
159
|
-
this.emit("change");
|
|
160
|
-
|
|
161
|
-
// NgModule 생성
|
|
162
|
-
await this._ngModuleGenerator.runAsync();
|
|
163
|
-
|
|
164
|
-
callback();
|
|
165
|
-
|
|
166
|
-
this._logger.debug("Webpack 빌드 수행...");
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
multiCompiler.watch({}, async (err, multiStats) => {
|
|
170
|
-
if (err != null || multiStats == null) {
|
|
171
|
-
this.emit("complete", [{
|
|
172
|
-
filePath: undefined,
|
|
173
|
-
line: undefined,
|
|
174
|
-
char: undefined,
|
|
175
|
-
code: undefined,
|
|
176
|
-
severity: "error",
|
|
177
|
-
message: err?.stack ?? "알 수 없는 오류 (multiStats=null)"
|
|
178
|
-
}]);
|
|
179
|
-
reject(err);
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// .config.json 파일 쓰기
|
|
184
|
-
const npmConfig = this._getNpmConfig(this._rootPath)!;
|
|
185
|
-
const packageKey = npmConfig.name.split("/").last()!;
|
|
186
|
-
|
|
187
|
-
const configDistPath = typeof this._config.server === "string"
|
|
188
|
-
? path.resolve(this._projRootPath, "packages", this._config.server, "dist/www", packageKey, ".config.json")
|
|
189
|
-
: path.resolve(this._parsedTsconfig.options.outDir!, ".config.json");
|
|
190
|
-
await FsUtil.writeFileAsync(configDistPath, JSON.stringify(this._config.configs ?? {}, undefined, 2));
|
|
191
|
-
|
|
192
|
-
// 완료 로그
|
|
193
|
-
this._logger.debug("Webpack 빌드 완료");
|
|
194
|
-
|
|
195
|
-
// 결과 반환
|
|
196
|
-
const results = multiStats.stats.mapMany((stats) => SdCliBuildResultUtil.convertFromWebpackStats(stats));
|
|
197
|
-
this.emit("complete", results);
|
|
198
|
-
|
|
199
|
-
resolve();
|
|
200
|
-
});
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
public async buildAsync(): Promise<ISdCliPackageBuildResult[]> {
|
|
205
|
-
// DIST 비우기
|
|
206
|
-
this._logger.debug("removeAsync:1");
|
|
207
|
-
await FsUtil.removeAsync(path.resolve(this._rootPath, ".cache", "electron"));
|
|
208
|
-
this._logger.debug("removeAsync:2");
|
|
209
|
-
await FsUtil.removeAsync(this._parsedTsconfig.options.outDir!);
|
|
210
|
-
|
|
211
|
-
// 캐시체크
|
|
212
|
-
await this._checkCacheAsync(false);
|
|
213
|
-
|
|
214
|
-
// NgModule 생성
|
|
215
|
-
this._logger.debug("ngModule");
|
|
216
|
-
await this._ngModuleGenerator.runAsync();
|
|
217
|
-
|
|
218
|
-
// CORDOVA 초기화
|
|
219
|
-
if (this._cordova) {
|
|
220
|
-
this._logger.debug("CORDOVA 구성...");
|
|
221
|
-
await this._cordova.initializeAsync();
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// 빌드
|
|
225
|
-
this._logger.debug("Webpack 빌드 수행...");
|
|
226
|
-
const extModules = this._config.builder?.electron ? this._getExternalModules() : [];
|
|
227
|
-
const builderTypes = (Object.keys(this._config.builder ?? { web: {} }) as ("web" | "cordova" | "electron")[]);
|
|
228
|
-
const webpackConfigs = await builderTypes.mapAsync(async (builderType) => await this._getWebpackConfigAsync(false, builderType, extModules));
|
|
229
|
-
const multipleCompiler = webpack(webpackConfigs);
|
|
230
|
-
const buildResults = await new Promise<ISdCliPackageBuildResult[]>((resolve, reject) => {
|
|
231
|
-
multipleCompiler.run((err, multiStats) => {
|
|
232
|
-
if (err != null || multiStats == null) {
|
|
233
|
-
reject(err);
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// 결과 반환
|
|
238
|
-
const results = multiStats.stats.mapMany((stats) => SdCliBuildResultUtil.convertFromWebpackStats(stats));
|
|
239
|
-
resolve(results);
|
|
240
|
-
});
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
// .config.json 파일 쓰기
|
|
244
|
-
const targetPath = path.resolve(this._parsedTsconfig.options.outDir!, ".config.json");
|
|
245
|
-
await FsUtil.writeFileAsync(targetPath, JSON.stringify(this._config.configs ?? {}, undefined, 2));
|
|
246
|
-
|
|
247
|
-
// service-worker 처리
|
|
248
|
-
if (builderTypes.includes("web") && FsUtil.exists(path.resolve(this._rootPath, "ngsw-config.json"))) {
|
|
249
|
-
const packageKey = this._getNpmConfig(this._rootPath)!.name.split("/").last()!;
|
|
250
|
-
await augmentAppWithServiceWorker(
|
|
251
|
-
PathUtil.posix(path.relative(this._projRootPath, this._rootPath)) as any,
|
|
252
|
-
PathUtil.posix(this._projRootPath),
|
|
253
|
-
PathUtil.posix(path.relative(this._projRootPath, path.resolve(this._parsedTsconfig.options.outDir!))) as any,
|
|
254
|
-
`/${packageKey}/` as any,
|
|
255
|
-
PathUtil.posix(path.relative(this._projRootPath, path.resolve(this._rootPath, "ngsw-config.json")))
|
|
256
|
-
);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
// CORDOVA 빌드
|
|
260
|
-
if (this._cordova) {
|
|
261
|
-
this._logger.debug("CORDOVA 빌드...");
|
|
262
|
-
await this._cordova.buildAsync(this._parsedTsconfig.options.outDir!);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// ELECTRON
|
|
266
|
-
if (this._config.builder?.electron) {
|
|
267
|
-
this._logger.debug("ELECTRON 빌드...");
|
|
268
|
-
const npmConfig = this._getNpmConfig(this._rootPath)!;
|
|
269
|
-
|
|
270
|
-
const electronVersion = npmConfig.dependencies?.["electron"];
|
|
271
|
-
if (electronVersion === undefined) {
|
|
272
|
-
throw new Error("ELECTRON 빌드 패키지의 'dependencies'에는 'electron'이 반드시 포함되어야 합니다.");
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
const dotenvVersion = npmConfig.dependencies?.["dotenv"];
|
|
276
|
-
if (dotenvVersion === undefined) {
|
|
277
|
-
throw new Error("ELECTRON 빌드 패키지의 'dependencies'에는 'dotenv'가 반드시 포함되어야 합니다.");
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
// const remoteVersion = npmConfig.dependencies?.["@electron/remote"];
|
|
281
|
-
|
|
282
|
-
const electronSrcPath = path.resolve(this._rootPath, `.cache/electron/src`);
|
|
283
|
-
const electronDistPath = path.resolve(this._rootPath, `.cache/electron/dist`);
|
|
284
|
-
|
|
285
|
-
await FsUtil.writeJsonAsync(path.resolve(electronSrcPath, `package.json`), {
|
|
286
|
-
name: npmConfig.name,
|
|
287
|
-
version: npmConfig.version,
|
|
288
|
-
description: npmConfig.description,
|
|
289
|
-
main: "electron.js",
|
|
290
|
-
author: npmConfig.author,
|
|
291
|
-
license: npmConfig.license,
|
|
292
|
-
// devDependencies: {
|
|
293
|
-
// "electron": electronVersion.replace("^", "")
|
|
294
|
-
// },
|
|
295
|
-
dependencies: {
|
|
296
|
-
// "dotenv": dotenvVersion,
|
|
297
|
-
// ...remoteVersion !== undefined ? {
|
|
298
|
-
// "@electron/remote": remoteVersion
|
|
299
|
-
// } : {},
|
|
300
|
-
...extModules.filter((item) => item.exists).map((item) => item.name)
|
|
301
|
-
.toObject((item) => item, () => "*")
|
|
302
|
-
},
|
|
303
|
-
...this._config.builder.electron.postinstall !== undefined ? {
|
|
304
|
-
"scripts": {
|
|
305
|
-
postinstall: this._config.builder.electron.postinstall
|
|
306
|
-
}
|
|
307
|
-
} : {}
|
|
308
|
-
}, { space: 2 });
|
|
309
|
-
await FsUtil.writeFileAsync(path.resolve(electronSrcPath, "yarn.lock"), "");
|
|
310
|
-
|
|
311
|
-
await FsUtil.writeFileAsync(path.resolve(electronSrcPath, `.env`), [
|
|
312
|
-
"NODE_ENV=production",
|
|
313
|
-
`SD_VERSION=${npmConfig.version}`,
|
|
314
|
-
(this._config.builder.electron.icon !== undefined) ? `SD_ELECTRON_ICON=${this._config.builder.electron.icon}` : `SD_ELECTRON_ICON=favicon.ico`,
|
|
315
|
-
...(this._config.env !== undefined) ? Object.keys(this._config.env).map((key) => `${key}=${this._config.env![key]}`) : [],
|
|
316
|
-
...(this._config.builder.electron.env !== undefined) ? Object.keys(this._config.builder.electron.env).map((key) => `${key}=${this._config.builder!.electron!.env![key]}`) : []
|
|
317
|
-
].filterExists().join("\n"));
|
|
318
|
-
|
|
319
|
-
/*let electronTsFileContent = await FsUtil.readFileAsync(path.resolve(this._rootPath, `src/electron.ts`));
|
|
320
|
-
electronTsFileContent = "require(\"dotenv\").config({ path: `${__dirname}\\\\.env` });\n" + electronTsFileContent;
|
|
321
|
-
const result = ts.transpileModule(electronTsFileContent, { compilerOptions: { module: ts.ModuleKind.CommonJS } });
|
|
322
|
-
await FsUtil.writeFileAsync(path.resolve(electronSrcPath, "electron.js"), result.outputText);*/
|
|
323
|
-
|
|
324
|
-
await electronBuilder.build({
|
|
325
|
-
targets: electronBuilder.Platform.WINDOWS.createTarget(),
|
|
326
|
-
config: {
|
|
327
|
-
appId: this._config.builder.electron.appId,
|
|
328
|
-
productName: npmConfig.description,
|
|
329
|
-
// asar: false,
|
|
330
|
-
win: {
|
|
331
|
-
target: "nsis"
|
|
332
|
-
},
|
|
333
|
-
nsis: {},
|
|
334
|
-
directories: {
|
|
335
|
-
app: electronSrcPath,
|
|
336
|
-
output: electronDistPath
|
|
337
|
-
},
|
|
338
|
-
...this._config.builder.electron.installerIcon !== undefined ? {
|
|
339
|
-
icon: path.resolve(this._rootPath, "src", this._config.builder.electron.installerIcon)
|
|
340
|
-
} : {},
|
|
341
|
-
removePackageScripts: false
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
await FsUtil.copyAsync(
|
|
346
|
-
path.resolve(this._rootPath, `.cache/electron/dist/${npmConfig.description} Setup ${npmConfig.version}.exe`),
|
|
347
|
-
path.resolve(this._parsedTsconfig.options.outDir!, `electron/${npmConfig.description}-latest.exe`)
|
|
348
|
-
);
|
|
349
|
-
|
|
350
|
-
await FsUtil.copyAsync(
|
|
351
|
-
path.resolve(this._rootPath, `.cache/electron/dist/${npmConfig.description} Setup ${npmConfig.version}.exe`),
|
|
352
|
-
path.resolve(this._parsedTsconfig.options.outDir!, `electron/updates/${npmConfig.version}.exe`)
|
|
353
|
-
);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
// 마무리
|
|
357
|
-
this._logger.debug("Webpack 빌드 완료");
|
|
358
|
-
return buildResults;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
private _getInternalModuleCachePaths(projName: string): string[] {
|
|
362
|
-
return [
|
|
363
|
-
...FsUtil.findAllParentChildDirPaths("node_modules/*/package.json", this._rootPath, this._projRootPath),
|
|
364
|
-
...FsUtil.findAllParentChildDirPaths(`node_modules/!(@simplysm|@${projName})/*/package.json`, this._rootPath, this._projRootPath),
|
|
365
|
-
].map((p) => path.dirname(p));
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
private async _getWebpackConfigAsync(watch: boolean, builderType: "web" | "cordova" | "electron", extModules: { name: string; exists: boolean }[]): Promise<webpack.Configuration> {
|
|
369
|
-
const projNpmConfig = this._getNpmConfig(this._projRootPath)!;
|
|
370
|
-
const projName = projNpmConfig.name;
|
|
371
|
-
|
|
372
|
-
const internalModuleCachePaths = watch ? this._getInternalModuleCachePaths(projName) : undefined;
|
|
373
|
-
|
|
374
|
-
const npmConfig = this._getNpmConfig(this._rootPath)!;
|
|
375
|
-
|
|
376
|
-
const projPkgLockContent = FsUtil.readFile(path.resolve(this._projRootPath, "yarn.lock"));
|
|
377
|
-
|
|
378
|
-
const pkgKey = npmConfig.name.split("/").last()!;
|
|
379
|
-
const publicPath = builderType === "web" ? `/${pkgKey}/` : watch ? `/${pkgKey}/${builderType}/` : ``;
|
|
380
|
-
|
|
381
|
-
const distPath = (builderType === "cordova" && !watch) ? path.resolve(this._cordova!.cordovaPath, "www")
|
|
382
|
-
: (builderType === "electron" && !watch) ? path.resolve(this._rootPath, ".cache/electron/src")
|
|
383
|
-
: builderType === "web" ? this._parsedTsconfig.options.outDir
|
|
384
|
-
: `${this._parsedTsconfig.options.outDir}/${builderType}`;
|
|
385
|
-
|
|
386
|
-
const sassImplementation = new SassWorkerImplementation();
|
|
387
|
-
|
|
388
|
-
const mainFilePath = path.resolve(this._rootPath, "src/main.ts");
|
|
389
|
-
const polyfillsFilePath = path.resolve(this._rootPath, "src/polyfills.ts");
|
|
390
|
-
const stylesFilePath = path.resolve(this._rootPath, "src/styles.scss");
|
|
391
|
-
|
|
392
|
-
const versionHash = createHash("sha1")
|
|
393
|
-
.update(projPkgLockContent)
|
|
394
|
-
.update(JSON.stringify(this._parsedTsconfig.options))
|
|
395
|
-
.update(JSON.stringify(this._config))
|
|
396
|
-
.update(watch.toString())
|
|
397
|
-
.digest("hex");
|
|
398
|
-
if (
|
|
399
|
-
!FsUtil.exists(path.resolve(this._cacheBasePath, "version")) // 버전파일이 없거나
|
|
400
|
-
|| (
|
|
401
|
-
FsUtil.exists(path.resolve(this._cacheBasePath, "version")) &&
|
|
402
|
-
FsUtil.readFile(path.resolve(this._cacheBasePath, "version")) !== versionHash
|
|
403
|
-
) // 버전이 현재 버전과 다르면
|
|
404
|
-
) {
|
|
405
|
-
// 캐시 삭제
|
|
406
|
-
FsUtil.remove(path.resolve(this._cacheBasePath));
|
|
407
|
-
}
|
|
408
|
-
// 버전쓰기
|
|
409
|
-
FsUtil.writeFile(path.resolve(this._cacheBasePath, "version"), versionHash);
|
|
410
|
-
|
|
411
|
-
let prevProgressMessage = "";
|
|
412
|
-
return {
|
|
413
|
-
mode: watch ? "development" : "production",
|
|
414
|
-
devtool: false,
|
|
415
|
-
target: builderType === "electron" ? ["electron-renderer", "electron-main", "es2015"] : ["web", "es2015"],
|
|
416
|
-
profile: false,
|
|
417
|
-
resolve: {
|
|
418
|
-
roots: [this._rootPath],
|
|
419
|
-
extensions: [".ts", ".tsx", ".mjs", ".cjs", ".js", ".jsx"],
|
|
420
|
-
symlinks: true,
|
|
421
|
-
modules: [this._projRootPath, "node_modules"],
|
|
422
|
-
mainFields: ["es2020", "es2015", "browser", "module", "main"],
|
|
423
|
-
conditionNames: ["es2020", "es2015", "..."]
|
|
424
|
-
},
|
|
425
|
-
resolveLoader: {
|
|
426
|
-
symlinks: true
|
|
427
|
-
},
|
|
428
|
-
context: this._projRootPath,
|
|
429
|
-
entry: {
|
|
430
|
-
main: [mainFilePath],
|
|
431
|
-
...FsUtil.exists(polyfillsFilePath) ? { polyfills: [polyfillsFilePath] } : {},
|
|
432
|
-
...FsUtil.exists(stylesFilePath) ? { styles: [stylesFilePath] } : {},
|
|
433
|
-
...builderType === "cordova" ? { "cordova-entry": path.resolve(path.dirname(fileURLToPath(import.meta.url)), `../../lib/cordova-entry.js`) } : {},
|
|
434
|
-
...builderType === "electron" ? { "electron": path.resolve(this._rootPath, "src/electron.ts") } : {}
|
|
435
|
-
},
|
|
436
|
-
output: {
|
|
437
|
-
uniqueName: pkgKey,
|
|
438
|
-
hashFunction: "xxhash64",
|
|
439
|
-
clean: true,
|
|
440
|
-
path: distPath,
|
|
441
|
-
publicPath,
|
|
442
|
-
filename: "[name].js",
|
|
443
|
-
chunkFilename: "[name].js",
|
|
444
|
-
libraryTarget: undefined,
|
|
445
|
-
crossOriginLoading: false,
|
|
446
|
-
trustedTypes: "angular#bundler",
|
|
447
|
-
scriptType: "module"
|
|
448
|
-
},
|
|
449
|
-
watch: false,
|
|
450
|
-
watchOptions: {
|
|
451
|
-
poll: undefined,
|
|
452
|
-
ignored: undefined
|
|
453
|
-
},
|
|
454
|
-
performance: { hints: false },
|
|
455
|
-
ignoreWarnings: [
|
|
456
|
-
/Failed to parse source map from/,
|
|
457
|
-
/Add postcss as project dependency/,
|
|
458
|
-
/"@charset" must be the first rule in the file/
|
|
459
|
-
],
|
|
460
|
-
experiments: {
|
|
461
|
-
backCompat: false,
|
|
462
|
-
syncWebAssembly: true,
|
|
463
|
-
asyncWebAssembly: true
|
|
464
|
-
},
|
|
465
|
-
infrastructureLogging: { level: "error" },
|
|
466
|
-
stats: "errors-warnings",
|
|
467
|
-
// externals: extModules.toObject((item) => item.name, (item) => item.exists ? "commonjs2 " + item.name : `var {name: '${item.name}'}`),
|
|
468
|
-
externals: {
|
|
469
|
-
...extModules.toObject((item) => item.name, (item) => "commonjs2 " + item.name),
|
|
470
|
-
...builderType === "electron" ? {
|
|
471
|
-
"electron": "commonjs2 electron"
|
|
472
|
-
} : {}
|
|
473
|
-
},
|
|
474
|
-
cache: {
|
|
475
|
-
type: "filesystem",
|
|
476
|
-
profile: undefined,
|
|
477
|
-
cacheDirectory: this._cacheBasePath,
|
|
478
|
-
maxMemoryGenerations: 1,
|
|
479
|
-
name: "webpack"
|
|
480
|
-
},
|
|
481
|
-
snapshot: {
|
|
482
|
-
immutablePaths: internalModuleCachePaths,
|
|
483
|
-
managedPaths: internalModuleCachePaths
|
|
484
|
-
},
|
|
485
|
-
node: false,
|
|
486
|
-
optimization: {
|
|
487
|
-
minimizer: watch ? [] : [
|
|
488
|
-
new JavaScriptOptimizerPlugin({
|
|
489
|
-
define: {
|
|
490
|
-
ngDevMode: false,
|
|
491
|
-
ngI18nClosureMode: false,
|
|
492
|
-
ngJitMode: false
|
|
493
|
-
},
|
|
494
|
-
sourcemap: false,
|
|
495
|
-
target: ts.ScriptTarget.ES2017,
|
|
496
|
-
keepIdentifierNames: true,
|
|
497
|
-
keepNames: true,
|
|
498
|
-
removeLicenses: true,
|
|
499
|
-
advanced: true
|
|
500
|
-
}),
|
|
501
|
-
new TransferSizePlugin(),
|
|
502
|
-
new CssOptimizerPlugin({
|
|
503
|
-
supportedBrowsers: browserslist([
|
|
504
|
-
"last 1 Chrome versions",
|
|
505
|
-
"last 2 Edge major versions"
|
|
506
|
-
], { path: this._projRootPath })
|
|
507
|
-
})
|
|
508
|
-
] as any[],
|
|
509
|
-
moduleIds: "deterministic",
|
|
510
|
-
chunkIds: watch ? "named" : "deterministic",
|
|
511
|
-
emitOnErrors: watch,
|
|
512
|
-
runtimeChunk: "single",
|
|
513
|
-
splitChunks: {
|
|
514
|
-
maxAsyncRequests: Infinity,
|
|
515
|
-
cacheGroups: {
|
|
516
|
-
default: {
|
|
517
|
-
chunks: "async",
|
|
518
|
-
minChunks: 2,
|
|
519
|
-
priority: 10
|
|
520
|
-
},
|
|
521
|
-
common: {
|
|
522
|
-
name: "common",
|
|
523
|
-
chunks: "async",
|
|
524
|
-
minChunks: 2,
|
|
525
|
-
enforce: true,
|
|
526
|
-
priority: 5
|
|
527
|
-
},
|
|
528
|
-
vendors: false,
|
|
529
|
-
defaultVendors: false,
|
|
530
|
-
/*defaultVendors: watch ? {
|
|
531
|
-
name: "vendor",
|
|
532
|
-
chunks: (chunk) => chunk.name === "main",
|
|
533
|
-
enforce: true,
|
|
534
|
-
test: /[\\/]node_modules[\\/]/
|
|
535
|
-
} : false*/
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
},
|
|
539
|
-
module: {
|
|
540
|
-
strictExportPresence: true,
|
|
541
|
-
parser: { javascript: { url: false, worker: false } },
|
|
542
|
-
rules: [
|
|
543
|
-
{
|
|
544
|
-
test: /\.?(svg|html)$/,
|
|
545
|
-
resourceQuery: /\?ngResource/,
|
|
546
|
-
type: "asset/source"
|
|
547
|
-
},
|
|
548
|
-
{
|
|
549
|
-
test: /[/\\]rxjs[/\\]add[/\\].+\.js$/,
|
|
550
|
-
sideEffects: true
|
|
551
|
-
},
|
|
552
|
-
{
|
|
553
|
-
test: /\.[cm]?[tj]sx?$/,
|
|
554
|
-
resolve: { fullySpecified: false },
|
|
555
|
-
exclude: [/[/\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill)[/\\]/],
|
|
556
|
-
use: [
|
|
557
|
-
{
|
|
558
|
-
loader: fileURLToPath(await import.meta.resolve!("@angular-devkit/build-angular/src/babel/webpack-loader")),
|
|
559
|
-
options: {
|
|
560
|
-
cacheDirectory: path.resolve(this._cacheBasePath, "webpack-babel"),
|
|
561
|
-
scriptTarget: ts.ScriptTarget.ES2017,
|
|
562
|
-
aot: true,
|
|
563
|
-
optimize: !watch,
|
|
564
|
-
instrumentCode: undefined
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
]
|
|
568
|
-
},
|
|
569
|
-
...watch ? [
|
|
570
|
-
{
|
|
571
|
-
test: /\.[cm]?jsx?$/,
|
|
572
|
-
enforce: "pre" as const,
|
|
573
|
-
loader: fileURLToPath(await import.meta.resolve!("source-map-loader")),
|
|
574
|
-
options: {
|
|
575
|
-
filterSourceMappingUrl: (mapUri: string, resourcePath: string) => {
|
|
576
|
-
const projRegex = new RegExp(`node_modules[\\\\/]@${projName}[\\\\/]`);
|
|
577
|
-
return !resourcePath.includes("node_modules")
|
|
578
|
-
|| (/node_modules[\\/]@simplysm[\\/]/).test(resourcePath)
|
|
579
|
-
|| projRegex.test(resourcePath);
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
] : [],
|
|
584
|
-
{
|
|
585
|
-
test: /\.[cm]?tsx?$/,
|
|
586
|
-
loader: fileURLToPath(await import.meta.resolve!("@ngtools/webpack")),
|
|
587
|
-
exclude: [/[/\\](?:css-loader|mini-css-extract-plugin|webpack)[/\\]/]
|
|
588
|
-
},
|
|
589
|
-
{
|
|
590
|
-
test: /\.css$/i,
|
|
591
|
-
type: "asset/source"
|
|
592
|
-
},
|
|
593
|
-
{
|
|
594
|
-
test: /\.scss$/i,
|
|
595
|
-
rules: [
|
|
596
|
-
{
|
|
597
|
-
oneOf: [
|
|
598
|
-
{
|
|
599
|
-
use: [
|
|
600
|
-
{
|
|
601
|
-
loader: MiniCssExtractPlugin.loader
|
|
602
|
-
},
|
|
603
|
-
{
|
|
604
|
-
loader: fileURLToPath(await import.meta.resolve!("css-loader")),
|
|
605
|
-
options: { url: false, sourceMap: watch }
|
|
606
|
-
}
|
|
607
|
-
],
|
|
608
|
-
include: [stylesFilePath],
|
|
609
|
-
resourceQuery: { not: [/\?ngResource/] }
|
|
610
|
-
},
|
|
611
|
-
{
|
|
612
|
-
type: "asset/source",
|
|
613
|
-
resourceQuery: /\?ngResource/
|
|
614
|
-
}
|
|
615
|
-
]
|
|
616
|
-
},
|
|
617
|
-
{
|
|
618
|
-
use: [
|
|
619
|
-
{
|
|
620
|
-
loader: fileURLToPath(await import.meta.resolve!("resolve-url-loader")),
|
|
621
|
-
options: { sourceMap: watch }
|
|
622
|
-
},
|
|
623
|
-
{
|
|
624
|
-
loader: fileURLToPath(await import.meta.resolve!("sass-loader")),
|
|
625
|
-
options: {
|
|
626
|
-
implementation: sassImplementation,
|
|
627
|
-
sourceMap: true,
|
|
628
|
-
sassOptions: {
|
|
629
|
-
fiber: false,
|
|
630
|
-
precision: 8,
|
|
631
|
-
includePaths: [],
|
|
632
|
-
outputStyle: "expanded",
|
|
633
|
-
quietDeps: true,
|
|
634
|
-
verbose: watch ? undefined : false
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
]
|
|
639
|
-
}
|
|
640
|
-
]
|
|
641
|
-
},
|
|
642
|
-
{
|
|
643
|
-
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico|otf|csv|xlsx?|pptx?|docx?|zip|pfx|pkl)$/,
|
|
644
|
-
type: "asset/resource"
|
|
645
|
-
}
|
|
646
|
-
]
|
|
647
|
-
},
|
|
648
|
-
plugins: [
|
|
649
|
-
new NodePolyfillPlugin({
|
|
650
|
-
excludeAliases: builderType === "electron" ? ["process"] : []
|
|
651
|
-
}),
|
|
652
|
-
new NamedChunksPlugin(),
|
|
653
|
-
new DedupeModuleResolvePlugin(),
|
|
654
|
-
new webpack.ProgressPlugin({
|
|
655
|
-
handler: (per: number, msg: string, ...args: string[]) => {
|
|
656
|
-
const phaseText = msg ? ` - phase: ${msg}` : "";
|
|
657
|
-
const argsText = args.length > 0 ? ` - args: [${args.join(", ")}]` : "";
|
|
658
|
-
const progressMessage = `Webpack 빌드 수행중...(${Math.round(per * 100)}%)${phaseText}${argsText}`;
|
|
659
|
-
if (progressMessage !== prevProgressMessage) {
|
|
660
|
-
prevProgressMessage = progressMessage;
|
|
661
|
-
this._logger.debug(progressMessage);
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
}),
|
|
665
|
-
...watch ? [] : [
|
|
666
|
-
new LicenseWebpackPlugin({
|
|
667
|
-
stats: { warnings: false, errors: false },
|
|
668
|
-
perChunkOutput: false,
|
|
669
|
-
outputFilename: "3rdpartylicenses.txt",
|
|
670
|
-
skipChildCompilers: true
|
|
671
|
-
})
|
|
672
|
-
],
|
|
673
|
-
new CopyWebpackPlugin({
|
|
674
|
-
patterns: [
|
|
675
|
-
...["favicon.ico", "assets/", "manifest.json"].map((item) => ({
|
|
676
|
-
context: this._rootPath,
|
|
677
|
-
to: item,
|
|
678
|
-
from: `src/${item}`,
|
|
679
|
-
noErrorOnMissing: true,
|
|
680
|
-
force: true,
|
|
681
|
-
globOptions: {
|
|
682
|
-
dot: true,
|
|
683
|
-
followSymbolicLinks: false,
|
|
684
|
-
ignore: [
|
|
685
|
-
".gitkeep",
|
|
686
|
-
"**/.DS_Store",
|
|
687
|
-
"**/Thumbs.db"
|
|
688
|
-
].map((i) => PathUtil.posix(this._rootPath, i))
|
|
689
|
-
},
|
|
690
|
-
priority: 0
|
|
691
|
-
})),
|
|
692
|
-
...builderType === "cordova" && watch ? this._cordova!.platforms.mapMany((platform) => [
|
|
693
|
-
{
|
|
694
|
-
context: this._cordova!.cordovaPath,
|
|
695
|
-
to: `cordova-${platform}/plugins`,
|
|
696
|
-
from: `platforms/${platform}/platform_www/plugins`,
|
|
697
|
-
noErrorOnMissing: true
|
|
698
|
-
},
|
|
699
|
-
{
|
|
700
|
-
context: this._cordova!.cordovaPath,
|
|
701
|
-
to: `cordova-${platform}/cordova.js`,
|
|
702
|
-
from: `platforms/${platform}/platform_www/cordova.js`
|
|
703
|
-
},
|
|
704
|
-
{
|
|
705
|
-
context: this._cordova!.cordovaPath,
|
|
706
|
-
to: `cordova-${platform}/cordova_plugins.js`,
|
|
707
|
-
from: `platforms/${platform}/platform_www/cordova_plugins.js`,
|
|
708
|
-
noErrorOnMissing: true
|
|
709
|
-
},
|
|
710
|
-
{
|
|
711
|
-
context: this._cordova!.cordovaPath,
|
|
712
|
-
to: `cordova-${platform}/config.xml`,
|
|
713
|
-
from: `platforms/${platform}/www/config.xml`,
|
|
714
|
-
noErrorOnMissing: true
|
|
715
|
-
}
|
|
716
|
-
]) : []
|
|
717
|
-
]
|
|
718
|
-
}),
|
|
719
|
-
...watch ? [
|
|
720
|
-
new webpack.SourceMapDevToolPlugin({
|
|
721
|
-
filename: "[file].map",
|
|
722
|
-
include: [/js$/, /css$/],
|
|
723
|
-
sourceRoot: "webpack:///",
|
|
724
|
-
moduleFilenameTemplate: "[resource-path]",
|
|
725
|
-
append: undefined
|
|
726
|
-
})
|
|
727
|
-
] : [],
|
|
728
|
-
new AngularWebpackPlugin({
|
|
729
|
-
tsconfig: this._tsconfigFilePath,
|
|
730
|
-
compilerOptions: {
|
|
731
|
-
sourceMap: watch,
|
|
732
|
-
declaration: false,
|
|
733
|
-
declarationMap: false,
|
|
734
|
-
preserveSymlinks: false
|
|
735
|
-
},
|
|
736
|
-
jitMode: false,
|
|
737
|
-
emitNgModuleScope: watch,
|
|
738
|
-
inlineStyleFileExtension: "scss"
|
|
739
|
-
}),
|
|
740
|
-
{
|
|
741
|
-
apply: (compiler: webpack.Compiler) => {
|
|
742
|
-
compiler.hooks.shutdown.tap("sass-worker", () => {
|
|
743
|
-
sassImplementation.close();
|
|
744
|
-
});
|
|
745
|
-
}
|
|
746
|
-
},
|
|
747
|
-
new MiniCssExtractPlugin({ filename: "[name].css" }),
|
|
748
|
-
new SuppressExtractedTextChunksWebpackPlugin(),
|
|
749
|
-
new IndexHtmlWebpackPlugin({
|
|
750
|
-
indexPath: path.resolve(this._rootPath, "src/index.html"),
|
|
751
|
-
outputPath: "index.html",
|
|
752
|
-
baseHref: publicPath,
|
|
753
|
-
entrypoints: [
|
|
754
|
-
["runtime", !watch],
|
|
755
|
-
["polyfills", true],
|
|
756
|
-
["styles", false],
|
|
757
|
-
// ["vendor", true],
|
|
758
|
-
["main", true],
|
|
759
|
-
...builderType === "cordova" ? [
|
|
760
|
-
["cordova-entry", true] as Entrypoint
|
|
761
|
-
] : []
|
|
762
|
-
],
|
|
763
|
-
deployUrl: undefined,
|
|
764
|
-
sri: false,
|
|
765
|
-
cache: {
|
|
766
|
-
enabled: true,
|
|
767
|
-
basePath: this._cacheBasePath,
|
|
768
|
-
path: path.resolve(this._cacheBasePath, "webpack-html")
|
|
769
|
-
},
|
|
770
|
-
postTransform: undefined,
|
|
771
|
-
optimization: {
|
|
772
|
-
scripts: !watch,
|
|
773
|
-
styles: { minify: !watch, inlineCritical: !watch },
|
|
774
|
-
fonts: { inline: !watch }
|
|
775
|
-
},
|
|
776
|
-
crossOrigin: "none",
|
|
777
|
-
lang: undefined
|
|
778
|
-
}),
|
|
779
|
-
new webpack.EnvironmentPlugin({
|
|
780
|
-
SD_VERSION: this._getNpmConfig(this._rootPath)!.version,
|
|
781
|
-
...this._config.env,
|
|
782
|
-
...this._config.builder?.[builderType]?.env
|
|
783
|
-
}),
|
|
784
|
-
|
|
785
|
-
new ESLintWebpackPlugin({
|
|
786
|
-
context: this._rootPath,
|
|
787
|
-
eslintPath: path.resolve(this._projRootPath, "node_modules", "eslint"),
|
|
788
|
-
exclude: ["node_modules"],
|
|
789
|
-
extensions: ["ts", "js", "mjs", "cjs"],
|
|
790
|
-
fix: false,
|
|
791
|
-
threads: false,
|
|
792
|
-
formatter: (results: LintResult[]) => {
|
|
793
|
-
const resultMessages: string[] = [];
|
|
794
|
-
for (const result of results) {
|
|
795
|
-
for (const msg of result.messages) {
|
|
796
|
-
const severity = msg.severity === 1 ? "warning" : msg.severity === 2 ? "error" : undefined;
|
|
797
|
-
if (severity === undefined) continue;
|
|
798
|
-
|
|
799
|
-
resultMessages.push(SdCliBuildResultUtil.getMessage({
|
|
800
|
-
filePath: result.filePath,
|
|
801
|
-
line: msg.line,
|
|
802
|
-
char: msg.column,
|
|
803
|
-
code: msg.ruleId?.toString(),
|
|
804
|
-
severity,
|
|
805
|
-
message: msg.message
|
|
806
|
-
}));
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
return resultMessages.join(os.EOL);
|
|
810
|
-
}
|
|
811
|
-
})
|
|
812
|
-
] as any[]
|
|
813
|
-
};
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
private _getExternalModules(): { name: string; exists: boolean }[] {
|
|
817
|
-
const loadedModuleNames: string[] = [];
|
|
818
|
-
const results: { name: string; exists: boolean }[] = [];
|
|
819
|
-
|
|
820
|
-
const fn = (currPath: string): void => {
|
|
821
|
-
const npmConfig = this._getNpmConfig(currPath);
|
|
822
|
-
if (!npmConfig) return;
|
|
823
|
-
|
|
824
|
-
const deps = SdCliNpmConfigUtil.getDependencies(npmConfig);
|
|
825
|
-
|
|
826
|
-
for (const moduleName of deps.defaults) {
|
|
827
|
-
if (loadedModuleNames.includes(moduleName)) continue;
|
|
828
|
-
loadedModuleNames.push(moduleName);
|
|
829
|
-
|
|
830
|
-
const modulePath = FsUtil.findAllParentChildDirPaths("node_modules/" + moduleName, currPath, this._projRootPath).first();
|
|
831
|
-
if (StringUtil.isNullOrEmpty(modulePath)) {
|
|
832
|
-
continue;
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
if (FsUtil.glob(path.resolve(modulePath, "**/binding.gyp")).length > 0) {
|
|
836
|
-
results.push({ name: moduleName, exists: true });
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
if (this._config.builder?.electron?.externalNodeModules?.includes(moduleName)) {
|
|
840
|
-
results.push({ name: moduleName, exists: true });
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
fn(modulePath);
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
for (const optModuleName of deps.optionals) {
|
|
847
|
-
if (loadedModuleNames.includes(optModuleName)) continue;
|
|
848
|
-
loadedModuleNames.push(optModuleName);
|
|
849
|
-
|
|
850
|
-
const optModulePath = FsUtil.findAllParentChildDirPaths("node_modules/" + optModuleName, currPath, this._projRootPath).first();
|
|
851
|
-
if (StringUtil.isNullOrEmpty(optModulePath)) {
|
|
852
|
-
results.push({ name: optModuleName, exists: false });
|
|
853
|
-
continue;
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
if (FsUtil.glob(path.resolve(optModulePath, "**/binding.gyp")).length > 0) {
|
|
857
|
-
results.push({ name: optModuleName, exists: true });
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
if (this._config.builder?.electron?.externalNodeModules?.includes(optModuleName)) {
|
|
861
|
-
results.push({ name: optModuleName, exists: true });
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
fn(optModulePath);
|
|
865
|
-
}
|
|
866
|
-
};
|
|
867
|
-
|
|
868
|
-
fn(this._rootPath);
|
|
869
|
-
|
|
870
|
-
return results;
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
private _getNpmConfig(pkgPath: string): INpmConfig | undefined {
|
|
874
|
-
if (!this._npmConfigMap.has(pkgPath)) {
|
|
875
|
-
this._npmConfigMap.set(pkgPath, FsUtil.readJson(path.resolve(pkgPath, "package.json")));
|
|
876
|
-
}
|
|
877
|
-
return this._npmConfigMap.get(pkgPath);
|
|
878
|
-
}
|
|
879
|
-
}
|