@microsoft/teamsfx-core 0.7.0 → 0.7.1-alpha.5e8f6dea.0
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/build/common/constants.d.ts +5 -0
- package/build/common/constants.d.ts.map +1 -1
- package/build/common/constants.js +6 -1
- package/build/common/constants.js.map +1 -1
- package/build/common/fileUtils.d.ts.map +1 -1
- package/build/common/fileUtils.js +12 -6
- package/build/common/fileUtils.js.map +1 -1
- package/build/common/localSettingsProvider.d.ts +4 -2
- package/build/common/localSettingsProvider.d.ts.map +1 -1
- package/build/common/localSettingsProvider.js +32 -1
- package/build/common/localSettingsProvider.js.map +1 -1
- package/build/common/templates.d.ts.map +1 -1
- package/build/common/templates.js +9 -9
- package/build/common/templates.js.map +1 -1
- package/build/common/templatesActions.d.ts +39 -0
- package/build/common/templatesActions.d.ts.map +1 -0
- package/build/common/templatesActions.js +120 -0
- package/build/common/templatesActions.js.map +1 -0
- package/build/common/templatesUtils.d.ts +14 -0
- package/build/common/templatesUtils.d.ts.map +1 -0
- package/build/common/templatesUtils.js +94 -0
- package/build/common/templatesUtils.js.map +1 -0
- package/build/common/tools.d.ts +12 -2
- package/build/common/tools.d.ts.map +1 -1
- package/build/common/tools.js +52 -7
- package/build/common/tools.js.map +1 -1
- package/build/core/SolutionPluginContainer.d.ts +15 -0
- package/build/core/SolutionPluginContainer.d.ts.map +1 -0
- package/build/core/SolutionPluginContainer.js +54 -0
- package/build/core/SolutionPluginContainer.js.map +1 -0
- package/build/core/callback.d.ts +9 -0
- package/build/core/callback.d.ts.map +1 -0
- package/build/core/callback.js +33 -0
- package/build/core/callback.js.map +1 -0
- package/build/core/environment.d.ts +7 -3
- package/build/core/environment.d.ts.map +1 -1
- package/build/core/environment.js +68 -13
- package/build/core/environment.js.map +1 -1
- package/build/core/error.d.ts +19 -2
- package/build/core/error.d.ts.map +1 -1
- package/build/core/error.js +72 -34
- package/build/core/error.js.map +1 -1
- package/build/core/index.d.ts +24 -12
- package/build/core/index.d.ts.map +1 -1
- package/build/core/index.js +604 -309
- package/build/core/index.js.map +1 -1
- package/build/core/middleware/concurrentLocker.d.ts.map +1 -1
- package/build/core/middleware/concurrentLocker.js +13 -6
- package/build/core/middleware/concurrentLocker.js.map +1 -1
- package/build/core/middleware/contextInjector.d.ts +3 -0
- package/build/core/middleware/contextInjector.d.ts.map +1 -0
- package/build/core/middleware/{contextInjecter.js → contextInjector.js} +4 -4
- package/build/core/middleware/contextInjector.js.map +1 -0
- package/build/core/middleware/envInfoLoader.d.ts +8 -4
- package/build/core/middleware/envInfoLoader.d.ts.map +1 -1
- package/build/core/middleware/envInfoLoader.js +77 -40
- package/build/core/middleware/envInfoLoader.js.map +1 -1
- package/build/core/middleware/envInfoWriter.d.ts +1 -1
- package/build/core/middleware/envInfoWriter.d.ts.map +1 -1
- package/build/core/middleware/envInfoWriter.js +30 -13
- package/build/core/middleware/envInfoWriter.js.map +1 -1
- package/build/core/middleware/localSettingsLoader.d.ts.map +1 -1
- package/build/core/middleware/localSettingsLoader.js +18 -8
- package/build/core/middleware/localSettingsLoader.js.map +1 -1
- package/build/core/middleware/localSettingsWriter.d.ts.map +1 -1
- package/build/core/middleware/localSettingsWriter.js +14 -5
- package/build/core/middleware/localSettingsWriter.js.map +1 -1
- package/build/core/middleware/projectMigrator.d.ts +5 -0
- package/build/core/middleware/projectMigrator.d.ts.map +1 -0
- package/build/core/middleware/projectMigrator.js +382 -0
- package/build/core/middleware/projectMigrator.js.map +1 -0
- package/build/core/middleware/projectSettingsLoader.d.ts +2 -2
- package/build/core/middleware/projectSettingsLoader.d.ts.map +1 -1
- package/build/core/middleware/projectSettingsLoader.js +13 -9
- package/build/core/middleware/projectSettingsLoader.js.map +1 -1
- package/build/core/middleware/projectSettingsWriter.d.ts.map +1 -1
- package/build/core/middleware/projectSettingsWriter.js +6 -7
- package/build/core/middleware/projectSettingsWriter.js.map +1 -1
- package/build/core/middleware/projectUpgrader.d.ts.map +1 -1
- package/build/core/middleware/projectUpgrader.js +15 -7
- package/build/core/middleware/projectUpgrader.js.map +1 -1
- package/build/core/middleware/questionModel.d.ts.map +1 -1
- package/build/core/middleware/questionModel.js +25 -17
- package/build/core/middleware/questionModel.js.map +1 -1
- package/build/core/middleware/solutionLoader.d.ts +1 -2
- package/build/core/middleware/solutionLoader.d.ts.map +1 -1
- package/build/core/middleware/solutionLoader.js +24 -4
- package/build/core/middleware/solutionLoader.js.map +1 -1
- package/build/core/question.d.ts +2 -0
- package/build/core/question.d.ts.map +1 -1
- package/build/core/question.js +12 -1
- package/build/core/question.js.map +1 -1
- package/build/core/tools.d.ts +2 -2
- package/build/core/tools.d.ts.map +1 -1
- package/build/core/tools.js +15 -5
- package/build/core/tools.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/plugins/resource/aad/appStudio.js +1 -1
- package/build/plugins/resource/aad/appStudio.js.map +1 -1
- package/build/plugins/resource/aad/errors.d.ts.map +1 -1
- package/build/plugins/resource/aad/errors.js +1 -0
- package/build/plugins/resource/aad/errors.js.map +1 -1
- package/build/plugins/resource/aad/index.d.ts +1 -0
- package/build/plugins/resource/aad/index.d.ts.map +1 -1
- package/build/plugins/resource/aad/index.js +2 -1
- package/build/plugins/resource/aad/index.js.map +1 -1
- package/build/plugins/resource/aad/utils/configs.d.ts.map +1 -1
- package/build/plugins/resource/aad/utils/configs.js +9 -10
- package/build/plugins/resource/aad/utils/configs.js.map +1 -1
- package/build/plugins/resource/aad/utils/telemetry.js +1 -1
- package/build/plugins/resource/aad/utils/telemetry.js.map +1 -1
- package/build/plugins/resource/aad/v2/index.d.ts +7 -7
- package/build/plugins/resource/aad/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/aad/v2/index.js +6 -6
- package/build/plugins/resource/aad/v2/index.js.map +1 -1
- package/build/plugins/resource/apim/config.d.ts +1 -0
- package/build/plugins/resource/apim/config.d.ts.map +1 -1
- package/build/plugins/resource/apim/config.js.map +1 -1
- package/build/plugins/resource/apim/constants.d.ts +3 -0
- package/build/plugins/resource/apim/constants.d.ts.map +1 -1
- package/build/plugins/resource/apim/constants.js +5 -1
- package/build/plugins/resource/apim/constants.js.map +1 -1
- package/build/plugins/resource/apim/factory.d.ts +2 -1
- package/build/plugins/resource/apim/factory.d.ts.map +1 -1
- package/build/plugins/resource/apim/factory.js +19 -8
- package/build/plugins/resource/apim/factory.js.map +1 -1
- package/build/plugins/resource/apim/index.d.ts +2 -0
- package/build/plugins/resource/apim/index.d.ts.map +1 -1
- package/build/plugins/resource/apim/index.js +15 -8
- package/build/plugins/resource/apim/index.js.map +1 -1
- package/build/plugins/resource/apim/questions/vscodeQuestion.js +1 -1
- package/build/plugins/resource/apim/questions/vscodeQuestion.js.map +1 -1
- package/build/plugins/resource/apim/v2/index.d.ts +9 -11
- package/build/plugins/resource/apim/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/apim/v2/index.js +25 -29
- package/build/plugins/resource/apim/v2/index.js.map +1 -1
- package/build/plugins/resource/appstudio/appStudio.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/appStudio.js +9 -8
- package/build/plugins/resource/appstudio/appStudio.js.map +1 -1
- package/build/plugins/resource/appstudio/constants.d.ts +6 -2
- package/build/plugins/resource/appstudio/constants.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/constants.js +124 -13
- package/build/plugins/resource/appstudio/constants.js.map +1 -1
- package/build/plugins/resource/appstudio/errors.d.ts +4 -0
- package/build/plugins/resource/appstudio/errors.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/errors.js +8 -0
- package/build/plugins/resource/appstudio/errors.js.map +1 -1
- package/build/plugins/resource/appstudio/index.d.ts +1 -0
- package/build/plugins/resource/appstudio/index.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/index.js +23 -5
- package/build/plugins/resource/appstudio/index.js.map +1 -1
- package/build/plugins/resource/appstudio/interfaces/IAppDefinition.d.ts +1 -0
- package/build/plugins/resource/appstudio/interfaces/IAppDefinition.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/plugin.d.ts +2 -1
- package/build/plugins/resource/appstudio/plugin.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/plugin.js +197 -68
- package/build/plugins/resource/appstudio/plugin.js.map +1 -1
- package/build/plugins/resource/appstudio/utils/telemetry.d.ts +2 -1
- package/build/plugins/resource/appstudio/utils/telemetry.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/utils/telemetry.js +17 -12
- package/build/plugins/resource/appstudio/utils/telemetry.js.map +1 -1
- package/build/plugins/resource/appstudio/v2/index.d.ts +10 -13
- package/build/plugins/resource/appstudio/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/v2/index.js +25 -20
- package/build/plugins/resource/appstudio/v2/index.js.map +1 -1
- package/build/plugins/resource/bot/appStudio/appStudio.js +2 -2
- package/build/plugins/resource/bot/appStudio/appStudio.js.map +1 -1
- package/build/plugins/resource/bot/configs/localDebugConfig.d.ts +1 -1
- package/build/plugins/resource/bot/configs/localDebugConfig.d.ts.map +1 -1
- package/build/plugins/resource/bot/configs/localDebugConfig.js +3 -3
- package/build/plugins/resource/bot/configs/localDebugConfig.js.map +1 -1
- package/build/plugins/resource/bot/configs/provisionConfig.js +21 -20
- package/build/plugins/resource/bot/configs/provisionConfig.js.map +1 -1
- package/build/plugins/resource/bot/configs/scaffoldConfig.d.ts +1 -3
- package/build/plugins/resource/bot/configs/scaffoldConfig.d.ts.map +1 -1
- package/build/plugins/resource/bot/configs/scaffoldConfig.js +9 -10
- package/build/plugins/resource/bot/configs/scaffoldConfig.js.map +1 -1
- package/build/plugins/resource/bot/configs/teamsBotConfig.d.ts.map +1 -1
- package/build/plugins/resource/bot/configs/teamsBotConfig.js +5 -5
- package/build/plugins/resource/bot/configs/teamsBotConfig.js.map +1 -1
- package/build/plugins/resource/bot/constants.d.ts +0 -2
- package/build/plugins/resource/bot/constants.d.ts.map +1 -1
- package/build/plugins/resource/bot/constants.js +2 -14
- package/build/plugins/resource/bot/constants.js.map +1 -1
- package/build/plugins/resource/bot/index.d.ts +2 -3
- package/build/plugins/resource/bot/index.d.ts.map +1 -1
- package/build/plugins/resource/bot/index.js +1 -7
- package/build/plugins/resource/bot/index.js.map +1 -1
- package/build/plugins/resource/bot/plugin.d.ts +1 -4
- package/build/plugins/resource/bot/plugin.d.ts.map +1 -1
- package/build/plugins/resource/bot/plugin.js +21 -80
- package/build/plugins/resource/bot/plugin.js.map +1 -1
- package/build/plugins/resource/bot/resources/messages.d.ts +0 -1
- package/build/plugins/resource/bot/resources/messages.d.ts.map +1 -1
- package/build/plugins/resource/bot/resources/messages.js +0 -1
- package/build/plugins/resource/bot/resources/messages.js.map +1 -1
- package/build/plugins/resource/bot/resources/strings.d.ts +1 -1
- package/build/plugins/resource/bot/resources/strings.d.ts.map +1 -1
- package/build/plugins/resource/bot/resources/strings.js +1 -1
- package/build/plugins/resource/bot/resources/strings.js.map +1 -1
- package/build/plugins/resource/bot/utils/telemetry-helper.d.ts.map +1 -1
- package/build/plugins/resource/bot/utils/telemetry-helper.js +1 -1
- package/build/plugins/resource/bot/utils/telemetry-helper.js.map +1 -1
- package/build/plugins/resource/bot/v2/index.d.ts +9 -13
- package/build/plugins/resource/bot/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/bot/v2/index.js +7 -7
- package/build/plugins/resource/bot/v2/index.js.map +1 -1
- package/build/plugins/resource/frontend/configs.d.ts +7 -2
- package/build/plugins/resource/frontend/configs.d.ts.map +1 -1
- package/build/plugins/resource/frontend/configs.js +49 -29
- package/build/plugins/resource/frontend/configs.js.map +1 -1
- package/build/plugins/resource/frontend/constants.d.ts +3 -2
- package/build/plugins/resource/frontend/constants.d.ts.map +1 -1
- package/build/plugins/resource/frontend/constants.js +4 -3
- package/build/plugins/resource/frontend/constants.js.map +1 -1
- package/build/plugins/resource/frontend/index.d.ts +1 -1
- package/build/plugins/resource/frontend/index.d.ts.map +1 -1
- package/build/plugins/resource/frontend/index.js +6 -5
- package/build/plugins/resource/frontend/index.js.map +1 -1
- package/build/plugins/resource/frontend/ops/deploy.d.ts.map +1 -1
- package/build/plugins/resource/frontend/ops/deploy.js +1 -0
- package/build/plugins/resource/frontend/ops/deploy.js.map +1 -1
- package/build/plugins/resource/frontend/plugin.d.ts +4 -1
- package/build/plugins/resource/frontend/plugin.d.ts.map +1 -1
- package/build/plugins/resource/frontend/plugin.js +32 -32
- package/build/plugins/resource/frontend/plugin.js.map +1 -1
- package/build/plugins/resource/frontend/resources/errors.d.ts +1 -1
- package/build/plugins/resource/frontend/resources/errors.d.ts.map +1 -1
- package/build/plugins/resource/frontend/resources/errors.js +5 -2
- package/build/plugins/resource/frontend/resources/errors.js.map +1 -1
- package/build/plugins/resource/frontend/utils/telemetry-helper.js +1 -1
- package/build/plugins/resource/frontend/utils/telemetry-helper.js.map +1 -1
- package/build/plugins/resource/frontend/v2/index.d.ts +6 -9
- package/build/plugins/resource/frontend/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/frontend/v2/index.js +5 -2
- package/build/plugins/resource/frontend/v2/index.js.map +1 -1
- package/build/plugins/resource/function/constants.d.ts +2 -6
- package/build/plugins/resource/function/constants.d.ts.map +1 -1
- package/build/plugins/resource/function/constants.js +3 -8
- package/build/plugins/resource/function/constants.js.map +1 -1
- package/build/plugins/resource/function/enums.d.ts +2 -0
- package/build/plugins/resource/function/enums.d.ts.map +1 -1
- package/build/plugins/resource/function/enums.js +2 -0
- package/build/plugins/resource/function/enums.js.map +1 -1
- package/build/plugins/resource/function/index.d.ts +1 -0
- package/build/plugins/resource/function/index.d.ts.map +1 -1
- package/build/plugins/resource/function/index.js +1 -0
- package/build/plugins/resource/function/index.js.map +1 -1
- package/build/plugins/resource/function/ops/deploy.d.ts +1 -1
- package/build/plugins/resource/function/ops/deploy.d.ts.map +1 -1
- package/build/plugins/resource/function/ops/deploy.js +13 -5
- package/build/plugins/resource/function/ops/deploy.js.map +1 -1
- package/build/plugins/resource/function/ops/scaffold.d.ts +4 -7
- package/build/plugins/resource/function/ops/scaffold.d.ts.map +1 -1
- package/build/plugins/resource/function/ops/scaffold.js +42 -40
- package/build/plugins/resource/function/ops/scaffold.js.map +1 -1
- package/build/plugins/resource/function/plugin.d.ts +4 -0
- package/build/plugins/resource/function/plugin.d.ts.map +1 -1
- package/build/plugins/resource/function/plugin.js +57 -41
- package/build/plugins/resource/function/plugin.js.map +1 -1
- package/build/plugins/resource/function/resources/errors.d.ts +2 -5
- package/build/plugins/resource/function/resources/errors.d.ts.map +1 -1
- package/build/plugins/resource/function/resources/errors.js +5 -13
- package/build/plugins/resource/function/resources/errors.js.map +1 -1
- package/build/plugins/resource/function/resources/message.d.ts +1 -0
- package/build/plugins/resource/function/resources/message.d.ts.map +1 -1
- package/build/plugins/resource/function/resources/message.js +1 -0
- package/build/plugins/resource/function/resources/message.js.map +1 -1
- package/build/plugins/resource/function/utils/telemetry-helper.js +1 -1
- package/build/plugins/resource/function/utils/telemetry-helper.js.map +1 -1
- package/build/plugins/resource/function/v2/index.d.ts +8 -11
- package/build/plugins/resource/function/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/function/v2/index.js +9 -17
- package/build/plugins/resource/function/v2/index.js.map +1 -1
- package/build/plugins/resource/identity/index.d.ts +1 -0
- package/build/plugins/resource/identity/index.d.ts.map +1 -1
- package/build/plugins/resource/identity/index.js +7 -9
- package/build/plugins/resource/identity/index.js.map +1 -1
- package/build/plugins/resource/identity/utils/contextUtils.js +1 -1
- package/build/plugins/resource/identity/utils/contextUtils.js.map +1 -1
- package/build/plugins/resource/identity/utils/telemetryUtil.d.ts.map +1 -1
- package/build/plugins/resource/identity/utils/telemetryUtil.js +1 -1
- package/build/plugins/resource/identity/utils/telemetryUtil.js.map +1 -1
- package/build/plugins/resource/identity/v2/index.d.ts +3 -3
- package/build/plugins/resource/identity/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/identity/v2/index.js +2 -2
- package/build/plugins/resource/identity/v2/index.js.map +1 -1
- package/build/plugins/resource/localdebug/constants.d.ts +4 -0
- package/build/plugins/resource/localdebug/constants.d.ts.map +1 -1
- package/build/plugins/resource/localdebug/constants.js +6 -1
- package/build/plugins/resource/localdebug/constants.js.map +1 -1
- package/build/plugins/resource/localdebug/index.d.ts +1 -0
- package/build/plugins/resource/localdebug/index.d.ts.map +1 -1
- package/build/plugins/resource/localdebug/index.js +12 -6
- package/build/plugins/resource/localdebug/index.js.map +1 -1
- package/build/plugins/resource/localdebug/launch.d.ts +1 -0
- package/build/plugins/resource/localdebug/launch.d.ts.map +1 -1
- package/build/plugins/resource/localdebug/launch.js +66 -1
- package/build/plugins/resource/localdebug/launch.js.map +1 -1
- package/build/plugins/resource/localdebug/legacyPlugin.js +4 -4
- package/build/plugins/resource/localdebug/legacyPlugin.js.map +1 -1
- package/build/plugins/resource/localdebug/tasks.d.ts.map +1 -1
- package/build/plugins/resource/localdebug/tasks.js +12 -2
- package/build/plugins/resource/localdebug/tasks.js.map +1 -1
- package/build/plugins/resource/localdebug/util/telemetry.js +1 -1
- package/build/plugins/resource/localdebug/util/telemetry.js.map +1 -1
- package/build/plugins/resource/localdebug/v2/index.d.ts +6 -8
- package/build/plugins/resource/localdebug/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/localdebug/v2/index.js +2 -2
- package/build/plugins/resource/localdebug/v2/index.js.map +1 -1
- package/build/plugins/resource/simpleauth/index.d.ts +1 -0
- package/build/plugins/resource/simpleauth/index.d.ts.map +1 -1
- package/build/plugins/resource/simpleauth/index.js +1 -0
- package/build/plugins/resource/simpleauth/index.js.map +1 -1
- package/build/plugins/resource/simpleauth/plugin.d.ts.map +1 -1
- package/build/plugins/resource/simpleauth/plugin.js +1 -6
- package/build/plugins/resource/simpleauth/plugin.js.map +1 -1
- package/build/plugins/resource/simpleauth/utils/common.js +1 -1
- package/build/plugins/resource/simpleauth/utils/common.js.map +1 -1
- package/build/plugins/resource/simpleauth/utils/telemetry.d.ts.map +1 -1
- package/build/plugins/resource/simpleauth/utils/telemetry.js +2 -1
- package/build/plugins/resource/simpleauth/utils/telemetry.js.map +1 -1
- package/build/plugins/resource/simpleauth/v2/index.d.ts +4 -4
- package/build/plugins/resource/simpleauth/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/simpleauth/v2/index.js.map +1 -1
- package/build/plugins/resource/spfx/index.d.ts +1 -0
- package/build/plugins/resource/spfx/index.d.ts.map +1 -1
- package/build/plugins/resource/spfx/index.js +1 -0
- package/build/plugins/resource/spfx/index.js.map +1 -1
- package/build/plugins/resource/spfx/v2/index.d.ts +4 -8
- package/build/plugins/resource/spfx/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/spfx/v2/index.js.map +1 -1
- package/build/plugins/resource/sql/config.d.ts +0 -1
- package/build/plugins/resource/sql/config.d.ts.map +1 -1
- package/build/plugins/resource/sql/config.js +0 -1
- package/build/plugins/resource/sql/config.js.map +1 -1
- package/build/plugins/resource/sql/errors.d.ts +4 -0
- package/build/plugins/resource/sql/errors.d.ts.map +1 -1
- package/build/plugins/resource/sql/errors.js +4 -0
- package/build/plugins/resource/sql/errors.js.map +1 -1
- package/build/plugins/resource/sql/index.d.ts +1 -0
- package/build/plugins/resource/sql/index.d.ts.map +1 -1
- package/build/plugins/resource/sql/index.js +1 -0
- package/build/plugins/resource/sql/index.js.map +1 -1
- package/build/plugins/resource/sql/plugin.d.ts +4 -0
- package/build/plugins/resource/sql/plugin.d.ts.map +1 -1
- package/build/plugins/resource/sql/plugin.js +68 -69
- package/build/plugins/resource/sql/plugin.js.map +1 -1
- package/build/plugins/resource/sql/utils/contextUtils.js +1 -1
- package/build/plugins/resource/sql/utils/contextUtils.js.map +1 -1
- package/build/plugins/resource/sql/utils/telemetryUtils.d.ts.map +1 -1
- package/build/plugins/resource/sql/utils/telemetryUtils.js +2 -1
- package/build/plugins/resource/sql/utils/telemetryUtils.js.map +1 -1
- package/build/plugins/resource/sql/v2/index.d.ts +5 -4
- package/build/plugins/resource/sql/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/sql/v2/index.js +18 -16
- package/build/plugins/resource/sql/v2/index.js.map +1 -1
- package/build/plugins/resource/utils4v2.d.ts +16 -14
- package/build/plugins/resource/utils4v2.d.ts.map +1 -1
- package/build/plugins/resource/utils4v2.js +127 -92
- package/build/plugins/resource/utils4v2.js.map +1 -1
- package/build/plugins/solution/fx-solution/ResourcePluginContainer.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/ResourcePluginContainer.js +4 -2
- package/build/plugins/solution/fx-solution/ResourcePluginContainer.js.map +1 -1
- package/build/plugins/solution/fx-solution/arm.d.ts +11 -0
- package/build/plugins/solution/fx-solution/arm.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/arm.js +118 -40
- package/build/plugins/solution/fx-solution/arm.js.map +1 -1
- package/build/plugins/solution/fx-solution/commonQuestions.d.ts +2 -2
- package/build/plugins/solution/fx-solution/commonQuestions.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/commonQuestions.js +120 -47
- package/build/plugins/solution/fx-solution/commonQuestions.js.map +1 -1
- package/build/plugins/solution/fx-solution/constants.d.ts +16 -2
- package/build/plugins/solution/fx-solution/constants.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/constants.js +15 -1
- package/build/plugins/solution/fx-solution/constants.js.map +1 -1
- package/build/plugins/solution/fx-solution/executor.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/executor.js +39 -21
- package/build/plugins/solution/fx-solution/executor.js.map +1 -1
- package/build/plugins/solution/fx-solution/index.d.ts +2 -0
- package/build/plugins/solution/fx-solution/index.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/index.js +2 -0
- package/build/plugins/solution/fx-solution/index.js.map +1 -1
- package/build/plugins/solution/fx-solution/question.d.ts +2 -1
- package/build/plugins/solution/fx-solution/question.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/question.js +18 -1
- package/build/plugins/solution/fx-solution/question.js.map +1 -1
- package/build/plugins/solution/fx-solution/solution.d.ts +3 -6
- package/build/plugins/solution/fx-solution/solution.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/solution.js +406 -379
- package/build/plugins/solution/fx-solution/solution.js.map +1 -1
- package/build/plugins/solution/fx-solution/utils/util.js +1 -1
- package/build/plugins/solution/fx-solution/utils/util.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/adaptor.d.ts +3 -0
- package/build/plugins/solution/fx-solution/v2/adaptor.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/adaptor.js +37 -3
- package/build/plugins/solution/fx-solution/v2/adaptor.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/createEnv.d.ts +3 -0
- package/build/plugins/solution/fx-solution/v2/createEnv.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v2/createEnv.js +28 -0
- package/build/plugins/solution/fx-solution/v2/createEnv.js.map +1 -0
- package/build/plugins/solution/fx-solution/v2/deploy.d.ts +2 -4
- package/build/plugins/solution/fx-solution/v2/deploy.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/deploy.js +19 -14
- package/build/plugins/solution/fx-solution/v2/deploy.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/executeUserTask.d.ts +2 -2
- package/build/plugins/solution/fx-solution/v2/executeUserTask.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/executeUserTask.js +20 -4
- package/build/plugins/solution/fx-solution/v2/executeUserTask.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/executor.d.ts +2 -2
- package/build/plugins/solution/fx-solution/v2/executor.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/executor.js +27 -3
- package/build/plugins/solution/fx-solution/v2/executor.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/generateResourceTemplate.d.ts +2 -2
- package/build/plugins/solution/fx-solution/v2/generateResourceTemplate.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/generateResourceTemplate.js +8 -2
- package/build/plugins/solution/fx-solution/v2/generateResourceTemplate.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/getQuestions.d.ts +8 -0
- package/build/plugins/solution/fx-solution/v2/getQuestions.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v2/getQuestions.js +393 -0
- package/build/plugins/solution/fx-solution/v2/getQuestions.js.map +1 -0
- package/build/plugins/solution/fx-solution/v2/package.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/package.js +12 -2
- package/build/plugins/solution/fx-solution/v2/package.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/provision.d.ts +4 -0
- package/build/plugins/solution/fx-solution/v2/provision.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v2/provision.js +153 -0
- package/build/plugins/solution/fx-solution/v2/provision.js.map +1 -0
- package/build/plugins/solution/fx-solution/v2/provisionLocal.d.ts +3 -0
- package/build/plugins/solution/fx-solution/v2/provisionLocal.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v2/provisionLocal.js +73 -0
- package/build/plugins/solution/fx-solution/v2/provisionLocal.js.map +1 -0
- package/build/plugins/solution/fx-solution/v2/publish.d.ts +2 -2
- package/build/plugins/solution/fx-solution/v2/publish.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/publish.js +11 -11
- package/build/plugins/solution/fx-solution/v2/publish.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/scaffolding.d.ts +3 -7
- package/build/plugins/solution/fx-solution/v2/scaffolding.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/scaffolding.js +21 -6
- package/build/plugins/solution/fx-solution/v2/scaffolding.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/solution.d.ts +18 -0
- package/build/plugins/solution/fx-solution/v2/solution.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v2/solution.js +38 -0
- package/build/plugins/solution/fx-solution/v2/solution.js.map +1 -0
- package/build/plugins/solution/fx-solution/v2/utils.d.ts +11 -9
- package/build/plugins/solution/fx-solution/v2/utils.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/utils.js +81 -1
- package/build/plugins/solution/fx-solution/v2/utils.js.map +1 -1
- package/package.json +8 -5
- package/resource/strings.json +2 -1
- package/templates/plugins/resource/bot/bicep/botConfiguration.template.bicep +0 -4
- package/templates/plugins/resource/bot/bicep/botProvision.template.bicep +0 -6
- package/templates/plugins/resource/bot/bicep/module.template.bicep +0 -4
- package/templates/plugins/resource/bot/bicep/output.template.bicep +0 -2
- package/templates/plugins/resource/bot/bicep/param.template.bicep +0 -2
- package/templates/plugins/resource/bot/bot-msgext.js.default.zip +0 -0
- package/templates/plugins/resource/bot/bot-msgext.ts.default.zip +0 -0
- package/templates/plugins/resource/bot/bot.js.default.zip +0 -0
- package/templates/plugins/resource/bot/bot.ts.default.zip +0 -0
- package/templates/plugins/resource/bot/msgext.js.default.zip +0 -0
- package/templates/plugins/resource/bot/msgext.ts.default.zip +0 -0
- package/templates/plugins/resource/frontend/bicep/frontendHosting.bicep +1 -1
- package/templates/plugins/resource/frontend/bicep/output.template.bicep +1 -1
- package/templates/plugins/resource/frontend/tab.js.default.zip +0 -0
- package/templates/plugins/resource/frontend/tab.ts.default.zip +0 -0
- package/templates/plugins/resource/function/bicep/functionProvision.template.bicep +1 -3
- package/templates/plugins/resource/function/bicep/output.template.bicep +1 -3
- package/templates/plugins/resource/function/function-base.js.default.zip +0 -0
- package/templates/plugins/resource/function/function-base.ts.default.zip +0 -0
- package/templates/plugins/resource/function/function-triggers.js.HTTPTrigger.zip +0 -0
- package/templates/plugins/resource/function/function-triggers.ts.HTTPTrigger.zip +0 -0
- package/templates/plugins/resource/spfx/solution/manifest_multi_env.json +62 -0
- package/build/core/loader.d.ts +0 -11
- package/build/core/loader.d.ts.map +0 -1
- package/build/core/loader.js +0 -17
- package/build/core/loader.js.map +0 -1
- package/build/core/middleware/contextInjecter.d.ts +0 -3
- package/build/core/middleware/contextInjecter.d.ts.map +0 -1
- package/build/core/middleware/contextInjecter.js.map +0 -1
- package/build/plugins/resource/bot/enums/wayToRegisterBot.d.ts +0 -5
- package/build/plugins/resource/bot/enums/wayToRegisterBot.d.ts.map +0 -1
- package/build/plugins/resource/bot/enums/wayToRegisterBot.js +0 -11
- package/build/plugins/resource/bot/enums/wayToRegisterBot.js.map +0 -1
- package/build/plugins/resource/bot/questions.d.ts +0 -4
- package/build/plugins/resource/bot/questions.d.ts.map +0 -1
- package/build/plugins/resource/bot/questions.js +0 -65
- package/build/plugins/resource/bot/questions.js.map +0 -1
- package/build/plugins/resource/function/utils/templates-fetch.d.ts +0 -10
- package/build/plugins/resource/function/utils/templates-fetch.d.ts.map +0 -1
- package/build/plugins/resource/function/utils/templates-fetch.js +0 -107
- package/build/plugins/resource/function/utils/templates-fetch.js.map +0 -1
package/build/core/index.js
CHANGED
|
@@ -2,54 +2,80 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.FxCore = exports.currentStage = exports.telemetryReporter = exports.Logger = void 0;
|
|
5
|
+
exports.createV2Context = exports.newProjectSettings = exports.downloadSample = exports.createBasicFolderStructure = exports.FxCore = exports.TOOLS = exports.currentStage = exports.telemetryReporter = exports.Logger = exports.isV2 = void 0;
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
|
-
const
|
|
7
|
+
const hooks_1 = require("@feathersjs/hooks");
|
|
8
8
|
const teamsfx_api_1 = require("@microsoft/teamsfx-api");
|
|
9
|
-
const path = tslib_1.__importStar(require("path"));
|
|
10
|
-
const tools_1 = require("../common/tools");
|
|
11
|
-
const question_1 = require("./question");
|
|
12
|
-
const jsonschema = tslib_1.__importStar(require("jsonschema"));
|
|
13
9
|
const adm_zip_1 = tslib_1.__importDefault(require("adm-zip"));
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const projectSettingsWriter_1 = require("./middleware/projectSettingsWriter");
|
|
18
|
-
const projectSettingsLoader_1 = require("./middleware/projectSettingsLoader");
|
|
19
|
-
const concurrentLocker_1 = require("./middleware/concurrentLocker");
|
|
20
|
-
const error_1 = require("./error");
|
|
21
|
-
const solutionLoader_1 = require("./middleware/solutionLoader");
|
|
22
|
-
const contextInjecter_1 = require("./middleware/contextInjecter");
|
|
23
|
-
const loader_1 = require("./loader");
|
|
24
|
-
const telemetry_1 = require("../common/telemetry");
|
|
10
|
+
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
11
|
+
const jsonschema = tslib_1.__importStar(require("jsonschema"));
|
|
12
|
+
const path = tslib_1.__importStar(require("path"));
|
|
25
13
|
const uuid = tslib_1.__importStar(require("uuid"));
|
|
26
|
-
const
|
|
14
|
+
const __1 = require("..");
|
|
15
|
+
const constants_1 = require("../common/constants");
|
|
27
16
|
const globalState_1 = require("../common/globalState");
|
|
17
|
+
const localSettingsProvider_1 = require("../common/localSettingsProvider");
|
|
18
|
+
const telemetry_1 = require("../common/telemetry");
|
|
19
|
+
const tools_1 = require("../common/tools");
|
|
20
|
+
const plugins_1 = require("../plugins");
|
|
21
|
+
const ResourcePluginContainer_1 = require("../plugins/solution/fx-solution/ResourcePluginContainer");
|
|
22
|
+
const callback_1 = require("./callback");
|
|
23
|
+
const error_1 = require("./error");
|
|
24
|
+
const concurrentLocker_1 = require("./middleware/concurrentLocker");
|
|
25
|
+
const contextInjector_1 = require("./middleware/contextInjector");
|
|
28
26
|
const envInfoLoader_1 = require("./middleware/envInfoLoader");
|
|
29
27
|
const envInfoWriter_1 = require("./middleware/envInfoWriter");
|
|
28
|
+
const errorHandler_1 = require("./middleware/errorHandler");
|
|
30
29
|
const localSettingsLoader_1 = require("./middleware/localSettingsLoader");
|
|
31
30
|
const localSettingsWriter_1 = require("./middleware/localSettingsWriter");
|
|
32
31
|
const migrateConditionHandler_1 = require("./middleware/migrateConditionHandler");
|
|
33
|
-
const
|
|
32
|
+
const projectMigrator_1 = require("./middleware/projectMigrator");
|
|
33
|
+
const projectSettingsLoader_1 = require("./middleware/projectSettingsLoader");
|
|
34
|
+
const projectSettingsWriter_1 = require("./middleware/projectSettingsWriter");
|
|
35
|
+
const projectUpgrader_1 = require("./middleware/projectUpgrader");
|
|
36
|
+
const questionModel_1 = require("./middleware/questionModel");
|
|
37
|
+
const solutionLoader_1 = require("./middleware/solutionLoader");
|
|
38
|
+
const question_1 = require("./question");
|
|
39
|
+
const SolutionPluginContainer_1 = require("./SolutionPluginContainer");
|
|
34
40
|
const tools_2 = require("./tools");
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
41
|
+
// API V2 feature flag
|
|
42
|
+
function isV2() {
|
|
43
|
+
const flag = process.env[constants_1.FeatureFlagName.APIV2];
|
|
44
|
+
if (flag === undefined) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
return flag === "1" || flag.toLowerCase() === "true";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.isV2 = isV2;
|
|
38
52
|
class FxCore {
|
|
39
53
|
constructor(tools) {
|
|
40
54
|
this.tools = tools;
|
|
55
|
+
exports.TOOLS = tools;
|
|
41
56
|
exports.Logger = tools.logProvider;
|
|
42
57
|
exports.telemetryReporter = tools.telemetryReporter;
|
|
43
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* @todo this's a really primitive implement. Maybe could use Subscription Model to
|
|
61
|
+
* refactor later.
|
|
62
|
+
*/
|
|
63
|
+
on(event, callback) {
|
|
64
|
+
return callback_1.CallbackRegistry.set(event, callback);
|
|
65
|
+
}
|
|
44
66
|
async createProject(inputs, ctx) {
|
|
67
|
+
if (!ctx) {
|
|
68
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("CoreHookContext"));
|
|
69
|
+
}
|
|
45
70
|
exports.currentStage = teamsfx_api_1.Stage.create;
|
|
46
71
|
const folder = inputs[question_1.QuestionRootFolder.name];
|
|
47
72
|
const scratch = inputs[question_1.CoreQuestionNames.CreateFromScratch];
|
|
48
73
|
let projectPath;
|
|
49
74
|
let globalStateDescription = "openReadme";
|
|
75
|
+
const multiEnv = tools_1.isMultiEnvEnabled();
|
|
50
76
|
if (scratch === question_1.ScratchOptionNo.id) {
|
|
51
77
|
// create from sample
|
|
52
|
-
const downloadRes = await
|
|
78
|
+
const downloadRes = await downloadSample(this, inputs);
|
|
53
79
|
if (downloadRes.isErr()) {
|
|
54
80
|
return teamsfx_api_1.err(downloadRes.error);
|
|
55
81
|
}
|
|
@@ -68,46 +94,104 @@ class FxCore {
|
|
|
68
94
|
return teamsfx_api_1.err(error_1.InvalidInputError(`${validateResult.errors[0].message}`, inputs));
|
|
69
95
|
}
|
|
70
96
|
projectPath = path.join(folder, appName);
|
|
97
|
+
inputs.projectPath = projectPath;
|
|
71
98
|
const folderExist = await fs.pathExists(projectPath);
|
|
72
99
|
if (folderExist) {
|
|
73
100
|
return teamsfx_api_1.err(error_1.ProjectFolderExistError(projectPath));
|
|
74
101
|
}
|
|
75
|
-
|
|
76
|
-
|
|
102
|
+
await fs.ensureDir(projectPath);
|
|
103
|
+
await fs.ensureDir(path.join(projectPath, `.${teamsfx_api_1.ConfigFolderName}`));
|
|
104
|
+
await fs.ensureDir(path.join(projectPath, multiEnv ? path.join("templates", `${teamsfx_api_1.AppPackageFolderName}`) : `${teamsfx_api_1.AppPackageFolderName}`));
|
|
105
|
+
const basicFolderRes = await createBasicFolderStructure(inputs);
|
|
106
|
+
if (basicFolderRes.isErr()) {
|
|
107
|
+
return teamsfx_api_1.err(basicFolderRes.error);
|
|
108
|
+
}
|
|
77
109
|
const projectSettings = {
|
|
78
110
|
appName: appName,
|
|
79
111
|
projectId: uuid.v4(),
|
|
80
112
|
solutionSettings: {
|
|
81
|
-
name:
|
|
113
|
+
name: "",
|
|
82
114
|
version: "1.0.0",
|
|
83
115
|
},
|
|
116
|
+
version: "1.0.0",
|
|
117
|
+
activeEnvironment: multiEnv ? __1.environmentManager.getDefaultEnvName() : "default",
|
|
84
118
|
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
await fs.ensureDir(path.join(projectPath, tools_1.isMultiEnvEnabled()
|
|
89
|
-
? path.join("templates", `${teamsfx_api_1.AppPackageFolderName}`)
|
|
90
|
-
: `${teamsfx_api_1.AppPackageFolderName}`));
|
|
91
|
-
const createResult = await this.createBasicFolderStructure(inputs);
|
|
92
|
-
if (createResult.isErr()) {
|
|
93
|
-
return teamsfx_api_1.err(createResult.error);
|
|
94
|
-
}
|
|
95
|
-
const createRes = await solution.create(solutionContext);
|
|
96
|
-
if (createRes.isErr()) {
|
|
97
|
-
return createRes;
|
|
98
|
-
}
|
|
99
|
-
const scaffoldRes = await solution.scaffold(solutionContext);
|
|
100
|
-
if (scaffoldRes.isErr()) {
|
|
101
|
-
return scaffoldRes;
|
|
102
|
-
}
|
|
103
|
-
if (tools_1.isMultiEnvEnabled()) {
|
|
104
|
-
const createEnvResult = await this.createEnvWithName(__1.environmentManager.getDefaultEnvName(), projectSettings, inputs, ctx.self);
|
|
119
|
+
ctx.projectSettings = projectSettings;
|
|
120
|
+
if (multiEnv) {
|
|
121
|
+
const createEnvResult = await this.createEnvWithName(__1.environmentManager.getDefaultEnvName(), projectSettings, inputs);
|
|
105
122
|
if (createEnvResult.isErr()) {
|
|
106
123
|
return teamsfx_api_1.err(createEnvResult.error);
|
|
107
124
|
}
|
|
108
125
|
}
|
|
109
|
-
|
|
110
|
-
|
|
126
|
+
if (isV2()) {
|
|
127
|
+
const solution = await SolutionPluginContainer_1.getSolutionPluginV2ByName(inputs[question_1.CoreQuestionNames.Solution]);
|
|
128
|
+
if (!solution) {
|
|
129
|
+
return teamsfx_api_1.err(new error_1.LoadSolutionError());
|
|
130
|
+
}
|
|
131
|
+
ctx.solutionV2 = solution;
|
|
132
|
+
projectSettings.solutionSettings.name = solution.name;
|
|
133
|
+
projectSettings.version = "2.0.0";
|
|
134
|
+
const contextV2 = createV2Context(this, projectSettings);
|
|
135
|
+
ctx.contextV2 = contextV2;
|
|
136
|
+
const scaffoldSourceCodeRes = await solution.scaffoldSourceCode(contextV2, inputs);
|
|
137
|
+
if (scaffoldSourceCodeRes.isErr()) {
|
|
138
|
+
return teamsfx_api_1.err(scaffoldSourceCodeRes.error);
|
|
139
|
+
}
|
|
140
|
+
const generateResourceTemplateRes = await solution.generateResourceTemplate(contextV2, inputs);
|
|
141
|
+
if (generateResourceTemplateRes.isErr()) {
|
|
142
|
+
return teamsfx_api_1.err(generateResourceTemplateRes.error);
|
|
143
|
+
}
|
|
144
|
+
// ctx.provisionInputConfig = generateResourceTemplateRes.value;
|
|
145
|
+
if (multiEnv) {
|
|
146
|
+
if (solution.createEnv) {
|
|
147
|
+
inputs.copy = false;
|
|
148
|
+
const createEnvRes = await solution.createEnv(contextV2, inputs);
|
|
149
|
+
if (createEnvRes.isErr()) {
|
|
150
|
+
return teamsfx_api_1.err(createEnvRes.error);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
//TODO lagacy env.default.json
|
|
156
|
+
const profile = { solution: {} };
|
|
157
|
+
for (const plugin of ResourcePluginContainer_1.getAllV2ResourcePlugins()) {
|
|
158
|
+
profile[plugin.name] = {};
|
|
159
|
+
}
|
|
160
|
+
profile[plugins_1.PluginNames.LDEBUG]["trustDevCert"] = "true";
|
|
161
|
+
ctx.envInfoV2 = {
|
|
162
|
+
envName: __1.environmentManager.getDefaultEnvName(),
|
|
163
|
+
config: {},
|
|
164
|
+
profile: profile,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
const solution = await SolutionPluginContainer_1.getSolutionPluginByName(inputs[question_1.CoreQuestionNames.Solution]);
|
|
170
|
+
if (!solution) {
|
|
171
|
+
return teamsfx_api_1.err(new error_1.LoadSolutionError());
|
|
172
|
+
}
|
|
173
|
+
ctx.solution = solution;
|
|
174
|
+
projectSettings.solutionSettings.name = solution.name;
|
|
175
|
+
const solutionContext = Object.assign(Object.assign(Object.assign({ projectSettings: projectSettings, envInfo: tools_2.newEnvInfo(), root: projectPath }, this.tools), this.tools.tokenProvider), { answers: inputs });
|
|
176
|
+
ctx.solutionContext = solutionContext;
|
|
177
|
+
const createRes = await solution.create(solutionContext);
|
|
178
|
+
if (createRes.isErr()) {
|
|
179
|
+
return createRes;
|
|
180
|
+
}
|
|
181
|
+
const scaffoldRes = await solution.scaffold(solutionContext);
|
|
182
|
+
if (scaffoldRes.isErr()) {
|
|
183
|
+
return scaffoldRes;
|
|
184
|
+
}
|
|
185
|
+
if (multiEnv) {
|
|
186
|
+
if (solution.createEnv) {
|
|
187
|
+
solutionContext.answers.copy = false;
|
|
188
|
+
const createEnvRes = await solution.createEnv(solutionContext);
|
|
189
|
+
if (createEnvRes.isErr()) {
|
|
190
|
+
return teamsfx_api_1.err(createEnvRes.error);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
111
195
|
}
|
|
112
196
|
if (inputs.platform === teamsfx_api_1.Platform.VSCode) {
|
|
113
197
|
await globalState_1.globalStateUpdate(globalStateDescription, true);
|
|
@@ -131,7 +215,10 @@ class FxCore {
|
|
|
131
215
|
if (!projectPath || !(await fs.pathExists(projectPath))) {
|
|
132
216
|
return teamsfx_api_1.err(error_1.ProjectFolderNotExistError(projectPath !== null && projectPath !== void 0 ? projectPath : ""));
|
|
133
217
|
}
|
|
134
|
-
|
|
218
|
+
if (isV2()) {
|
|
219
|
+
return teamsfx_api_1.err(new error_1.NotImplementedError("migrateV1Project"));
|
|
220
|
+
}
|
|
221
|
+
const solution = await SolutionPluginContainer_1.getAllSolutionPlugins()[0];
|
|
135
222
|
const projectSettings = {
|
|
136
223
|
appName: appName,
|
|
137
224
|
projectId: uuid.v4(),
|
|
@@ -145,7 +232,7 @@ class FxCore {
|
|
|
145
232
|
await this.archive(projectPath);
|
|
146
233
|
await fs.ensureDir(projectPath);
|
|
147
234
|
await fs.ensureDir(path.join(projectPath, `.${teamsfx_api_1.ConfigFolderName}`));
|
|
148
|
-
const createResult = await
|
|
235
|
+
const createResult = await createBasicFolderStructure(inputs);
|
|
149
236
|
if (createResult.isErr()) {
|
|
150
237
|
return teamsfx_api_1.err(createResult.error);
|
|
151
238
|
}
|
|
@@ -158,6 +245,7 @@ class FxCore {
|
|
|
158
245
|
}
|
|
159
246
|
ctx.solution = solution;
|
|
160
247
|
ctx.solutionContext = solutionContext;
|
|
248
|
+
ctx.projectSettings = projectSettings;
|
|
161
249
|
if (inputs.platform === teamsfx_api_1.Platform.VSCode) {
|
|
162
250
|
await globalState_1.globalStateUpdate(globalStateDescription, true);
|
|
163
251
|
}
|
|
@@ -187,153 +275,186 @@ class FxCore {
|
|
|
187
275
|
await archiveLog(projectPath, `'${fileName}' has been moved to '${teamsfx_api_1.ArchiveFolderName}' folder.`);
|
|
188
276
|
}
|
|
189
277
|
}
|
|
190
|
-
async
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
try {
|
|
205
|
-
telemetry_1.sendTelemetryEvent(telemetry_1.Component.core, telemetry_1.TelemetryEvent.DownloadSampleStart, {
|
|
206
|
-
[telemetry_1.TelemetryProperty.SampleAppName]: sample.id,
|
|
207
|
-
module: "fx-core",
|
|
208
|
-
});
|
|
209
|
-
fetchRes = await tools_1.fetchCodeZip(url);
|
|
210
|
-
if (fetchRes !== undefined) {
|
|
211
|
-
telemetry_1.sendTelemetryEvent(telemetry_1.Component.core, telemetry_1.TelemetryEvent.DownloadSample, {
|
|
212
|
-
[telemetry_1.TelemetryProperty.SampleAppName]: sample.id,
|
|
213
|
-
[telemetry_1.TelemetryProperty.Success]: telemetry_1.TelemetrySuccess.Yes,
|
|
214
|
-
module: "fx-core",
|
|
215
|
-
});
|
|
216
|
-
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
217
|
-
}
|
|
218
|
-
else
|
|
219
|
-
return teamsfx_api_1.err(error_1.FetchSampleError());
|
|
220
|
-
}
|
|
221
|
-
catch (e) {
|
|
222
|
-
telemetry_1.sendTelemetryErrorEvent(telemetry_1.Component.core, telemetry_1.TelemetryEvent.DownloadSample, teamsfx_api_1.assembleError(e), {
|
|
223
|
-
[telemetry_1.TelemetryProperty.SampleAppName]: sample.id,
|
|
224
|
-
module: "fx-core",
|
|
225
|
-
});
|
|
226
|
-
return teamsfx_api_1.err(teamsfx_api_1.assembleError(e));
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
};
|
|
230
|
-
const task2 = {
|
|
231
|
-
name: "Save and unzip package",
|
|
232
|
-
run: async (...args) => {
|
|
233
|
-
if (fetchRes) {
|
|
234
|
-
await tools_1.saveFilesRecursively(new adm_zip_1.default(fetchRes.data), sampleId, folder);
|
|
235
|
-
}
|
|
236
|
-
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
237
|
-
},
|
|
238
|
-
};
|
|
239
|
-
const task3 = {
|
|
240
|
-
name: "post process",
|
|
241
|
-
run: async (...args) => {
|
|
242
|
-
await tools_1.downloadSampleHook(sampleId, sampleAppPath);
|
|
243
|
-
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
244
|
-
},
|
|
278
|
+
async provisionResources(inputs, ctx) {
|
|
279
|
+
exports.currentStage = teamsfx_api_1.Stage.provision;
|
|
280
|
+
if (isV2()) {
|
|
281
|
+
if (!ctx ||
|
|
282
|
+
!ctx.solutionV2 ||
|
|
283
|
+
!ctx.contextV2 ||
|
|
284
|
+
!ctx.provisionInputConfig ||
|
|
285
|
+
!ctx.contextV2.projectSetting.activeEnvironment ||
|
|
286
|
+
!ctx.provisionOutputs)
|
|
287
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("Provision input stuff"));
|
|
288
|
+
const envInfo = {
|
|
289
|
+
envName: ctx.contextV2.projectSetting.activeEnvironment,
|
|
290
|
+
config: ctx.provisionInputConfig,
|
|
291
|
+
profile: ctx.provisionOutputs,
|
|
245
292
|
};
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
const runRes = await this.tools.ui.runWithProgress(group, {
|
|
251
|
-
showProgress: true,
|
|
252
|
-
cancellable: false,
|
|
253
|
-
});
|
|
254
|
-
if (runRes.isOk()) {
|
|
255
|
-
return teamsfx_api_1.ok(sampleAppPath);
|
|
293
|
+
const result = await ctx.solutionV2.provisionResources(ctx.contextV2, inputs, envInfo, this.tools.tokenProvider);
|
|
294
|
+
// todo(yefuwang): persist profile on success and partialSuccess
|
|
295
|
+
if (result.kind === "success") {
|
|
296
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
256
297
|
}
|
|
257
298
|
else {
|
|
258
|
-
return teamsfx_api_1.err(
|
|
299
|
+
return teamsfx_api_1.err(result.error);
|
|
259
300
|
}
|
|
260
301
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
302
|
+
else {
|
|
303
|
+
if (!ctx || !ctx.solution || !ctx.solutionContext)
|
|
304
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("Provision input stuff"));
|
|
305
|
+
return await ctx.solution.provision(ctx.solutionContext);
|
|
306
|
+
}
|
|
266
307
|
}
|
|
267
308
|
async deployArtifacts(inputs, ctx) {
|
|
268
309
|
exports.currentStage = teamsfx_api_1.Stage.deploy;
|
|
269
|
-
|
|
310
|
+
if (isV2()) {
|
|
311
|
+
if (!ctx || !ctx.solutionV2 || !ctx.contextV2 || !ctx.provisionOutputs)
|
|
312
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("Deploy input stuff"));
|
|
313
|
+
if (ctx.solutionV2.deploy)
|
|
314
|
+
return await ctx.solutionV2.deploy(ctx.contextV2, inputs, ctx.provisionOutputs, this.tools.tokenProvider.azureAccountProvider);
|
|
315
|
+
else
|
|
316
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
if (!ctx || !ctx.solution || !ctx.solutionContext)
|
|
320
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("Deploy input stuff"));
|
|
321
|
+
return await ctx.solution.deploy(ctx.solutionContext);
|
|
322
|
+
}
|
|
270
323
|
}
|
|
271
324
|
async localDebug(inputs, ctx) {
|
|
272
325
|
exports.currentStage = teamsfx_api_1.Stage.debug;
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
326
|
+
if (isV2()) {
|
|
327
|
+
if (!ctx || !ctx.solutionV2 || !ctx.contextV2 || !ctx.localSettings)
|
|
328
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("localDebug input stuff"));
|
|
329
|
+
if (ctx.solutionV2.provisionLocalResource) {
|
|
330
|
+
const res = await ctx.solutionV2.provisionLocalResource(ctx.contextV2, inputs, ctx.localSettings, this.tools.tokenProvider);
|
|
331
|
+
if (res.kind === "success") {
|
|
332
|
+
ctx.localSettings = res.output;
|
|
333
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
334
|
+
}
|
|
335
|
+
else if (res.kind === "partialSuccess") {
|
|
336
|
+
ctx.localSettings = res.output;
|
|
337
|
+
return teamsfx_api_1.err(res.error);
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
return teamsfx_api_1.err(res.error);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
else
|
|
344
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
if (!ctx || !ctx.solution || !ctx.solutionContext || !ctx.projectSettings)
|
|
348
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("localDebug input stuff"));
|
|
349
|
+
envInfoLoader_1.upgradeProgrammingLanguage(ctx.solutionContext.envInfo.profile, ctx.projectSettings);
|
|
350
|
+
envInfoLoader_1.upgradeDefaultFunctionName(ctx.solutionContext.envInfo.profile, ctx.projectSettings);
|
|
351
|
+
return await ctx.solution.localDebug(ctx.solutionContext);
|
|
352
|
+
}
|
|
276
353
|
}
|
|
277
354
|
async publishApplication(inputs, ctx) {
|
|
278
355
|
exports.currentStage = teamsfx_api_1.Stage.publish;
|
|
279
|
-
|
|
356
|
+
if (isV2()) {
|
|
357
|
+
if (!ctx || !ctx.solutionV2 || !ctx.contextV2 || !ctx.envInfoV2)
|
|
358
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("publish input stuff"));
|
|
359
|
+
return await ctx.solutionV2.publishApplication(ctx.contextV2, inputs, ctx.envInfoV2, this.tools.tokenProvider.appStudioToken);
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
if (!ctx || !ctx.solution || !ctx.solutionContext)
|
|
363
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("publish input stuff"));
|
|
364
|
+
return await ctx.solution.publish(ctx.solutionContext);
|
|
365
|
+
}
|
|
280
366
|
}
|
|
281
367
|
async executeUserTask(func, inputs, ctx) {
|
|
282
368
|
exports.currentStage = teamsfx_api_1.Stage.userTask;
|
|
283
|
-
if (ctx.solutionContext === undefined)
|
|
284
|
-
ctx.solutionContext = await projectSettingsLoader_1.newSolutionContext(this.tools, inputs);
|
|
285
|
-
const solution = ctx.solution;
|
|
286
369
|
const namespace = func.namespace;
|
|
287
370
|
const array = namespace ? namespace.split("/") : [];
|
|
288
|
-
if ("" !== namespace && array.length > 0
|
|
289
|
-
|
|
371
|
+
if ("" !== namespace && array.length > 0) {
|
|
372
|
+
if (isV2()) {
|
|
373
|
+
if (!ctx || !ctx.solutionV2 || !ctx.envInfoV2)
|
|
374
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("executeUserTask input stuff"));
|
|
375
|
+
if (!ctx.contextV2)
|
|
376
|
+
ctx.contextV2 = createV2Context(this, newProjectSettings());
|
|
377
|
+
if (ctx.solutionV2.executeUserTask)
|
|
378
|
+
return await ctx.solutionV2.executeUserTask(ctx.contextV2, inputs, func, ctx.envInfoV2, this.tools.tokenProvider);
|
|
379
|
+
else
|
|
380
|
+
return teamsfx_api_1.err(error_1.FunctionRouterError(func));
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
if (!ctx || !ctx.solution)
|
|
384
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("executeUserTask input stuff"));
|
|
385
|
+
if (!ctx.solutionContext)
|
|
386
|
+
ctx.solutionContext = await projectSettingsLoader_1.newSolutionContext(this.tools, inputs);
|
|
387
|
+
if (ctx.solution.executeUserTask)
|
|
388
|
+
return await ctx.solution.executeUserTask(func, ctx.solutionContext);
|
|
389
|
+
else
|
|
390
|
+
return teamsfx_api_1.err(error_1.FunctionRouterError(func));
|
|
391
|
+
}
|
|
290
392
|
}
|
|
291
393
|
return teamsfx_api_1.err(error_1.FunctionRouterError(func));
|
|
292
394
|
}
|
|
293
|
-
async getQuestions(
|
|
294
|
-
if (
|
|
395
|
+
async getQuestions(stage, inputs, ctx) {
|
|
396
|
+
if (!ctx)
|
|
397
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("getQuestions input stuff"));
|
|
398
|
+
if (stage === teamsfx_api_1.Stage.create) {
|
|
295
399
|
delete inputs.projectPath;
|
|
296
400
|
return await this._getQuestionsForCreateProject(inputs);
|
|
297
401
|
}
|
|
298
402
|
else {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
? await
|
|
304
|
-
|
|
305
|
-
|
|
403
|
+
if (isV2()) {
|
|
404
|
+
const contextV2 = ctx.contextV2
|
|
405
|
+
? ctx.contextV2
|
|
406
|
+
: createV2Context(this, newProjectSettings());
|
|
407
|
+
const solutionV2 = ctx.solutionV2 ? ctx.solutionV2 : await SolutionPluginContainer_1.getAllSolutionPluginsV2()[0];
|
|
408
|
+
const envInfoV2 = ctx.envInfoV2
|
|
409
|
+
? ctx.envInfoV2
|
|
410
|
+
: { envName: __1.environmentManager.getDefaultEnvName(), config: {}, profile: {} };
|
|
411
|
+
inputs.stage = stage;
|
|
412
|
+
return await this._getQuestions(contextV2, solutionV2, stage, inputs, envInfoV2);
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
const solutionContext = ctx.solutionContext
|
|
416
|
+
? ctx.solutionContext
|
|
417
|
+
: await projectSettingsLoader_1.newSolutionContext(this.tools, inputs);
|
|
418
|
+
const solution = ctx.solution ? ctx.solution : SolutionPluginContainer_1.getAllSolutionPlugins()[0];
|
|
419
|
+
return await this._getQuestions(solutionContext, solution, stage, inputs);
|
|
420
|
+
}
|
|
306
421
|
}
|
|
307
422
|
}
|
|
308
423
|
async getQuestionsForUserTask(func, inputs, ctx) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
? await
|
|
314
|
-
|
|
315
|
-
|
|
424
|
+
if (!ctx)
|
|
425
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("getQuestionsForUserTask input stuff"));
|
|
426
|
+
if (isV2()) {
|
|
427
|
+
const contextV2 = ctx.contextV2 ? ctx.contextV2 : createV2Context(this, newProjectSettings());
|
|
428
|
+
const solutionV2 = ctx.solutionV2 ? ctx.solutionV2 : await SolutionPluginContainer_1.getAllSolutionPluginsV2()[0];
|
|
429
|
+
const envInfoV2 = ctx.envInfoV2
|
|
430
|
+
? ctx.envInfoV2
|
|
431
|
+
: { envName: __1.environmentManager.getDefaultEnvName(), config: {}, profile: {} };
|
|
432
|
+
return await this._getQuestionsForUserTask(contextV2, solutionV2, func, inputs, envInfoV2);
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
const solutionContext = ctx.solutionContext
|
|
436
|
+
? ctx.solutionContext
|
|
437
|
+
: await projectSettingsLoader_1.newSolutionContext(this.tools, inputs);
|
|
438
|
+
const solution = ctx.solution ? ctx.solution : SolutionPluginContainer_1.getAllSolutionPlugins()[0];
|
|
439
|
+
return await this._getQuestionsForUserTask(solutionContext, solution, func, inputs);
|
|
440
|
+
}
|
|
316
441
|
}
|
|
317
442
|
async getProjectConfig(inputs, ctx) {
|
|
318
443
|
var _a, _b;
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
(_c = solutionContext.envInfo.profile.get("solution")) === null || _c === void 0 ? void 0 : _c.set("subscriptionId", inputs.subscriptionId);
|
|
334
|
-
else
|
|
335
|
-
(_d = solutionContext.envInfo.profile.get("solution")) === null || _d === void 0 ? void 0 : _d.delete("subscriptionId");
|
|
336
|
-
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
444
|
+
if (isV2()) {
|
|
445
|
+
return teamsfx_api_1.ok({
|
|
446
|
+
settings: ctx.projectSettings,
|
|
447
|
+
config: ctx.provisionOutputs,
|
|
448
|
+
localSettings: ctx.localSettings,
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
else {
|
|
452
|
+
return teamsfx_api_1.ok({
|
|
453
|
+
settings: ctx.projectSettings,
|
|
454
|
+
config: (_a = ctx.solutionContext) === null || _a === void 0 ? void 0 : _a.envInfo.profile,
|
|
455
|
+
localSettings: (_b = ctx.solutionContext) === null || _b === void 0 ? void 0 : _b.localSettings,
|
|
456
|
+
});
|
|
457
|
+
}
|
|
337
458
|
}
|
|
338
459
|
async grantPermission(inputs, ctx) {
|
|
339
460
|
exports.currentStage = teamsfx_api_1.Stage.grantPermission;
|
|
@@ -347,12 +468,23 @@ class FxCore {
|
|
|
347
468
|
exports.currentStage = teamsfx_api_1.Stage.listCollaborator;
|
|
348
469
|
return await ctx.solution.listCollaborator(ctx.solutionContext);
|
|
349
470
|
}
|
|
350
|
-
async _getQuestionsForUserTask(ctx, solution, func, inputs) {
|
|
471
|
+
async _getQuestionsForUserTask(ctx, solution, func, inputs, envInfo) {
|
|
351
472
|
const namespace = func.namespace;
|
|
352
473
|
const array = namespace ? namespace.split("/") : [];
|
|
353
|
-
if (namespace && "" !== namespace && array.length > 0
|
|
354
|
-
|
|
355
|
-
|
|
474
|
+
if (namespace && "" !== namespace && array.length > 0) {
|
|
475
|
+
let res = teamsfx_api_1.ok(undefined);
|
|
476
|
+
if (isV2()) {
|
|
477
|
+
const solutionV2 = solution;
|
|
478
|
+
if (solutionV2.getQuestionsForUserTask) {
|
|
479
|
+
res = await solutionV2.getQuestionsForUserTask(ctx, inputs, func, envInfo, this.tools.tokenProvider);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
else {
|
|
483
|
+
const solutionv1 = solution;
|
|
484
|
+
if (solutionv1.getQuestionsForUserTask) {
|
|
485
|
+
res = await solutionv1.getQuestionsForUserTask(func, ctx);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
356
488
|
if (res.isOk()) {
|
|
357
489
|
if (res.value) {
|
|
358
490
|
const node = res.value.trim();
|
|
@@ -363,44 +495,9 @@ class FxCore {
|
|
|
363
495
|
}
|
|
364
496
|
return teamsfx_api_1.err(error_1.FunctionRouterError(func));
|
|
365
497
|
}
|
|
366
|
-
async _getQuestionsForCreateProject(inputs) {
|
|
367
|
-
const node = new teamsfx_api_1.QTreeNode(question_1.getCreateNewOrFromSampleQuestion(inputs.platform));
|
|
368
|
-
// create new
|
|
369
|
-
const createNew = new teamsfx_api_1.QTreeNode({ type: "group" });
|
|
370
|
-
node.addChild(createNew);
|
|
371
|
-
createNew.condition = { equals: question_1.ScratchOptionYes.id };
|
|
372
|
-
const globalSolutions = await loader_1.defaultSolutionLoader.loadGlobalSolutions(inputs);
|
|
373
|
-
const solutionNames = globalSolutions.map((s) => s.name);
|
|
374
|
-
const selectSolution = question_1.QuestionSelectSolution;
|
|
375
|
-
selectSolution.staticOptions = solutionNames;
|
|
376
|
-
const solutionSelectNode = new teamsfx_api_1.QTreeNode(selectSolution);
|
|
377
|
-
createNew.addChild(solutionSelectNode);
|
|
378
|
-
const solutionContext = await projectSettingsLoader_1.newSolutionContext(this.tools, inputs);
|
|
379
|
-
for (const v of globalSolutions) {
|
|
380
|
-
if (v.getQuestions) {
|
|
381
|
-
const res = await v.getQuestions(teamsfx_api_1.Stage.create, solutionContext);
|
|
382
|
-
if (res.isErr())
|
|
383
|
-
return res;
|
|
384
|
-
if (res.value) {
|
|
385
|
-
const solutionNode = res.value;
|
|
386
|
-
solutionNode.condition = { equals: v.name };
|
|
387
|
-
if (solutionNode.data)
|
|
388
|
-
solutionSelectNode.addChild(solutionNode);
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
createNew.addChild(new teamsfx_api_1.QTreeNode(question_1.QuestionRootFolder));
|
|
393
|
-
createNew.addChild(new teamsfx_api_1.QTreeNode(question_1.QuestionAppName));
|
|
394
|
-
// create from sample
|
|
395
|
-
const sampleNode = new teamsfx_api_1.QTreeNode(question_1.SampleSelect);
|
|
396
|
-
node.addChild(sampleNode);
|
|
397
|
-
sampleNode.condition = { equals: question_1.ScratchOptionNo.id };
|
|
398
|
-
sampleNode.addChild(new teamsfx_api_1.QTreeNode(question_1.QuestionRootFolder));
|
|
399
|
-
return teamsfx_api_1.ok(node.trim());
|
|
400
|
-
}
|
|
401
498
|
async _getQuestionsForMigrateV1Project(inputs) {
|
|
402
499
|
const node = new teamsfx_api_1.QTreeNode({ type: "group" });
|
|
403
|
-
const globalSolutions = await
|
|
500
|
+
const globalSolutions = await SolutionPluginContainer_1.getAllSolutionPlugins();
|
|
404
501
|
const solutionContext = await projectSettingsLoader_1.newSolutionContext(this.tools, inputs);
|
|
405
502
|
for (const v of globalSolutions) {
|
|
406
503
|
if (v.getQuestions) {
|
|
@@ -424,42 +521,28 @@ class FxCore {
|
|
|
424
521
|
defaultAppNameFunc.addChild(appNameQuestion);
|
|
425
522
|
return teamsfx_api_1.ok(node.trim());
|
|
426
523
|
}
|
|
427
|
-
async _getQuestions(ctx, solution, stage, inputs) {
|
|
428
|
-
const node = new teamsfx_api_1.QTreeNode({ type: "group" });
|
|
524
|
+
async _getQuestions(ctx, solution, stage, inputs, envInfo) {
|
|
429
525
|
if (stage !== teamsfx_api_1.Stage.create) {
|
|
430
|
-
|
|
526
|
+
let res = teamsfx_api_1.ok(undefined);
|
|
527
|
+
if (isV2()) {
|
|
528
|
+
const solutionV2 = solution;
|
|
529
|
+
if (solutionV2.getQuestions) {
|
|
530
|
+
res = await solutionV2.getQuestions(ctx, inputs, envInfo, this.tools.tokenProvider);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
res = await solution.getQuestions(stage, ctx);
|
|
535
|
+
}
|
|
431
536
|
if (res.isErr())
|
|
432
537
|
return res;
|
|
433
538
|
if (res.value) {
|
|
434
|
-
const
|
|
435
|
-
if (
|
|
436
|
-
node.
|
|
539
|
+
const node = res.value;
|
|
540
|
+
if (node.data) {
|
|
541
|
+
return teamsfx_api_1.ok(node.trim());
|
|
542
|
+
}
|
|
437
543
|
}
|
|
438
544
|
}
|
|
439
|
-
return teamsfx_api_1.ok(
|
|
440
|
-
}
|
|
441
|
-
async createBasicFolderStructure(inputs) {
|
|
442
|
-
try {
|
|
443
|
-
const appName = inputs[question_1.QuestionAppName.name];
|
|
444
|
-
await fs.writeFile(path.join(inputs.projectPath, `package.json`), JSON.stringify({
|
|
445
|
-
name: appName,
|
|
446
|
-
version: "0.0.1",
|
|
447
|
-
description: "",
|
|
448
|
-
author: "",
|
|
449
|
-
scripts: {
|
|
450
|
-
test: "echo \"Error: no test specified\" && exit 1",
|
|
451
|
-
},
|
|
452
|
-
devDependencies: {
|
|
453
|
-
"@microsoft/teamsfx-cli": "0.*",
|
|
454
|
-
},
|
|
455
|
-
license: "MIT",
|
|
456
|
-
}, null, 4));
|
|
457
|
-
await fs.writeFile(path.join(inputs.projectPath, `.gitignore`), `node_modules\n/.${teamsfx_api_1.ConfigFolderName}/*.env\n/.${teamsfx_api_1.ConfigFolderName}/*.userdata\n.DS_Store\n${teamsfx_api_1.ArchiveFolderName}\n${teamsfx_api_1.ArchiveLogFileName}`);
|
|
458
|
-
}
|
|
459
|
-
catch (e) {
|
|
460
|
-
return teamsfx_api_1.err(error_1.WriteFileError(e));
|
|
461
|
-
}
|
|
462
|
-
return teamsfx_api_1.ok(null);
|
|
545
|
+
return teamsfx_api_1.ok(undefined);
|
|
463
546
|
}
|
|
464
547
|
async encrypt(plaintext, inputs, ctx) {
|
|
465
548
|
return ctx.solutionContext.cryptoProvider.encrypt(plaintext);
|
|
@@ -471,39 +554,71 @@ class FxCore {
|
|
|
471
554
|
throw error_1.TaskNotSupportError(teamsfx_api_1.Stage.build);
|
|
472
555
|
}
|
|
473
556
|
async createEnv(inputs, ctx) {
|
|
557
|
+
if (!ctx)
|
|
558
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("createEnv input stuff"));
|
|
474
559
|
const projectSettings = ctx.projectSettings;
|
|
475
560
|
if (!tools_1.isMultiEnvEnabled() || !projectSettings) {
|
|
476
561
|
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
477
562
|
}
|
|
478
563
|
const core = ctx.self;
|
|
479
|
-
const
|
|
480
|
-
if (!
|
|
564
|
+
const createEnvCopyInput = await envInfoLoader_1.askNewEnvironment(ctx, inputs);
|
|
565
|
+
if (!createEnvCopyInput ||
|
|
566
|
+
!createEnvCopyInput.targetEnvName ||
|
|
567
|
+
!createEnvCopyInput.sourceEnvName) {
|
|
481
568
|
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
482
569
|
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
570
|
+
const createEnvResult = await this.createEnvCopy(createEnvCopyInput.targetEnvName, createEnvCopyInput.sourceEnvName, projectSettings, inputs, core);
|
|
571
|
+
if (createEnvResult.isErr()) {
|
|
572
|
+
return createEnvResult;
|
|
573
|
+
}
|
|
574
|
+
inputs.sourceEnvName = createEnvCopyInput.sourceEnvName;
|
|
575
|
+
inputs.targetEnvName = createEnvCopyInput.targetEnvName;
|
|
576
|
+
if (isV2()) {
|
|
577
|
+
if (!ctx.solutionV2 || !ctx.contextV2)
|
|
578
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx.solutionV2, ctx.contextV2"));
|
|
579
|
+
if (ctx.solutionV2.createEnv) {
|
|
580
|
+
inputs.copy = true;
|
|
581
|
+
return await ctx.solutionV2.createEnv(ctx.contextV2, inputs);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
else {
|
|
585
|
+
if (!ctx.solution || !ctx.solutionContext)
|
|
586
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx.solution, ctx.solutionContext"));
|
|
587
|
+
if (ctx.solution.createEnv) {
|
|
588
|
+
ctx.solutionContext.answers.copy = true;
|
|
589
|
+
return await ctx.solution.createEnv(ctx.solutionContext);
|
|
487
590
|
}
|
|
488
591
|
}
|
|
489
592
|
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
490
593
|
}
|
|
491
|
-
async createEnvWithName(targetEnvName, projectSettings, inputs
|
|
492
|
-
const
|
|
594
|
+
async createEnvWithName(targetEnvName, projectSettings, inputs) {
|
|
595
|
+
const appName = projectSettings.appName;
|
|
596
|
+
const newEnvConfig = __1.environmentManager.newEnvConfigData(appName);
|
|
493
597
|
const writeEnvResult = await __1.environmentManager.writeEnvConfig(inputs.projectPath, newEnvConfig, targetEnvName);
|
|
494
598
|
if (writeEnvResult.isErr()) {
|
|
495
599
|
return teamsfx_api_1.err(writeEnvResult.error);
|
|
496
600
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
601
|
+
this.tools.logProvider.debug(`[core] persist ${targetEnvName} env profile to path ${writeEnvResult.value}: ${JSON.stringify(newEnvConfig)}`);
|
|
602
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
603
|
+
}
|
|
604
|
+
async createEnvCopy(targetEnvName, sourceEnvName, projectSettings, inputs, core) {
|
|
605
|
+
// copy env config file
|
|
606
|
+
const targetEnvConfigFilePath = __1.environmentManager.getEnvConfigPath(targetEnvName, inputs.projectPath);
|
|
607
|
+
const sourceEnvConfigFilePath = __1.environmentManager.getEnvConfigPath(sourceEnvName, inputs.projectPath);
|
|
608
|
+
try {
|
|
609
|
+
await fs.copy(sourceEnvConfigFilePath, targetEnvConfigFilePath);
|
|
610
|
+
}
|
|
611
|
+
catch (e) {
|
|
612
|
+
return teamsfx_api_1.err(error_1.CopyFileError(e));
|
|
503
613
|
}
|
|
614
|
+
core.tools.logProvider.debug(`[core] copy env config file for ${targetEnvName} environment to path ${targetEnvConfigFilePath}`);
|
|
504
615
|
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
505
616
|
}
|
|
506
|
-
async activateEnv(
|
|
617
|
+
async activateEnv(inputs, ctx) {
|
|
618
|
+
const env = inputs.env;
|
|
619
|
+
if (!env) {
|
|
620
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("env"));
|
|
621
|
+
}
|
|
507
622
|
if (!tools_1.isMultiEnvEnabled() || !ctx.projectSettings) {
|
|
508
623
|
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
509
624
|
}
|
|
@@ -511,32 +626,83 @@ class FxCore {
|
|
|
511
626
|
if (envConfigs.isErr()) {
|
|
512
627
|
return envConfigs;
|
|
513
628
|
}
|
|
514
|
-
if (envConfigs.isErr()
|
|
629
|
+
if (envConfigs.isErr() || envConfigs.value.indexOf(env) < 0) {
|
|
515
630
|
return teamsfx_api_1.err(error_1.NonExistEnvNameError(env));
|
|
516
631
|
}
|
|
517
632
|
ctx.projectSettings.activeEnvironment = env;
|
|
518
633
|
const core = ctx.self;
|
|
519
634
|
const solutionContext = await envInfoLoader_1.loadSolutionContext(core.tools, inputs, ctx.projectSettings, ctx.projectIdMissing, env);
|
|
520
635
|
if (!solutionContext.isErr()) {
|
|
521
|
-
|
|
636
|
+
if (isV2()) {
|
|
637
|
+
//TODO core should not know the details of envInfo
|
|
638
|
+
ctx.provisionInputConfig = solutionContext.value.envInfo.config;
|
|
639
|
+
ctx.provisionOutputs = solutionContext.value.envInfo.profile;
|
|
640
|
+
ctx.envName = solutionContext.value.envInfo.envName;
|
|
641
|
+
}
|
|
642
|
+
else {
|
|
643
|
+
ctx.solutionContext = solutionContext.value;
|
|
644
|
+
}
|
|
522
645
|
}
|
|
523
646
|
this.tools.ui.showMessage("info", `[${env}] is activated.`, false);
|
|
524
647
|
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
525
648
|
}
|
|
526
|
-
async
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
649
|
+
async _getQuestionsForCreateProject(inputs) {
|
|
650
|
+
const node = new teamsfx_api_1.QTreeNode(question_1.getCreateNewOrFromSampleQuestion(inputs.platform));
|
|
651
|
+
// create new
|
|
652
|
+
const createNew = new teamsfx_api_1.QTreeNode({ type: "group" });
|
|
653
|
+
node.addChild(createNew);
|
|
654
|
+
createNew.condition = { equals: question_1.ScratchOptionYes.id };
|
|
655
|
+
const globalSolutions = isV2()
|
|
656
|
+
? await SolutionPluginContainer_1.getAllSolutionPluginsV2()
|
|
657
|
+
: await SolutionPluginContainer_1.getAllSolutionPlugins();
|
|
658
|
+
const solutionNames = globalSolutions.map((s) => s.name);
|
|
659
|
+
const selectSolution = question_1.QuestionSelectSolution;
|
|
660
|
+
selectSolution.staticOptions = solutionNames;
|
|
661
|
+
const solutionSelectNode = new teamsfx_api_1.QTreeNode(selectSolution);
|
|
662
|
+
createNew.addChild(solutionSelectNode);
|
|
663
|
+
const context = isV2()
|
|
664
|
+
? createV2Context(this, newProjectSettings())
|
|
665
|
+
: await projectSettingsLoader_1.newSolutionContext(this.tools, inputs);
|
|
666
|
+
for (const solutionPlugin of globalSolutions) {
|
|
667
|
+
let res = teamsfx_api_1.ok(undefined);
|
|
668
|
+
if (isV2()) {
|
|
669
|
+
const v2plugin = solutionPlugin;
|
|
670
|
+
res = v2plugin.getQuestionsForScaffolding
|
|
671
|
+
? await v2plugin.getQuestionsForScaffolding(context, inputs)
|
|
672
|
+
: teamsfx_api_1.ok(undefined);
|
|
673
|
+
}
|
|
674
|
+
else {
|
|
675
|
+
const v1plugin = solutionPlugin;
|
|
676
|
+
res = v1plugin.getQuestions
|
|
677
|
+
? await v1plugin.getQuestions(teamsfx_api_1.Stage.create, context)
|
|
678
|
+
: teamsfx_api_1.ok(undefined);
|
|
679
|
+
}
|
|
680
|
+
if (res.isErr())
|
|
681
|
+
return res;
|
|
682
|
+
if (res.value) {
|
|
683
|
+
const solutionNode = res.value;
|
|
684
|
+
solutionNode.condition = { equals: solutionPlugin.name };
|
|
685
|
+
if (solutionNode.data)
|
|
686
|
+
solutionSelectNode.addChild(solutionNode);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
createNew.addChild(new teamsfx_api_1.QTreeNode(question_1.QuestionRootFolder));
|
|
690
|
+
createNew.addChild(new teamsfx_api_1.QTreeNode(question_1.QuestionAppName));
|
|
691
|
+
// create from sample
|
|
692
|
+
const sampleNode = new teamsfx_api_1.QTreeNode(question_1.SampleSelect);
|
|
693
|
+
node.addChild(sampleNode);
|
|
694
|
+
sampleNode.condition = { equals: question_1.ScratchOptionNo.id };
|
|
695
|
+
sampleNode.addChild(new teamsfx_api_1.QTreeNode(question_1.QuestionRootFolder));
|
|
696
|
+
return teamsfx_api_1.ok(node.trim());
|
|
531
697
|
}
|
|
532
698
|
}
|
|
533
699
|
tslib_1.__decorate([
|
|
534
700
|
hooks_1.hooks([
|
|
535
701
|
errorHandler_1.ErrorHandlerMW,
|
|
536
702
|
questionModel_1.QuestionModelMW,
|
|
537
|
-
|
|
703
|
+
contextInjector_1.ContextInjectorMW,
|
|
538
704
|
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
539
|
-
envInfoWriter_1.EnvInfoWriterMW(
|
|
705
|
+
envInfoWriter_1.EnvInfoWriterMW(true),
|
|
540
706
|
]),
|
|
541
707
|
tslib_1.__metadata("design:type", Function),
|
|
542
708
|
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
@@ -547,7 +713,7 @@ tslib_1.__decorate([
|
|
|
547
713
|
errorHandler_1.ErrorHandlerMW,
|
|
548
714
|
migrateConditionHandler_1.MigrateConditionHandlerMW,
|
|
549
715
|
questionModel_1.QuestionModelMW,
|
|
550
|
-
|
|
716
|
+
contextInjector_1.ContextInjectorMW,
|
|
551
717
|
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
552
718
|
envInfoWriter_1.EnvInfoWriterMW(),
|
|
553
719
|
]),
|
|
@@ -559,11 +725,12 @@ tslib_1.__decorate([
|
|
|
559
725
|
hooks_1.hooks([
|
|
560
726
|
errorHandler_1.ErrorHandlerMW,
|
|
561
727
|
concurrentLocker_1.ConcurrentLockerMW,
|
|
728
|
+
projectMigrator_1.ProjectMigratorMW,
|
|
562
729
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
563
730
|
envInfoLoader_1.EnvInfoLoaderMW(tools_1.isMultiEnvEnabled()),
|
|
564
|
-
solutionLoader_1.SolutionLoaderMW(
|
|
731
|
+
solutionLoader_1.SolutionLoaderMW(),
|
|
565
732
|
questionModel_1.QuestionModelMW,
|
|
566
|
-
|
|
733
|
+
contextInjector_1.ContextInjectorMW,
|
|
567
734
|
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
568
735
|
envInfoWriter_1.EnvInfoWriterMW(),
|
|
569
736
|
]),
|
|
@@ -575,11 +742,12 @@ tslib_1.__decorate([
|
|
|
575
742
|
hooks_1.hooks([
|
|
576
743
|
errorHandler_1.ErrorHandlerMW,
|
|
577
744
|
concurrentLocker_1.ConcurrentLockerMW,
|
|
745
|
+
projectMigrator_1.ProjectMigratorMW,
|
|
578
746
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
579
747
|
envInfoLoader_1.EnvInfoLoaderMW(tools_1.isMultiEnvEnabled()),
|
|
580
|
-
solutionLoader_1.SolutionLoaderMW(
|
|
748
|
+
solutionLoader_1.SolutionLoaderMW(),
|
|
581
749
|
questionModel_1.QuestionModelMW,
|
|
582
|
-
|
|
750
|
+
contextInjector_1.ContextInjectorMW,
|
|
583
751
|
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
584
752
|
envInfoWriter_1.EnvInfoWriterMW(),
|
|
585
753
|
]),
|
|
@@ -591,13 +759,14 @@ tslib_1.__decorate([
|
|
|
591
759
|
hooks_1.hooks([
|
|
592
760
|
errorHandler_1.ErrorHandlerMW,
|
|
593
761
|
concurrentLocker_1.ConcurrentLockerMW,
|
|
762
|
+
projectMigrator_1.ProjectMigratorMW,
|
|
594
763
|
projectUpgrader_1.ProjectUpgraderMW,
|
|
595
764
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
596
765
|
envInfoLoader_1.EnvInfoLoaderMW(false),
|
|
597
766
|
localSettingsLoader_1.LocalSettingsLoaderMW,
|
|
598
|
-
solutionLoader_1.SolutionLoaderMW(
|
|
767
|
+
solutionLoader_1.SolutionLoaderMW(),
|
|
599
768
|
questionModel_1.QuestionModelMW,
|
|
600
|
-
|
|
769
|
+
contextInjector_1.ContextInjectorMW,
|
|
601
770
|
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
602
771
|
envInfoWriter_1.EnvInfoWriterMW(),
|
|
603
772
|
localSettingsWriter_1.LocalSettingsWriterMW,
|
|
@@ -610,11 +779,12 @@ tslib_1.__decorate([
|
|
|
610
779
|
hooks_1.hooks([
|
|
611
780
|
errorHandler_1.ErrorHandlerMW,
|
|
612
781
|
concurrentLocker_1.ConcurrentLockerMW,
|
|
782
|
+
projectMigrator_1.ProjectMigratorMW,
|
|
613
783
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
614
784
|
envInfoLoader_1.EnvInfoLoaderMW(tools_1.isMultiEnvEnabled()),
|
|
615
|
-
solutionLoader_1.SolutionLoaderMW(
|
|
785
|
+
solutionLoader_1.SolutionLoaderMW(),
|
|
616
786
|
questionModel_1.QuestionModelMW,
|
|
617
|
-
|
|
787
|
+
contextInjector_1.ContextInjectorMW,
|
|
618
788
|
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
619
789
|
envInfoWriter_1.EnvInfoWriterMW(),
|
|
620
790
|
]),
|
|
@@ -626,12 +796,13 @@ tslib_1.__decorate([
|
|
|
626
796
|
hooks_1.hooks([
|
|
627
797
|
errorHandler_1.ErrorHandlerMW,
|
|
628
798
|
concurrentLocker_1.ConcurrentLockerMW,
|
|
799
|
+
projectMigrator_1.ProjectMigratorMW,
|
|
629
800
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
630
801
|
envInfoLoader_1.EnvInfoLoaderMW(tools_1.isMultiEnvEnabled()),
|
|
631
802
|
localSettingsLoader_1.LocalSettingsLoaderMW,
|
|
632
|
-
solutionLoader_1.SolutionLoaderMW(
|
|
803
|
+
solutionLoader_1.SolutionLoaderMW(),
|
|
633
804
|
questionModel_1.QuestionModelMW,
|
|
634
|
-
|
|
805
|
+
contextInjector_1.ContextInjectorMW,
|
|
635
806
|
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
636
807
|
envInfoWriter_1.EnvInfoWriterMW(),
|
|
637
808
|
localSettingsWriter_1.LocalSettingsWriterMW,
|
|
@@ -645,8 +816,8 @@ tslib_1.__decorate([
|
|
|
645
816
|
errorHandler_1.ErrorHandlerMW,
|
|
646
817
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
647
818
|
envInfoLoader_1.EnvInfoLoaderMW(false),
|
|
648
|
-
solutionLoader_1.SolutionLoaderMW(
|
|
649
|
-
|
|
819
|
+
solutionLoader_1.SolutionLoaderMW(),
|
|
820
|
+
contextInjector_1.ContextInjectorMW,
|
|
650
821
|
envInfoWriter_1.EnvInfoWriterMW(),
|
|
651
822
|
]),
|
|
652
823
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -658,8 +829,8 @@ tslib_1.__decorate([
|
|
|
658
829
|
errorHandler_1.ErrorHandlerMW,
|
|
659
830
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
660
831
|
envInfoLoader_1.EnvInfoLoaderMW(false),
|
|
661
|
-
solutionLoader_1.SolutionLoaderMW(
|
|
662
|
-
|
|
832
|
+
solutionLoader_1.SolutionLoaderMW(),
|
|
833
|
+
contextInjector_1.ContextInjectorMW,
|
|
663
834
|
envInfoWriter_1.EnvInfoWriterMW(),
|
|
664
835
|
]),
|
|
665
836
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -669,10 +840,12 @@ tslib_1.__decorate([
|
|
|
669
840
|
tslib_1.__decorate([
|
|
670
841
|
hooks_1.hooks([
|
|
671
842
|
errorHandler_1.ErrorHandlerMW,
|
|
843
|
+
concurrentLocker_1.ConcurrentLockerMW,
|
|
844
|
+
projectMigrator_1.ProjectMigratorMW,
|
|
672
845
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
673
846
|
envInfoLoader_1.EnvInfoLoaderMW(tools_1.isMultiEnvEnabled()),
|
|
674
847
|
localSettingsLoader_1.LocalSettingsLoaderMW,
|
|
675
|
-
|
|
848
|
+
contextInjector_1.ContextInjectorMW,
|
|
676
849
|
]),
|
|
677
850
|
tslib_1.__metadata("design:type", Function),
|
|
678
851
|
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
@@ -681,27 +854,12 @@ tslib_1.__decorate([
|
|
|
681
854
|
tslib_1.__decorate([
|
|
682
855
|
hooks_1.hooks([
|
|
683
856
|
errorHandler_1.ErrorHandlerMW,
|
|
684
|
-
|
|
685
|
-
envInfoLoader_1.EnvInfoLoaderMW(false),
|
|
686
|
-
contextInjecter_1.ContextInjecterMW,
|
|
687
|
-
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
688
|
-
envInfoWriter_1.EnvInfoWriterMW(),
|
|
689
|
-
]),
|
|
690
|
-
tslib_1.__metadata("design:type", Function),
|
|
691
|
-
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
692
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
693
|
-
], FxCore.prototype, "setSubscriptionInfo", null);
|
|
694
|
-
tslib_1.__decorate([
|
|
695
|
-
hooks_1.hooks([
|
|
696
|
-
errorHandler_1.ErrorHandlerMW,
|
|
697
|
-
concurrentLocker_1.ConcurrentLockerMW,
|
|
857
|
+
projectMigrator_1.ProjectMigratorMW,
|
|
698
858
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
699
859
|
envInfoLoader_1.EnvInfoLoaderMW(tools_1.isMultiEnvEnabled()),
|
|
700
|
-
solutionLoader_1.SolutionLoaderMW(
|
|
860
|
+
solutionLoader_1.SolutionLoaderMW(),
|
|
701
861
|
questionModel_1.QuestionModelMW,
|
|
702
|
-
|
|
703
|
-
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
704
|
-
envInfoWriter_1.EnvInfoWriterMW(),
|
|
862
|
+
contextInjector_1.ContextInjectorMW,
|
|
705
863
|
]),
|
|
706
864
|
tslib_1.__metadata("design:type", Function),
|
|
707
865
|
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
@@ -710,14 +868,12 @@ tslib_1.__decorate([
|
|
|
710
868
|
tslib_1.__decorate([
|
|
711
869
|
hooks_1.hooks([
|
|
712
870
|
errorHandler_1.ErrorHandlerMW,
|
|
713
|
-
|
|
871
|
+
projectMigrator_1.ProjectMigratorMW,
|
|
714
872
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
715
873
|
envInfoLoader_1.EnvInfoLoaderMW(tools_1.isMultiEnvEnabled()),
|
|
716
|
-
solutionLoader_1.SolutionLoaderMW(
|
|
874
|
+
solutionLoader_1.SolutionLoaderMW(),
|
|
717
875
|
questionModel_1.QuestionModelMW,
|
|
718
|
-
|
|
719
|
-
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
720
|
-
envInfoWriter_1.EnvInfoWriterMW(),
|
|
876
|
+
contextInjector_1.ContextInjectorMW,
|
|
721
877
|
]),
|
|
722
878
|
tslib_1.__metadata("design:type", Function),
|
|
723
879
|
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
@@ -726,14 +882,12 @@ tslib_1.__decorate([
|
|
|
726
882
|
tslib_1.__decorate([
|
|
727
883
|
hooks_1.hooks([
|
|
728
884
|
errorHandler_1.ErrorHandlerMW,
|
|
729
|
-
|
|
885
|
+
projectMigrator_1.ProjectMigratorMW,
|
|
730
886
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
731
887
|
envInfoLoader_1.EnvInfoLoaderMW(tools_1.isMultiEnvEnabled()),
|
|
732
|
-
solutionLoader_1.SolutionLoaderMW(
|
|
888
|
+
solutionLoader_1.SolutionLoaderMW(),
|
|
733
889
|
questionModel_1.QuestionModelMW,
|
|
734
|
-
|
|
735
|
-
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
736
|
-
envInfoWriter_1.EnvInfoWriterMW(),
|
|
890
|
+
contextInjector_1.ContextInjectorMW,
|
|
737
891
|
]),
|
|
738
892
|
tslib_1.__metadata("design:type", Function),
|
|
739
893
|
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
@@ -744,7 +898,7 @@ tslib_1.__decorate([
|
|
|
744
898
|
errorHandler_1.ErrorHandlerMW,
|
|
745
899
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
746
900
|
envInfoLoader_1.EnvInfoLoaderMW(false),
|
|
747
|
-
|
|
901
|
+
contextInjector_1.ContextInjectorMW,
|
|
748
902
|
envInfoWriter_1.EnvInfoWriterMW(),
|
|
749
903
|
]),
|
|
750
904
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -756,7 +910,7 @@ tslib_1.__decorate([
|
|
|
756
910
|
errorHandler_1.ErrorHandlerMW,
|
|
757
911
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
758
912
|
envInfoLoader_1.EnvInfoLoaderMW(false),
|
|
759
|
-
|
|
913
|
+
contextInjector_1.ContextInjectorMW,
|
|
760
914
|
envInfoWriter_1.EnvInfoWriterMW(),
|
|
761
915
|
]),
|
|
762
916
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -764,7 +918,13 @@ tslib_1.__decorate([
|
|
|
764
918
|
tslib_1.__metadata("design:returntype", Promise)
|
|
765
919
|
], FxCore.prototype, "decrypt", null);
|
|
766
920
|
tslib_1.__decorate([
|
|
767
|
-
hooks_1.hooks([
|
|
921
|
+
hooks_1.hooks([
|
|
922
|
+
errorHandler_1.ErrorHandlerMW,
|
|
923
|
+
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
924
|
+
solutionLoader_1.SolutionLoaderMW(),
|
|
925
|
+
envInfoLoader_1.EnvInfoLoaderMW(tools_1.isMultiEnvEnabled()),
|
|
926
|
+
contextInjector_1.ContextInjectorMW,
|
|
927
|
+
]),
|
|
768
928
|
tslib_1.__metadata("design:type", Function),
|
|
769
929
|
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
770
930
|
tslib_1.__metadata("design:returntype", Promise)
|
|
@@ -772,16 +932,151 @@ tslib_1.__decorate([
|
|
|
772
932
|
tslib_1.__decorate([
|
|
773
933
|
hooks_1.hooks([
|
|
774
934
|
errorHandler_1.ErrorHandlerMW,
|
|
935
|
+
projectMigrator_1.ProjectMigratorMW,
|
|
775
936
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
776
|
-
solutionLoader_1.SolutionLoaderMW(
|
|
777
|
-
|
|
937
|
+
solutionLoader_1.SolutionLoaderMW(),
|
|
938
|
+
contextInjector_1.ContextInjectorMW,
|
|
778
939
|
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
779
940
|
]),
|
|
780
941
|
tslib_1.__metadata("design:type", Function),
|
|
781
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
942
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
782
943
|
tslib_1.__metadata("design:returntype", Promise)
|
|
783
944
|
], FxCore.prototype, "activateEnv", null);
|
|
784
945
|
exports.FxCore = FxCore;
|
|
946
|
+
async function createBasicFolderStructure(inputs) {
|
|
947
|
+
if (!inputs.projectPath) {
|
|
948
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("projectPath"));
|
|
949
|
+
}
|
|
950
|
+
try {
|
|
951
|
+
const appName = inputs[question_1.QuestionAppName.name];
|
|
952
|
+
await fs.writeFile(path.join(inputs.projectPath, `package.json`), JSON.stringify({
|
|
953
|
+
name: appName,
|
|
954
|
+
version: "0.0.1",
|
|
955
|
+
description: "",
|
|
956
|
+
author: "",
|
|
957
|
+
scripts: {
|
|
958
|
+
test: 'echo "Error: no test specified" && exit 1',
|
|
959
|
+
},
|
|
960
|
+
devDependencies: {
|
|
961
|
+
"@microsoft/teamsfx-cli": "0.*",
|
|
962
|
+
},
|
|
963
|
+
license: "MIT",
|
|
964
|
+
}, null, 4));
|
|
965
|
+
await fs.writeFile(path.join(inputs.projectPath, `.gitignore`), tools_1.isMultiEnvEnabled()
|
|
966
|
+
? [
|
|
967
|
+
"node_modules",
|
|
968
|
+
`.${teamsfx_api_1.ConfigFolderName}/${teamsfx_api_1.InputConfigsFolderName}/${localSettingsProvider_1.localSettingsFileName}`,
|
|
969
|
+
`.${teamsfx_api_1.ConfigFolderName}/${teamsfx_api_1.PublishProfilesFolderName}/*.userdata`,
|
|
970
|
+
".DS_Store",
|
|
971
|
+
`${teamsfx_api_1.ArchiveFolderName}`,
|
|
972
|
+
`${teamsfx_api_1.ArchiveLogFileName}`,
|
|
973
|
+
].join("\n")
|
|
974
|
+
: `node_modules\n/.${teamsfx_api_1.ConfigFolderName}/*.env\n/.${teamsfx_api_1.ConfigFolderName}/*.userdata\n.DS_Store\n${teamsfx_api_1.ArchiveFolderName}\n${teamsfx_api_1.ArchiveLogFileName}`);
|
|
975
|
+
}
|
|
976
|
+
catch (e) {
|
|
977
|
+
return teamsfx_api_1.err(error_1.WriteFileError(e));
|
|
978
|
+
}
|
|
979
|
+
return teamsfx_api_1.ok(null);
|
|
980
|
+
}
|
|
981
|
+
exports.createBasicFolderStructure = createBasicFolderStructure;
|
|
982
|
+
async function downloadSample(fxcore, inputs) {
|
|
983
|
+
const folder = inputs[question_1.QuestionRootFolder.name];
|
|
984
|
+
const sample = inputs[question_1.CoreQuestionNames.Samples];
|
|
985
|
+
if (sample && sample.data && folder) {
|
|
986
|
+
const url = sample.data;
|
|
987
|
+
const sampleId = sample.id;
|
|
988
|
+
const sampleAppPath = path.resolve(folder, sampleId);
|
|
989
|
+
if ((await fs.pathExists(sampleAppPath)) && (await fs.readdir(sampleAppPath)).length > 0) {
|
|
990
|
+
return teamsfx_api_1.err(error_1.ProjectFolderExistError(sampleAppPath));
|
|
991
|
+
}
|
|
992
|
+
let fetchRes;
|
|
993
|
+
const task1 = {
|
|
994
|
+
name: `Download code from '${url}'`,
|
|
995
|
+
run: async (...args) => {
|
|
996
|
+
try {
|
|
997
|
+
telemetry_1.sendTelemetryEvent(telemetry_1.Component.core, telemetry_1.TelemetryEvent.DownloadSampleStart, {
|
|
998
|
+
[telemetry_1.TelemetryProperty.SampleAppName]: sample.id,
|
|
999
|
+
module: "fx-core",
|
|
1000
|
+
});
|
|
1001
|
+
fetchRes = await tools_1.fetchCodeZip(url);
|
|
1002
|
+
if (fetchRes !== undefined) {
|
|
1003
|
+
telemetry_1.sendTelemetryEvent(telemetry_1.Component.core, telemetry_1.TelemetryEvent.DownloadSample, {
|
|
1004
|
+
[telemetry_1.TelemetryProperty.SampleAppName]: sample.id,
|
|
1005
|
+
[telemetry_1.TelemetryProperty.Success]: telemetry_1.TelemetrySuccess.Yes,
|
|
1006
|
+
module: "fx-core",
|
|
1007
|
+
});
|
|
1008
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
1009
|
+
}
|
|
1010
|
+
else
|
|
1011
|
+
return teamsfx_api_1.err(error_1.FetchSampleError());
|
|
1012
|
+
}
|
|
1013
|
+
catch (e) {
|
|
1014
|
+
telemetry_1.sendTelemetryErrorEvent(telemetry_1.Component.core, telemetry_1.TelemetryEvent.DownloadSample, teamsfx_api_1.assembleError(e), {
|
|
1015
|
+
[telemetry_1.TelemetryProperty.SampleAppName]: sample.id,
|
|
1016
|
+
module: "fx-core",
|
|
1017
|
+
});
|
|
1018
|
+
return teamsfx_api_1.err(teamsfx_api_1.assembleError(e));
|
|
1019
|
+
}
|
|
1020
|
+
},
|
|
1021
|
+
};
|
|
1022
|
+
const task2 = {
|
|
1023
|
+
name: "Save and unzip package",
|
|
1024
|
+
run: async (...args) => {
|
|
1025
|
+
if (fetchRes) {
|
|
1026
|
+
await tools_1.saveFilesRecursively(new adm_zip_1.default(fetchRes.data), sampleId, folder);
|
|
1027
|
+
}
|
|
1028
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
1029
|
+
},
|
|
1030
|
+
};
|
|
1031
|
+
const task3 = {
|
|
1032
|
+
name: "post process",
|
|
1033
|
+
run: async (...args) => {
|
|
1034
|
+
await tools_1.downloadSampleHook(sampleId, sampleAppPath);
|
|
1035
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
1036
|
+
},
|
|
1037
|
+
};
|
|
1038
|
+
const group = new teamsfx_api_1.GroupOfTasks([task1, task2, task3], {
|
|
1039
|
+
sequential: true,
|
|
1040
|
+
fastFail: true,
|
|
1041
|
+
});
|
|
1042
|
+
const runRes = await fxcore.tools.ui.runWithProgress(group, {
|
|
1043
|
+
showProgress: true,
|
|
1044
|
+
cancellable: false,
|
|
1045
|
+
});
|
|
1046
|
+
if (runRes.isOk()) {
|
|
1047
|
+
return teamsfx_api_1.ok(sampleAppPath);
|
|
1048
|
+
}
|
|
1049
|
+
else {
|
|
1050
|
+
return teamsfx_api_1.err(runRes.error);
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
return teamsfx_api_1.err(error_1.InvalidInputError(`invalid answer for '${question_1.CoreQuestionNames.Samples}'`, inputs));
|
|
1054
|
+
}
|
|
1055
|
+
exports.downloadSample = downloadSample;
|
|
1056
|
+
function newProjectSettings() {
|
|
1057
|
+
const projectSettings = {
|
|
1058
|
+
appName: "",
|
|
1059
|
+
projectId: uuid.v4(),
|
|
1060
|
+
version: "2.0.0",
|
|
1061
|
+
solutionSettings: {
|
|
1062
|
+
name: "",
|
|
1063
|
+
},
|
|
1064
|
+
};
|
|
1065
|
+
return projectSettings;
|
|
1066
|
+
}
|
|
1067
|
+
exports.newProjectSettings = newProjectSettings;
|
|
1068
|
+
function createV2Context(core, projectSettings) {
|
|
1069
|
+
const context = {
|
|
1070
|
+
userInteraction: core.tools.ui,
|
|
1071
|
+
logProvider: core.tools.logProvider,
|
|
1072
|
+
telemetryReporter: core.tools.telemetryReporter,
|
|
1073
|
+
cryptoProvider: core.tools.cryptoProvider,
|
|
1074
|
+
permissionRequestProvider: core.tools.permissionRequest,
|
|
1075
|
+
projectSetting: projectSettings,
|
|
1076
|
+
};
|
|
1077
|
+
return context;
|
|
1078
|
+
}
|
|
1079
|
+
exports.createV2Context = createV2Context;
|
|
785
1080
|
tslib_1.__exportStar(require("./error"), exports);
|
|
786
1081
|
tslib_1.__exportStar(require("./tools"), exports);
|
|
787
1082
|
//# sourceMappingURL=index.js.map
|