@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,79 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { PathUtil } from "@simplysm/sd-core-node";
|
|
3
|
-
|
|
4
|
-
export class SdCliCacheCompilerHost {
|
|
5
|
-
public static create(parsedTsconfig: ts.ParsedCommandLine,
|
|
6
|
-
moduleResolutionCache: ts.ModuleResolutionCache,
|
|
7
|
-
sourceFileCache: Map<string, IFileCache>,
|
|
8
|
-
outputFileCache: Map<string, string>): ts.CompilerHost {
|
|
9
|
-
const compilerHost = ts.createIncrementalCompilerHost(parsedTsconfig.options);
|
|
10
|
-
|
|
11
|
-
const cacheCompilerHost = { ...compilerHost };
|
|
12
|
-
|
|
13
|
-
cacheCompilerHost.fileExists = (fileName: string) => {
|
|
14
|
-
const cache = sourceFileCache.getOrCreate(PathUtil.posix(fileName), {});
|
|
15
|
-
if (cache.exists === undefined) {
|
|
16
|
-
cache.exists = compilerHost.fileExists.call(cacheCompilerHost, fileName);
|
|
17
|
-
}
|
|
18
|
-
return cache.exists;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
cacheCompilerHost.getSourceFile = (fileName: string, languageVersion: ts.ScriptTarget) => {
|
|
22
|
-
const cache = sourceFileCache.getOrCreate(PathUtil.posix(fileName), {});
|
|
23
|
-
if (!cache.sourceFile) {
|
|
24
|
-
cache.sourceFile = compilerHost.getSourceFile.call(cacheCompilerHost, fileName, languageVersion);
|
|
25
|
-
}
|
|
26
|
-
return cache.sourceFile;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
cacheCompilerHost.writeFile = (fileName: string,
|
|
30
|
-
data: string,
|
|
31
|
-
writeByteOrderMark: boolean,
|
|
32
|
-
onError?: (message: string) => void,
|
|
33
|
-
sourceFiles?: readonly ts.SourceFile[]) => {
|
|
34
|
-
if (parsedTsconfig.options.module === ts.ModuleKind.CommonJS) {
|
|
35
|
-
fileName = fileName.replace(/\.js(\.map)?$/, ".cjs$1");
|
|
36
|
-
data = data.replace(/\.js\.map$/, ".cjs.map");
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
fileName = fileName.replace(/\.js(\.map)?$/, ".mjs$1");
|
|
40
|
-
data = data.replace(/\.js\.map$/, ".mjs.map");
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const writeCache = outputFileCache.get(PathUtil.posix(fileName));
|
|
45
|
-
if (writeCache !== data) {
|
|
46
|
-
outputFileCache.set(PathUtil.posix(fileName), data);
|
|
47
|
-
compilerHost.writeFile.call(cacheCompilerHost, fileName, data, writeByteOrderMark, onError, sourceFiles);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
cacheCompilerHost.readFile = (fileName: string) => {
|
|
52
|
-
const cache = sourceFileCache.getOrCreate(PathUtil.posix(fileName), {});
|
|
53
|
-
if (cache.content === undefined) {
|
|
54
|
-
cache.content = compilerHost.readFile.call(cacheCompilerHost, fileName);
|
|
55
|
-
}
|
|
56
|
-
return cache.content;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
cacheCompilerHost.resolveModuleNames = (moduleNames: string[], containingFile: string) => {
|
|
60
|
-
return moduleNames.map((moduleName) => {
|
|
61
|
-
return ts.resolveModuleName(
|
|
62
|
-
moduleName,
|
|
63
|
-
PathUtil.posix(containingFile),
|
|
64
|
-
parsedTsconfig.options,
|
|
65
|
-
compilerHost,
|
|
66
|
-
moduleResolutionCache
|
|
67
|
-
).resolvedModule;
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return cacheCompilerHost;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
interface IFileCache {
|
|
76
|
-
exists?: boolean;
|
|
77
|
-
sourceFile?: ts.SourceFile;
|
|
78
|
-
content?: string;
|
|
79
|
-
}
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
import { INpmConfig, ISdCliClientBuilderCordovaConfig } from "../commons";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
import { FsUtil, Logger, SdProcess } from "@simplysm/sd-core-node";
|
|
4
|
-
import xml2js from "xml2js";
|
|
5
|
-
|
|
6
|
-
export class SdCliCordova {
|
|
7
|
-
protected readonly _logger: Logger;
|
|
8
|
-
|
|
9
|
-
private readonly _npmConfig: INpmConfig;
|
|
10
|
-
|
|
11
|
-
public readonly cordovaPath = path.resolve(this._rootPath, ".cache", "cordova");
|
|
12
|
-
private readonly _binPath = path.resolve(process.cwd(), "node_modules/.bin/cordova.cmd");
|
|
13
|
-
|
|
14
|
-
public get platforms(): ("browser" | "android")[] {
|
|
15
|
-
return [
|
|
16
|
-
...this._config.target?.browser ? ["browser" as const] : [],
|
|
17
|
-
...this._config.target?.android ? ["android" as const] : []
|
|
18
|
-
];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public constructor(private readonly _rootPath: string, private readonly _config: ISdCliClientBuilderCordovaConfig) {
|
|
22
|
-
this._npmConfig = FsUtil.readJson(path.resolve(this._rootPath, "package.json"));
|
|
23
|
-
this._logger = Logger.get(["simplysm", "sd-cli", this.constructor.name, this._npmConfig.name]);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
private async _execAsync(cmd: string, cwd: string): Promise<void> {
|
|
27
|
-
this._logger.debug(cmd);
|
|
28
|
-
const msg = await SdProcess.spawnAsync(cmd, { cwd });
|
|
29
|
-
this._logger.debug(msg);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
public async initializeAsync(): Promise<void> {
|
|
33
|
-
if (FsUtil.exists(this.cordovaPath)) {
|
|
34
|
-
this._logger.log("이미 생성되어있는 '.cordova'를 사용합니다.");
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
await this._execAsync(`${this._binPath} telemetry on`, this._rootPath);
|
|
38
|
-
|
|
39
|
-
// 프로젝트 생성
|
|
40
|
-
await this._execAsync(`${this._binPath} create "${this.cordovaPath}" "${this._config.appId}" "${this._config.appName}"`, process.cwd());
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// platforms 폴더 혹시 없으면 생성
|
|
44
|
-
await FsUtil.mkdirsAsync(path.resolve(this.cordovaPath, "platforms"));
|
|
45
|
-
|
|
46
|
-
// www 폴더 혹시 없으면 생성
|
|
47
|
-
await FsUtil.mkdirsAsync(path.resolve(this.cordovaPath, "www"));
|
|
48
|
-
|
|
49
|
-
// 미설치 빌드 플랫폼 신규 생성
|
|
50
|
-
const alreadyPlatforms = await FsUtil.readdirAsync(path.resolve(this.cordovaPath, "platforms"));
|
|
51
|
-
for (const platform of this.platforms) {
|
|
52
|
-
if (!alreadyPlatforms.includes(platform)) {
|
|
53
|
-
await this._execAsync(`${this._binPath} platform add ${platform}`, this.cordovaPath);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// 설치 미빌드 플랫폼 삭제
|
|
58
|
-
for (const alreadyPlatform of alreadyPlatforms) {
|
|
59
|
-
if (this._config.target?.[alreadyPlatform] == null) {
|
|
60
|
-
await this._execAsync(`${this._binPath} platform remove ${alreadyPlatform}`, this.cordovaPath);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// 설치된 미사용 플러그인 삭제
|
|
65
|
-
const pluginsFetch = FsUtil.exists(path.resolve(this.cordovaPath, "plugins/fetch.json"))
|
|
66
|
-
? await FsUtil.readJsonAsync(path.resolve(this.cordovaPath, "plugins/fetch.json"))
|
|
67
|
-
: undefined;
|
|
68
|
-
const alreadyPluginIds = pluginsFetch != undefined
|
|
69
|
-
? Object.values(pluginsFetch)
|
|
70
|
-
.map((item: any) => (item.source.id !== undefined ? item.source.id : item.source.url))
|
|
71
|
-
: [];
|
|
72
|
-
const usePlugins = ["cordova-plugin-ionic-webview", ...this._config.plugins ?? []].distinct();
|
|
73
|
-
|
|
74
|
-
for (const alreadyPluginId of alreadyPluginIds) {
|
|
75
|
-
let hasPlugin = false;
|
|
76
|
-
for (const usePlugin of usePlugins) {
|
|
77
|
-
if (
|
|
78
|
-
(usePlugin.includes("@") && alreadyPluginId === usePlugin) ||
|
|
79
|
-
(!usePlugin.includes("@") && alreadyPluginId.replace(/@.*$/, "") === usePlugin)
|
|
80
|
-
) {
|
|
81
|
-
hasPlugin = true;
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (!hasPlugin) {
|
|
87
|
-
await this._execAsync(`${this._binPath} plugin remove ${alreadyPluginId.replace(/@.*$/, "")}`, this.cordovaPath);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// 미설치 플러그인들 설치
|
|
92
|
-
for (const usePlugin of usePlugins) {
|
|
93
|
-
if (
|
|
94
|
-
(usePlugin.includes("@") && !alreadyPluginIds.includes(usePlugin)) ||
|
|
95
|
-
(!usePlugin.includes("@") && !alreadyPluginIds.map((alreadyPluginId) => alreadyPluginId.replace(/@.*$/, "")).includes(usePlugin))
|
|
96
|
-
) {
|
|
97
|
-
await this._execAsync(`${this._binPath} plugin add ${usePlugin}`, this.cordovaPath);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// ANDROID SIGN 파일 복사
|
|
102
|
-
if (this._config.target?.android?.sign) {
|
|
103
|
-
await FsUtil.copyAsync(
|
|
104
|
-
path.resolve(this._rootPath, this._config.target.android.sign.keystore),
|
|
105
|
-
path.resolve(this.cordovaPath, "android.keystore")
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
await FsUtil.removeAsync(path.resolve(this.cordovaPath, "android.keystore"));
|
|
110
|
-
// SIGN을 안쓸경우 아래 파일이 생성되어 있으면 오류남
|
|
111
|
-
await FsUtil.removeAsync(path.resolve(this.cordovaPath, "platforms/android/release-signing.properties"));
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// 빌드 옵션 파일 생성
|
|
115
|
-
await FsUtil.writeJsonAsync(
|
|
116
|
-
path.resolve(this.cordovaPath, "build.json"),
|
|
117
|
-
{
|
|
118
|
-
...this._config.target?.android ? {
|
|
119
|
-
android: {
|
|
120
|
-
release: {
|
|
121
|
-
packageType: this._config.target.android.bundle ? "bundle" : "apk",
|
|
122
|
-
...this._config.target.android.sign ? {
|
|
123
|
-
keystore: path.resolve(this.cordovaPath, "android.keystore"),
|
|
124
|
-
storePassword: this._config.target.android.sign.storePassword,
|
|
125
|
-
alias: this._config.target.android.sign.alias,
|
|
126
|
-
password: this._config.target.android.sign.password,
|
|
127
|
-
keystoreType: this._config.target.android.sign.keystoreType
|
|
128
|
-
} : {}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
} : {}
|
|
132
|
-
}
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
// ICON 파일 복사
|
|
136
|
-
if (this._config.icon !== undefined) {
|
|
137
|
-
await FsUtil.copyAsync(path.resolve(this._rootPath, this._config.icon), path.resolve(this.cordovaPath, "res", "icon.png"));
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
await FsUtil.removeAsync(path.resolve(this.cordovaPath, "res", "icon.png"));
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// CONFIG: 초기값 백업
|
|
144
|
-
const configFilePath = path.resolve(this.cordovaPath, "config.xml");
|
|
145
|
-
const configBackFilePath = path.resolve(this.cordovaPath, "config.xml.bak");
|
|
146
|
-
if (!FsUtil.exists(configBackFilePath)) {
|
|
147
|
-
await FsUtil.copyAsync(configFilePath, configBackFilePath);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// CONFIG: 초기값 읽기
|
|
151
|
-
const configFileContent = await FsUtil.readFileAsync(configBackFilePath);
|
|
152
|
-
const configXml = await xml2js.parseStringPromise(configFileContent);
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
// CONFIG: 버전 설정
|
|
156
|
-
configXml.widget.$.version = this._npmConfig.version;
|
|
157
|
-
|
|
158
|
-
// CONFIG: ICON 설정
|
|
159
|
-
if (this._config.icon !== undefined) {
|
|
160
|
-
configXml["widget"]["icon"] = [{ "$": { "src": "res/icon.png" } }];
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// CONFIG: 접근허용 세팅
|
|
164
|
-
configXml["widget"]["access"] = [{ "$": { "origin": "*" } }];
|
|
165
|
-
configXml["widget"]["allow-navigation"] = [{ "$": { "href": "*" } }];
|
|
166
|
-
configXml["widget"]["allow-intent"] = [{ "$": { "href": "*" } }];
|
|
167
|
-
configXml["widget"]["preference"] = [{ "$": { "name": "MixedContentMode", "value": "0" } }];
|
|
168
|
-
|
|
169
|
-
// CONFIG: ANDROID usesCleartextTraffic 설정
|
|
170
|
-
if (this._config.target?.android) {
|
|
171
|
-
configXml.widget.$["xmlns:android"] = "http://schemas.android.com/apk/res/android";
|
|
172
|
-
|
|
173
|
-
configXml["widget"]["platform"] = configXml["widget"]["platform"] ?? [];
|
|
174
|
-
configXml["widget"]["platform"].push({
|
|
175
|
-
"$": {
|
|
176
|
-
"name": "android"
|
|
177
|
-
},
|
|
178
|
-
"edit-config": [{
|
|
179
|
-
"$": {
|
|
180
|
-
"file": "app/src/main/AndroidManifest.xml",
|
|
181
|
-
"mode": "merge",
|
|
182
|
-
"target": "/manifest/application"
|
|
183
|
-
},
|
|
184
|
-
"application": [{
|
|
185
|
-
"$": {
|
|
186
|
-
"android:usesCleartextTraffic": "true"
|
|
187
|
-
}
|
|
188
|
-
}]
|
|
189
|
-
}]
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// CONFIG: 파일 새로 쓰기
|
|
194
|
-
const configResultContent = new xml2js.Builder().buildObject(configXml);
|
|
195
|
-
await FsUtil.writeFileAsync(configFilePath, configResultContent);
|
|
196
|
-
|
|
197
|
-
// 각 플랫폼 www 준비
|
|
198
|
-
await this._execAsync(`${this._binPath} prepare`, this.cordovaPath);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
public async buildAsync(outPath: string): Promise<void> {
|
|
202
|
-
// 실행
|
|
203
|
-
const buildType = this._config.debug ? "debug" : "release";
|
|
204
|
-
for (const platform of this.platforms) {
|
|
205
|
-
await this._execAsync(`${this._binPath} build ${platform} --${buildType}`, this.cordovaPath);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// 결과물 복사: ANDROID
|
|
209
|
-
if (this._config.target?.android) {
|
|
210
|
-
const targetOutPath = path.resolve(outPath, "android");
|
|
211
|
-
const apkFileName = this._config.target.android.sign ? `app-${buildType}.apk` : `app-${buildType}-unsigned.apk`;
|
|
212
|
-
// const distApkFileName = path.basename(`${this._config.appName}${this._config.target.android.sign ? "" : "-unsigned"}-v${this._npmConfig.version}.apk`);
|
|
213
|
-
const latestDistApkFileName = path.basename(`${this._config.appName}${this._config.target.android.sign ? "" : "-unsigned"}-latest.apk`);
|
|
214
|
-
await FsUtil.mkdirsAsync(targetOutPath);
|
|
215
|
-
// await FsUtil.copyAsync(
|
|
216
|
-
// path.resolve(this.cordovaPath, "platforms/android/app/build/outputs/apk", buildType, apkFileName),
|
|
217
|
-
// path.resolve(targetOutPath, distApkFileName)
|
|
218
|
-
// );
|
|
219
|
-
await FsUtil.copyAsync(
|
|
220
|
-
path.resolve(this.cordovaPath, "platforms/android/app/build/outputs/apk", buildType, apkFileName),
|
|
221
|
-
path.resolve(targetOutPath, latestDistApkFileName)
|
|
222
|
-
);
|
|
223
|
-
// 자동업데이트를 위한 파일 쓰기
|
|
224
|
-
await FsUtil.copyAsync(
|
|
225
|
-
path.resolve(this.cordovaPath, "platforms/android/app/build/outputs/apk", buildType, apkFileName),
|
|
226
|
-
path.resolve(path.resolve(targetOutPath, "updates"), this._npmConfig.version + ".apk")
|
|
227
|
-
);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/*if (this._config.target?.android) {
|
|
231
|
-
// 자동업데이트를 위한 zip 파일 쓰기
|
|
232
|
-
const zip = new JSZip();
|
|
233
|
-
const resultFiles = await FsUtil.globAsync(path.resolve(this.cordovaPath, "platforms", "android", "app", "src", "main", "assets", "www", "**!/!*"), {
|
|
234
|
-
dot: true,
|
|
235
|
-
nodir: true
|
|
236
|
-
});
|
|
237
|
-
for (const resultFile of resultFiles) {
|
|
238
|
-
const contentBuffer = await FsUtil.readFileBufferAsync(resultFile);
|
|
239
|
-
const relativePath = path.relative(path.resolve(this.cordovaPath, "platforms", "android", "app", "src", "main", "assets", "www"), resultFile);
|
|
240
|
-
zip.file("/" + relativePath, contentBuffer);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
const zipFileName = path.basename(`${this._npmConfig.version}.zip`);
|
|
244
|
-
const resultBuffer = await zip.generateAsync({ type: "nodebuffer" });
|
|
245
|
-
|
|
246
|
-
await FsUtil.writeFileAsync(path.resolve(outPath, "android/updates/", zipFileName), resultBuffer);
|
|
247
|
-
}*/
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
public static async runWebviewOnDeviceAsync(rootPath: string, platform: "browser" | "android", pkgName: string, url?: string): Promise<void> {
|
|
251
|
-
const cordovaPath = path.resolve(rootPath, `packages/${pkgName}/.cache/cordova/`);
|
|
252
|
-
|
|
253
|
-
if (url !== undefined) {
|
|
254
|
-
await FsUtil.removeAsync(path.resolve(cordovaPath, "www"));
|
|
255
|
-
await FsUtil.mkdirsAsync(path.resolve(cordovaPath, "www"));
|
|
256
|
-
await FsUtil.writeFileAsync(path.resolve(cordovaPath, "www/index.html"), `'${url}'로 이동중... <script>setTimeout(function () {window.location.href = "${url.replace(/\/$/, "")}/${pkgName}/cordova/"}, 3000);</script>`.trim());
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
const binPath = path.resolve(process.cwd(), "node_modules/.bin/cordova.cmd");
|
|
260
|
-
// await SdProcess.spawnAsync(`${binPath} build ${platform}`, { cwd: cordovaPath }, true);
|
|
261
|
-
await SdProcess.spawnAsync(`${binPath} run ${platform} --device`, { cwd: cordovaPath }, true);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { FsUtil, Logger, SdProcess } from "@simplysm/sd-core-node";
|
|
2
|
-
import { INpmConfig, ISdCliClientPackageConfig } from "../commons";
|
|
3
|
-
import path from "path";
|
|
4
|
-
import { SdCliConfigUtil } from "../utils/SdCliConfigUtil";
|
|
5
|
-
|
|
6
|
-
export class SdCliElectron {
|
|
7
|
-
private readonly _logger = Logger.get(["simplysm", "sd-cli", this.constructor.name]);
|
|
8
|
-
|
|
9
|
-
public constructor(private readonly _rootPath: string) {
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
public async runWebviewOnDeviceAsync(pkgName: string, url: string, opt: { confFileRelPath: string; optNames: string[] }): Promise<void> {
|
|
13
|
-
this._logger.debug("프로젝트 설정 가져오기...");
|
|
14
|
-
const config = await SdCliConfigUtil.loadConfigAsync(path.resolve(this._rootPath, opt.confFileRelPath), true, opt.optNames);
|
|
15
|
-
const pkgConfig = config.packages[pkgName] as ISdCliClientPackageConfig | undefined;
|
|
16
|
-
if (!pkgConfig) throw new Error("패키지 설정을 찾을 수 없습니다.");
|
|
17
|
-
|
|
18
|
-
const electronConfig = pkgConfig.builder?.electron;
|
|
19
|
-
if (!electronConfig) throw new Error("ELECTRON 설정을 찾을 수 없습니다.");
|
|
20
|
-
|
|
21
|
-
const pkgRootPath = path.resolve(this._rootPath, `packages/${pkgName}`);
|
|
22
|
-
const electronSrcPath = path.resolve(pkgRootPath, `dist/electron`);
|
|
23
|
-
|
|
24
|
-
// await FsUtil.removeAsync(electronSrcPath);
|
|
25
|
-
|
|
26
|
-
const npmConfig = (await FsUtil.readJsonAsync(path.resolve(pkgRootPath, `package.json`))) as INpmConfig;
|
|
27
|
-
const electronVersion = npmConfig.dependencies?.["electron"];
|
|
28
|
-
if (electronVersion === undefined) {
|
|
29
|
-
throw new Error("ELECTRON 빌드 패키지의 'dependencies'에는 'electron'이 반드시 포함되어야 합니다.");
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const dotenvVersion = npmConfig.dependencies?.["dotenv"];
|
|
33
|
-
if (dotenvVersion === undefined) {
|
|
34
|
-
throw new Error("ELECTRON 빌드 패키지의 'dependencies'에는 'dotenv'가 반드시 포함되어야 합니다.");
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// const remoteVersion = npmConfig.dependencies?.["@electron/remote"];
|
|
38
|
-
|
|
39
|
-
await FsUtil.writeJsonAsync(path.resolve(electronSrcPath, `package.json`), {
|
|
40
|
-
name: npmConfig.name,
|
|
41
|
-
version: npmConfig.version,
|
|
42
|
-
description: npmConfig.description,
|
|
43
|
-
main: "electron.js",
|
|
44
|
-
author: npmConfig.author,
|
|
45
|
-
license: npmConfig.license,
|
|
46
|
-
/*,
|
|
47
|
-
devDependencies: {
|
|
48
|
-
"electron": electronVersion.replace("^", "")
|
|
49
|
-
},
|
|
50
|
-
dependencies: {
|
|
51
|
-
"dotenv": dotenvVersion,
|
|
52
|
-
...remoteVersion !== undefined ? {
|
|
53
|
-
"@electron/remote": remoteVersion
|
|
54
|
-
} : {}
|
|
55
|
-
}*/
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
// await FsUtil.copyAsync(path.resolve(pkgRootPath, "dist", "electron"), path.resolve(electronSrcPath));
|
|
59
|
-
|
|
60
|
-
// if (FsUtil.exists(path.resolve(pkgRootPath, "src/favicon.ico"))) {
|
|
61
|
-
// await FsUtil.copyAsync(path.resolve(pkgRootPath, "src/favicon.ico"), path.resolve(electronSrcPath, "favicon.ico"));
|
|
62
|
-
// }
|
|
63
|
-
// if (FsUtil.exists(path.resolve(pkgRootPath, "src/assets"))) {
|
|
64
|
-
// await FsUtil.copyAsync(path.resolve(pkgRootPath, "src/assets"), path.resolve(electronSrcPath, "assets"));
|
|
65
|
-
// }
|
|
66
|
-
|
|
67
|
-
await FsUtil.writeFileAsync(path.resolve(electronSrcPath, `.env`), [
|
|
68
|
-
"NODE_ENV=development",
|
|
69
|
-
`SD_TITLE=${npmConfig.description}`,
|
|
70
|
-
`SD_VERSION=${npmConfig.version}`,
|
|
71
|
-
`SD_ELECTRON_DEV_URL=${url.replace(/\/$/, "")}/${pkgName}/electron/`,
|
|
72
|
-
(electronConfig.icon !== undefined) ? `SD_ELECTRON_ICON=${electronConfig.icon}` : `SD_ELECTRON_ICON=favicon.ico`,
|
|
73
|
-
...(pkgConfig.env !== undefined) ? Object.keys(pkgConfig.env).map((key) => `${key}=${pkgConfig.env![key]}`) : [],
|
|
74
|
-
...(electronConfig.env !== undefined) ? Object.keys(electronConfig.env).map((key) => `${key}=${electronConfig.env![key]}`) : [],
|
|
75
|
-
].filterExists().join("\n"));
|
|
76
|
-
|
|
77
|
-
// const electronTsFileContent = await FsUtil.readFileAsync(path.resolve(pkgRootPath, `src/electron.ts`));
|
|
78
|
-
// const result = ts.transpileModule(electronTsFileContent, { compilerOptions: { module: ts.ModuleKind.CommonJS } });
|
|
79
|
-
// await FsUtil.writeFileAsync(path.resolve(electronSrcPath, "electron.js"), result.outputText);
|
|
80
|
-
|
|
81
|
-
await SdProcess.spawnAsync("electron-rebuild", { cwd: pkgRootPath }, true);
|
|
82
|
-
|
|
83
|
-
await SdProcess.spawnAsync(`electron .`, { cwd: electronSrcPath }, true);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import https from "https";
|
|
2
|
-
import { SdProcess } from "@simplysm/sd-core-node";
|
|
3
|
-
import mime from "mime";
|
|
4
|
-
|
|
5
|
-
export class SdCliGithubApi {
|
|
6
|
-
public constructor(private readonly _apiKey: string,
|
|
7
|
-
private readonly _repoOwner: string,
|
|
8
|
-
private readonly _repoName: string) {
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
public async uploadAsync(version: string, files: { name: string; buffer: Buffer }[]): Promise<void> {
|
|
12
|
-
const releaseId = await this._createReleaseTagAsync(version);
|
|
13
|
-
|
|
14
|
-
for (const file of files) {
|
|
15
|
-
await this._uploadFileAsync(releaseId, file.name, file.buffer);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
private async _uploadFileAsync(releaseId: number, fileName: string, buffer: Buffer): Promise<void> {
|
|
20
|
-
const contentLength = buffer.length;
|
|
21
|
-
|
|
22
|
-
await new Promise<void>((resolve, reject) => {
|
|
23
|
-
const req = https.request(
|
|
24
|
-
`https://uploads.github.com/repos/${this._repoOwner}/${this._repoName}/releases/${releaseId}/assets?name=${fileName}&label=${fileName}`,
|
|
25
|
-
{
|
|
26
|
-
method: "POST",
|
|
27
|
-
headers: {
|
|
28
|
-
"Authorization": `token ${this._apiKey}`,
|
|
29
|
-
"Accept": "application/vnd.github.v3+json",
|
|
30
|
-
"User-Agent": "@simplysm/sd-cli:publish",
|
|
31
|
-
"Content-Length": contentLength,
|
|
32
|
-
"Content-Type": mime.getType(fileName)!
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
(res) => {
|
|
36
|
-
let dataBuffer = Buffer.from([]);
|
|
37
|
-
res.on("data", data => {
|
|
38
|
-
dataBuffer = Buffer.concat([dataBuffer, data]);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
res.on("end", () => {
|
|
42
|
-
if (res.statusCode !== 201) {
|
|
43
|
-
const errObj = JSON.parse(dataBuffer.toString());
|
|
44
|
-
throw new Error(errObj.message + "(" + errObj.documentation_url + ")");
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
resolve();
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
req.on("error", (error) => {
|
|
54
|
-
reject(error);
|
|
55
|
-
});
|
|
56
|
-
req.write(buffer);
|
|
57
|
-
req.end();
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
private async _createReleaseTagAsync(ver: string): Promise<number> {
|
|
62
|
-
const currentBranch = (await SdProcess.spawnAsync("git branch --show-current")).trim();
|
|
63
|
-
|
|
64
|
-
return await new Promise<number>((resolve, reject) => {
|
|
65
|
-
const req = https.request(
|
|
66
|
-
`https://api.github.com/repos/${this._repoOwner}/${this._repoName}/releases`,
|
|
67
|
-
{
|
|
68
|
-
method: "POST",
|
|
69
|
-
headers: {
|
|
70
|
-
"Authorization": `token ${this._apiKey}`,
|
|
71
|
-
"Accept": "application/vnd.github.v3+json",
|
|
72
|
-
"User-Agent": "@simplysm/sd-cli:publish"
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
(res) => {
|
|
76
|
-
let dataBuffer = Buffer.from([]);
|
|
77
|
-
res.on("data", data => {
|
|
78
|
-
dataBuffer = Buffer.concat([dataBuffer, data]);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
res.on("end", () => {
|
|
82
|
-
if (res.statusCode !== 201) {
|
|
83
|
-
const errObj = JSON.parse(dataBuffer.toString());
|
|
84
|
-
throw new Error(errObj.message + "(" + errObj.documentation_url + ")");
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
// console.log(JSON.parse(dataBuffer.toString()));
|
|
88
|
-
const resData = JSON.parse(dataBuffer.toString());
|
|
89
|
-
resolve(resData.id);
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
req.on("error", (error) => {
|
|
96
|
-
reject(error);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
req.write(JSON.stringify({
|
|
100
|
-
tag_name: `v${ver}`,
|
|
101
|
-
target_commitish: currentBranch,
|
|
102
|
-
name: `v${ver}`,
|
|
103
|
-
body: `v${ver}`,
|
|
104
|
-
draft: false,
|
|
105
|
-
prerelease: false
|
|
106
|
-
}));
|
|
107
|
-
|
|
108
|
-
req.end();
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { ITsconfig } from "../commons";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { FsUtil, PathUtil } from "@simplysm/sd-core-node";
|
|
4
|
-
import chokidar from "chokidar";
|
|
5
|
-
|
|
6
|
-
export class SdCliIndexFileGenerator {
|
|
7
|
-
private readonly _indexFilePath = path.resolve(this.rootPath, "src/index.ts");
|
|
8
|
-
private _contentCache: string | undefined;
|
|
9
|
-
|
|
10
|
-
public constructor(public readonly rootPath: string,
|
|
11
|
-
public readonly config: ISdAutoIndexConfig) {
|
|
12
|
-
this._contentCache = FsUtil.exists(this._indexFilePath) ? FsUtil.readFile(this._indexFilePath) : undefined;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
public async watchAsync(): Promise<void> {
|
|
16
|
-
const watcher = chokidar.watch([path.resolve(this.rootPath, "src")], { persistent: true });
|
|
17
|
-
watcher.on("add", async (filePath) => {
|
|
18
|
-
if (filePath.endsWith(".ts")) {
|
|
19
|
-
await this.runAsync();
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
watcher.on("unlink", async (filePath) => {
|
|
23
|
-
if (filePath.endsWith(".ts")) {
|
|
24
|
-
await this.runAsync();
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
await this.runAsync();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public async runAsync(): Promise<void> {
|
|
32
|
-
const importTexts: string[] = [];
|
|
33
|
-
|
|
34
|
-
// 옵션의 polyfills 를 모두 import
|
|
35
|
-
if (this.config.polyfills) {
|
|
36
|
-
for (const polyfill of this.config.polyfills) {
|
|
37
|
-
importTexts.push(`import "${polyfill}";`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// 내부 파일들 import
|
|
42
|
-
const filePaths = await this._getFilePathsAsync();
|
|
43
|
-
for (const filePath of filePaths) {
|
|
44
|
-
const requirePath = PathUtil.posix(path.relative(path.dirname(this._indexFilePath), filePath))
|
|
45
|
-
.replace(/\.ts$/, "")
|
|
46
|
-
.replace(/\/index$/, "");
|
|
47
|
-
|
|
48
|
-
const sourceTsFileContent = await FsUtil.readFileAsync(filePath);
|
|
49
|
-
if (sourceTsFileContent.split("\n").some((line) => line.startsWith("export "))) {
|
|
50
|
-
importTexts.push(`export * from "./${requirePath}";`);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
importTexts.push(`import "./${requirePath}";`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const content = importTexts.join("\n") + "\n";
|
|
58
|
-
const prevContent = this._contentCache;
|
|
59
|
-
this._contentCache = content;
|
|
60
|
-
if (content.trim() !== prevContent?.trim()) {
|
|
61
|
-
await FsUtil.writeFileAsync(this._indexFilePath, content);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
private async _getFilePathsAsync(): Promise<string[]> {
|
|
66
|
-
const tsconfig: ITsconfig = await FsUtil.readJsonAsync(path.resolve(this.rootPath, "tsconfig.json"));
|
|
67
|
-
const entryFilePaths = tsconfig.files?.map((item) => path.resolve(this.rootPath, item)) ?? [];
|
|
68
|
-
|
|
69
|
-
return (await FsUtil.globAsync(path.resolve(this.rootPath, "src/**/*.ts"), { nodir: true }))
|
|
70
|
-
.filter((item) => (
|
|
71
|
-
!entryFilePaths.includes(item)
|
|
72
|
-
&& item !== this._indexFilePath
|
|
73
|
-
));
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface ISdAutoIndexConfig {
|
|
78
|
-
polyfills?: string[];
|
|
79
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { PathUtil } from "@simplysm/sd-core-node";
|
|
3
|
-
import * as sass from "sass";
|
|
4
|
-
import { fileURLToPath, pathToFileURL, URL } from "url";
|
|
5
|
-
|
|
6
|
-
export class SdCliNgCacheCompilerHost {
|
|
7
|
-
public static wrap(compilerHost: ts.CompilerHost,
|
|
8
|
-
sourceFileCache: Map<string, IFileCache>): ts.CompilerHost {
|
|
9
|
-
const cacheCompilerHost = { ...compilerHost };
|
|
10
|
-
|
|
11
|
-
cacheCompilerHost["readResource"] = (fileName: string) => {
|
|
12
|
-
const cache = sourceFileCache.getOrCreate(PathUtil.posix(fileName), {});
|
|
13
|
-
if (cache.content === undefined) {
|
|
14
|
-
cache.content = compilerHost.readFile.call(cacheCompilerHost, fileName);
|
|
15
|
-
}
|
|
16
|
-
return cache.content;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
cacheCompilerHost["transformResource"] = async (data, context) => {
|
|
20
|
-
if (context.resourceFile != null || context.type !== "style") {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const cache = sourceFileCache.getOrCreate(PathUtil.posix(context.containingFile), {});
|
|
25
|
-
if (cache.styleContent === undefined) {
|
|
26
|
-
const scssResult = await sass.compileStringAsync(data, {
|
|
27
|
-
url: new URL((context.containingFile as string) + ".sd.scss"),
|
|
28
|
-
importer: {
|
|
29
|
-
findFileUrl: (url) => {
|
|
30
|
-
if (!url.startsWith("~")) return pathToFileURL(url);
|
|
31
|
-
return new URL(url.substring(1), pathToFileURL("node_modules"));
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
cache.styleContent = scssResult.css.toString();
|
|
37
|
-
|
|
38
|
-
const deps = scssResult.loadedUrls.slice(1).map((item) => PathUtil.posix(fileURLToPath(item.href)));
|
|
39
|
-
for (const dep of deps) {
|
|
40
|
-
const depCache = sourceFileCache.getOrCreate(dep, {});
|
|
41
|
-
depCache.importerSet = depCache.importerSet ?? new Set<string>();
|
|
42
|
-
depCache.importerSet.add(PathUtil.posix(context.containingFile));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return { content: cache.styleContent };
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
return cacheCompilerHost;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
interface IFileCache {
|
|
53
|
-
exists?: boolean;
|
|
54
|
-
sourceFile?: ts.SourceFile;
|
|
55
|
-
content?: string;
|
|
56
|
-
styleContent?: string;
|
|
57
|
-
importerSet?: Set<string>;
|
|
58
|
-
}
|