@microsoft/teamsfx-core 1.1.0 → 1.1.2-alpha.9f3cd667.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/armInterface.d.ts +1 -1
- package/build/common/armInterface.d.ts.map +1 -1
- package/build/common/constants.d.ts +3 -1
- package/build/common/constants.d.ts.map +1 -1
- package/build/common/constants.js +3 -1
- package/build/common/constants.js.map +1 -1
- package/build/common/local/localEnvManager.d.ts +17 -0
- package/build/common/local/localEnvManager.d.ts.map +1 -0
- package/build/common/local/localEnvManager.js +72 -0
- package/build/common/local/localEnvManager.js.map +1 -0
- package/build/common/localSettingsProvider.d.ts +3 -3
- package/build/common/localSettingsProvider.d.ts.map +1 -1
- package/build/common/localSettingsProvider.js +11 -6
- package/build/common/localSettingsProvider.js.map +1 -1
- package/build/common/samples-config.json +14 -0
- package/build/common/tools.d.ts +11 -1
- package/build/common/tools.d.ts.map +1 -1
- package/build/common/tools.js +23 -10
- package/build/common/tools.js.map +1 -1
- package/build/core/SolutionPluginContainer.d.ts +2 -1
- package/build/core/SolutionPluginContainer.d.ts.map +1 -1
- package/build/core/SolutionPluginContainer.js +9 -1
- package/build/core/SolutionPluginContainer.js.map +1 -1
- package/build/core/environment.d.ts +4 -3
- package/build/core/environment.d.ts.map +1 -1
- package/build/core/environment.js +37 -7
- package/build/core/environment.js.map +1 -1
- package/build/core/error.d.ts +2 -1
- package/build/core/error.d.ts.map +1 -1
- package/build/core/error.js +7 -3
- package/build/core/error.js.map +1 -1
- package/build/core/index.d.ts +52 -13
- package/build/core/index.d.ts.map +1 -1
- package/build/core/index.js +580 -201
- package/build/core/index.js.map +1 -1
- package/build/core/middleware/concurrentLocker.d.ts.map +1 -1
- package/build/core/middleware/concurrentLocker.js +6 -8
- package/build/core/middleware/concurrentLocker.js.map +1 -1
- package/build/core/middleware/envInfoLoader.d.ts +5 -1
- package/build/core/middleware/envInfoLoader.d.ts.map +1 -1
- package/build/core/middleware/envInfoLoader.js +48 -39
- package/build/core/middleware/envInfoLoader.js.map +1 -1
- package/build/core/middleware/envInfoLoaderV3.d.ts +3 -0
- package/build/core/middleware/envInfoLoaderV3.d.ts.map +1 -0
- package/build/core/middleware/envInfoLoaderV3.js +64 -0
- package/build/core/middleware/envInfoLoaderV3.js.map +1 -0
- package/build/core/middleware/envInfoWriter.js +2 -3
- package/build/core/middleware/envInfoWriter.js.map +1 -1
- package/build/core/middleware/envInfoWriterV3.d.ts +6 -0
- package/build/core/middleware/envInfoWriterV3.d.ts.map +1 -0
- package/build/core/middleware/envInfoWriterV3.js +63 -0
- package/build/core/middleware/envInfoWriterV3.js.map +1 -0
- package/build/core/middleware/errorHandler.d.ts.map +1 -1
- package/build/core/middleware/errorHandler.js +3 -5
- package/build/core/middleware/errorHandler.js.map +1 -1
- package/build/core/middleware/localSettingsWriter.d.ts.map +1 -1
- package/build/core/middleware/localSettingsWriter.js +1 -2
- package/build/core/middleware/localSettingsWriter.js.map +1 -1
- package/build/core/middleware/projectMigrator.d.ts.map +1 -1
- package/build/core/middleware/projectMigrator.js +21 -51
- package/build/core/middleware/projectMigrator.js.map +1 -1
- package/build/core/middleware/projectSettingsLoader.js +1 -1
- package/build/core/middleware/projectSettingsLoader.js.map +1 -1
- package/build/core/middleware/projectSettingsLoaderV3.d.ts +4 -0
- package/build/core/middleware/projectSettingsLoaderV3.d.ts.map +1 -0
- package/build/core/middleware/projectSettingsLoaderV3.js +49 -0
- package/build/core/middleware/projectSettingsLoaderV3.js.map +1 -0
- package/build/core/middleware/projectSettingsWriter.d.ts.map +1 -1
- package/build/core/middleware/projectSettingsWriter.js +2 -2
- package/build/core/middleware/projectSettingsWriter.js.map +1 -1
- package/build/core/middleware/questionModel.d.ts +14 -1
- package/build/core/middleware/questionModel.d.ts.map +1 -1
- package/build/core/middleware/questionModel.js +335 -14
- package/build/core/middleware/questionModel.js.map +1 -1
- package/build/core/middleware/solutionLoader.d.ts +3 -2
- package/build/core/middleware/solutionLoader.d.ts.map +1 -1
- package/build/core/middleware/solutionLoader.js +21 -23
- package/build/core/middleware/solutionLoader.js.map +1 -1
- package/build/core/middleware/solutionLoaderV3.d.ts +4 -0
- package/build/core/middleware/solutionLoaderV3.d.ts.map +1 -0
- package/build/core/middleware/solutionLoaderV3.js +19 -0
- package/build/core/middleware/solutionLoaderV3.js.map +1 -0
- package/build/core/question.d.ts +9 -1
- package/build/core/question.d.ts.map +1 -1
- package/build/core/question.js +113 -3
- package/build/core/question.js.map +1 -1
- package/build/core/tools.d.ts +2 -1
- package/build/core/tools.d.ts.map +1 -1
- package/build/core/tools.js +15 -1
- package/build/core/tools.js.map +1 -1
- package/build/plugins/resource/aad/plugin.d.ts.map +1 -1
- package/build/plugins/resource/aad/plugin.js +1 -10
- package/build/plugins/resource/aad/plugin.js.map +1 -1
- package/build/plugins/resource/apim/managers/apimManager.d.ts.map +1 -1
- package/build/plugins/resource/apim/managers/apimManager.js +5 -7
- package/build/plugins/resource/apim/managers/apimManager.js.map +1 -1
- package/build/plugins/resource/appstudio/appStudio.d.ts +1 -1
- package/build/plugins/resource/appstudio/appStudio.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/appStudio.js +106 -85
- package/build/plugins/resource/appstudio/appStudio.js.map +1 -1
- package/build/plugins/resource/appstudio/constants.d.ts +6 -1
- package/build/plugins/resource/appstudio/constants.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/constants.js +6 -1
- package/build/plugins/resource/appstudio/constants.js.map +1 -1
- package/build/plugins/resource/appstudio/errors.d.ts +1 -1
- package/build/plugins/resource/appstudio/errors.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/errors.js +2 -1
- package/build/plugins/resource/appstudio/errors.js.map +1 -1
- package/build/plugins/resource/appstudio/index.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/index.js +10 -2
- package/build/plugins/resource/appstudio/index.js.map +1 -1
- package/build/plugins/resource/appstudio/plugin.d.ts +2 -3
- package/build/plugins/resource/appstudio/plugin.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/plugin.js +92 -116
- package/build/plugins/resource/appstudio/plugin.js.map +1 -1
- package/build/plugins/resource/bot/index.d.ts.map +1 -1
- package/build/plugins/resource/bot/index.js +5 -1
- package/build/plugins/resource/bot/index.js.map +1 -1
- package/build/plugins/resource/bot/plugin.d.ts.map +1 -1
- package/build/plugins/resource/bot/plugin.js +9 -11
- package/build/plugins/resource/bot/plugin.js.map +1 -1
- package/build/plugins/resource/frontend/constants.d.ts +1 -7
- package/build/plugins/resource/frontend/constants.d.ts.map +1 -1
- package/build/plugins/resource/frontend/constants.js +2 -9
- package/build/plugins/resource/frontend/constants.js.map +1 -1
- package/build/plugins/resource/frontend/env.d.ts +21 -0
- package/build/plugins/resource/frontend/env.d.ts.map +1 -0
- package/build/plugins/resource/frontend/env.js +82 -0
- package/build/plugins/resource/frontend/env.js.map +1 -0
- package/build/plugins/resource/frontend/ops/deploy.d.ts +2 -1
- package/build/plugins/resource/frontend/ops/deploy.d.ts.map +1 -1
- package/build/plugins/resource/frontend/ops/deploy.js +2 -2
- package/build/plugins/resource/frontend/ops/deploy.js.map +1 -1
- package/build/plugins/resource/frontend/plugin.d.ts +2 -0
- package/build/plugins/resource/frontend/plugin.d.ts.map +1 -1
- package/build/plugins/resource/frontend/plugin.js +28 -16
- package/build/plugins/resource/frontend/plugin.js.map +1 -1
- package/build/plugins/resource/frontend/utils/environment-utils.d.ts.map +1 -1
- package/build/plugins/resource/frontend/utils/environment-utils.js +4 -2
- package/build/plugins/resource/frontend/utils/environment-utils.js.map +1 -1
- package/build/plugins/resource/frontend/utils.d.ts +6 -1
- package/build/plugins/resource/frontend/utils.d.ts.map +1 -1
- package/build/plugins/resource/frontend/utils.js +17 -6
- package/build/plugins/resource/frontend/utils.js.map +1 -1
- package/build/plugins/resource/function/plugin.d.ts.map +1 -1
- package/build/plugins/resource/function/plugin.js +7 -9
- package/build/plugins/resource/function/plugin.js.map +1 -1
- package/build/plugins/resource/function/utils/depsChecker/checker.d.ts +0 -1
- package/build/plugins/resource/function/utils/depsChecker/checker.d.ts.map +1 -1
- package/build/plugins/resource/function/utils/depsChecker/checker.js +2 -2
- package/build/plugins/resource/function/utils/depsChecker/checker.js.map +1 -1
- package/build/plugins/resource/function/utils/depsChecker/common.d.ts +1 -2
- package/build/plugins/resource/function/utils/depsChecker/common.d.ts.map +1 -1
- package/build/plugins/resource/function/utils/depsChecker/common.js +2 -6
- package/build/plugins/resource/function/utils/depsChecker/common.js.map +1 -1
- package/build/plugins/resource/function/utils/depsChecker/funcPluginAdapter.d.ts +0 -1
- package/build/plugins/resource/function/utils/depsChecker/funcPluginAdapter.d.ts.map +1 -1
- package/build/plugins/resource/function/utils/depsChecker/funcPluginAdapter.js +1 -23
- package/build/plugins/resource/function/utils/depsChecker/funcPluginAdapter.js.map +1 -1
- package/build/plugins/resource/identity/index.d.ts.map +1 -1
- package/build/plugins/resource/identity/index.js +11 -13
- package/build/plugins/resource/identity/index.js.map +1 -1
- package/build/plugins/resource/keyvault/plugin.d.ts.map +1 -1
- package/build/plugins/resource/keyvault/plugin.js +7 -9
- package/build/plugins/resource/keyvault/plugin.js.map +1 -1
- package/build/plugins/resource/localdebug/certificate.js +3 -3
- package/build/plugins/resource/localdebug/certificate.js.map +1 -1
- package/build/plugins/resource/localdebug/index.d.ts +0 -1
- package/build/plugins/resource/localdebug/index.d.ts.map +1 -1
- package/build/plugins/resource/localdebug/index.js +3 -280
- package/build/plugins/resource/localdebug/index.js.map +1 -1
- package/build/plugins/resource/localdebug/util/error.d.ts.map +1 -1
- package/build/plugins/resource/localdebug/util/error.js +1 -1
- package/build/plugins/resource/localdebug/util/error.js.map +1 -1
- package/build/plugins/resource/localdebug/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/localdebug/v2/index.js +34 -1
- package/build/plugins/resource/localdebug/v2/index.js.map +1 -1
- package/build/plugins/resource/simpleauth/plugin.d.ts.map +1 -1
- package/build/plugins/resource/simpleauth/plugin.js +7 -9
- package/build/plugins/resource/simpleauth/plugin.js.map +1 -1
- package/build/plugins/resource/simpleauth/utils/common.d.ts.map +1 -1
- package/build/plugins/resource/simpleauth/utils/common.js +3 -1
- package/build/plugins/resource/simpleauth/utils/common.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/constants.d.ts +1 -0
- package/build/plugins/resource/sql/constants.d.ts.map +1 -1
- package/build/plugins/resource/sql/constants.js +1 -0
- package/build/plugins/resource/sql/constants.js.map +1 -1
- package/build/plugins/resource/sql/errors.d.ts +1 -0
- package/build/plugins/resource/sql/errors.d.ts.map +1 -1
- package/build/plugins/resource/sql/errors.js +1 -0
- package/build/plugins/resource/sql/errors.js.map +1 -1
- package/build/plugins/resource/sql/managementClient.d.ts +3 -1
- package/build/plugins/resource/sql/managementClient.d.ts.map +1 -1
- package/build/plugins/resource/sql/managementClient.js +11 -2
- package/build/plugins/resource/sql/managementClient.js.map +1 -1
- package/build/plugins/resource/sql/plugin.d.ts +3 -0
- package/build/plugins/resource/sql/plugin.d.ts.map +1 -1
- package/build/plugins/resource/sql/plugin.js +37 -27
- package/build/plugins/resource/sql/plugin.js.map +1 -1
- package/build/plugins/resource/sql/sqlClient.d.ts +1 -1
- package/build/plugins/resource/sql/sqlClient.d.ts.map +1 -1
- package/build/plugins/resource/sql/sqlClient.js +15 -24
- package/build/plugins/resource/sql/sqlClient.js.map +1 -1
- package/build/plugins/resource/sql/utils/checkInput.js +2 -2
- package/build/plugins/resource/sql/utils/checkInput.js.map +1 -1
- package/build/plugins/resource/sql/utils/message.d.ts +0 -1
- package/build/plugins/resource/sql/utils/message.d.ts.map +1 -1
- package/build/plugins/resource/sql/utils/message.js +0 -1
- package/build/plugins/resource/sql/utils/message.js.map +1 -1
- package/build/plugins/solution/fx-solution/arm.d.ts +15 -5
- package/build/plugins/solution/fx-solution/arm.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/arm.js +373 -102
- package/build/plugins/solution/fx-solution/arm.js.map +1 -1
- package/build/plugins/solution/fx-solution/commonQuestions.d.ts +13 -2
- package/build/plugins/solution/fx-solution/commonQuestions.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/commonQuestions.js +24 -26
- package/build/plugins/solution/fx-solution/commonQuestions.js.map +1 -1
- package/build/plugins/solution/fx-solution/debug/constants.d.ts +9 -0
- package/build/plugins/solution/fx-solution/debug/constants.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/debug/constants.js +16 -0
- package/build/plugins/solution/fx-solution/debug/constants.js.map +1 -0
- package/build/plugins/solution/fx-solution/debug/error.d.ts +7 -0
- package/build/plugins/solution/fx-solution/debug/error.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/debug/error.js +28 -0
- package/build/plugins/solution/fx-solution/debug/error.js.map +1 -0
- package/build/plugins/solution/fx-solution/debug/provisionLocal.d.ts +3 -0
- package/build/plugins/solution/fx-solution/debug/provisionLocal.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/debug/provisionLocal.js +107 -0
- package/build/plugins/solution/fx-solution/debug/provisionLocal.js.map +1 -0
- package/build/plugins/solution/fx-solution/debug/scaffolding.d.ts +3 -0
- package/build/plugins/solution/fx-solution/debug/scaffolding.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/debug/scaffolding.js +153 -0
- package/build/plugins/solution/fx-solution/debug/scaffolding.js.map +1 -0
- package/build/plugins/{resource/localdebug → solution/fx-solution/debug}/util/codespace.d.ts +0 -0
- package/build/plugins/solution/fx-solution/debug/util/codespace.d.ts.map +1 -0
- package/build/plugins/{resource/localdebug → solution/fx-solution/debug}/util/codespace.js +0 -0
- package/build/plugins/solution/fx-solution/debug/util/codespace.js.map +1 -0
- package/build/plugins/solution/fx-solution/debug/util/contextHelper.d.ts +10 -0
- package/build/plugins/solution/fx-solution/debug/util/contextHelper.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/debug/util/contextHelper.js +34 -0
- package/build/plugins/solution/fx-solution/debug/util/contextHelper.js.map +1 -0
- package/build/plugins/{resource/localdebug → solution/fx-solution/debug/util}/launch.d.ts +0 -0
- package/build/plugins/solution/fx-solution/debug/util/launch.d.ts.map +1 -0
- package/build/plugins/{resource/localdebug → solution/fx-solution/debug/util}/launch.js +1 -1
- package/build/plugins/solution/fx-solution/debug/util/launch.js.map +1 -0
- package/build/plugins/{resource/localdebug → solution/fx-solution/debug}/util/ngrok.d.ts +0 -0
- package/build/plugins/solution/fx-solution/debug/util/ngrok.d.ts.map +1 -0
- package/build/plugins/{resource/localdebug → solution/fx-solution/debug}/util/ngrok.js +2 -2
- package/build/plugins/solution/fx-solution/debug/util/ngrok.js.map +1 -0
- package/build/plugins/solution/fx-solution/debug/util/settings.d.ts +2 -0
- package/build/plugins/solution/fx-solution/debug/util/settings.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/debug/util/settings.js +22 -0
- package/build/plugins/solution/fx-solution/debug/util/settings.js.map +1 -0
- package/build/plugins/{resource/localdebug → solution/fx-solution/debug/util}/tasks.d.ts +0 -0
- package/build/plugins/solution/fx-solution/debug/util/tasks.d.ts.map +1 -0
- package/build/plugins/{resource/localdebug → solution/fx-solution/debug/util}/tasks.js +6 -6
- package/build/plugins/solution/fx-solution/debug/util/tasks.js.map +1 -0
- package/build/plugins/solution/fx-solution/debug/util/telemetry.d.ts +27 -0
- package/build/plugins/solution/fx-solution/debug/util/telemetry.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/debug/util/telemetry.js +81 -0
- package/build/plugins/solution/fx-solution/debug/util/telemetry.js.map +1 -0
- package/build/plugins/solution/fx-solution/index.d.ts +1 -0
- package/build/plugins/solution/fx-solution/index.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/index.js +1 -0
- package/build/plugins/solution/fx-solution/index.js.map +1 -1
- package/build/plugins/solution/fx-solution/question.d.ts +2 -2
- package/build/plugins/solution/fx-solution/question.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/question.js +2 -32
- package/build/plugins/solution/fx-solution/question.js.map +1 -1
- package/build/plugins/solution/fx-solution/solution.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/solution.js +9 -5
- package/build/plugins/solution/fx-solution/solution.js.map +1 -1
- package/build/plugins/solution/fx-solution/utils/depsChecker/bicepChecker.d.ts +2 -2
- package/build/plugins/solution/fx-solution/utils/depsChecker/bicepChecker.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/utils/depsChecker/bicepChecker.js +13 -14
- package/build/plugins/solution/fx-solution/utils/depsChecker/bicepChecker.js.map +1 -1
- package/build/plugins/solution/fx-solution/utils/progressHelper.d.ts +2 -2
- package/build/plugins/solution/fx-solution/utils/progressHelper.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/utils/progressHelper.js +4 -4
- package/build/plugins/solution/fx-solution/utils/progressHelper.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/constants.d.ts +2 -0
- package/build/plugins/solution/fx-solution/v2/constants.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v2/constants.js +7 -0
- package/build/plugins/solution/fx-solution/v2/constants.js.map +1 -0
- package/build/plugins/solution/fx-solution/v2/createEnv.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/createEnv.js +1 -1
- package/build/plugins/solution/fx-solution/v2/createEnv.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/executeUserTask.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/executeUserTask.js +7 -4
- package/build/plugins/solution/fx-solution/v2/executeUserTask.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/getQuestions.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/getQuestions.js +67 -25
- package/build/plugins/solution/fx-solution/v2/getQuestions.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/listAllCollaborators.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/provision.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/provision.js +12 -0
- package/build/plugins/solution/fx-solution/v2/provision.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/provisionLocal.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/provisionLocal.js +5 -0
- package/build/plugins/solution/fx-solution/v2/provisionLocal.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/scaffolding.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/scaffolding.js +5 -0
- package/build/plugins/solution/fx-solution/v2/scaffolding.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/solution.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/solution.js +2 -1
- package/build/plugins/solution/fx-solution/v2/solution.js.map +1 -1
- package/build/plugins/solution/fx-solution/v3/addModule.d.ts +6 -0
- package/build/plugins/solution/fx-solution/v3/addModule.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/addModule.js +35 -0
- package/build/plugins/solution/fx-solution/v3/addModule.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/addResource.d.ts +37 -0
- package/build/plugins/solution/fx-solution/v3/addResource.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/addResource.js +260 -0
- package/build/plugins/solution/fx-solution/v3/addResource.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/constants.d.ts +20 -0
- package/build/plugins/solution/fx-solution/v3/constants.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/constants.js +25 -0
- package/build/plugins/solution/fx-solution/v3/constants.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/deploy.d.ts +6 -0
- package/build/plugins/solution/fx-solution/v3/deploy.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/deploy.js +78 -0
- package/build/plugins/solution/fx-solution/v3/deploy.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/error.d.ts +11 -0
- package/build/plugins/solution/fx-solution/v3/error.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/error.js +23 -0
- package/build/plugins/solution/fx-solution/v3/error.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/init.d.ts +4 -0
- package/build/plugins/solution/fx-solution/v3/init.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/init.js +35 -0
- package/build/plugins/solution/fx-solution/v3/init.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/provision.d.ts +4 -0
- package/build/plugins/solution/fx-solution/v3/provision.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/provision.js +124 -0
- package/build/plugins/solution/fx-solution/v3/provision.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/provisionLocal.d.ts +4 -0
- package/build/plugins/solution/fx-solution/v3/provisionLocal.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/provisionLocal.js +13 -0
- package/build/plugins/solution/fx-solution/v3/provisionLocal.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/publish.d.ts +4 -0
- package/build/plugins/solution/fx-solution/v3/publish.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/publish.js +15 -0
- package/build/plugins/solution/fx-solution/v3/publish.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/questions.d.ts +16 -0
- package/build/plugins/solution/fx-solution/v3/questions.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/questions.js +86 -0
- package/build/plugins/solution/fx-solution/v3/questions.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/scaffold.d.ts +27 -0
- package/build/plugins/solution/fx-solution/v3/scaffold.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/scaffold.js +241 -0
- package/build/plugins/solution/fx-solution/v3/scaffold.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/solution.d.ts +32 -0
- package/build/plugins/solution/fx-solution/v3/solution.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/solution.js +45 -0
- package/build/plugins/solution/fx-solution/v3/solution.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/userTask.d.ts +4 -0
- package/build/plugins/solution/fx-solution/v3/userTask.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/userTask.js +15 -0
- package/build/plugins/solution/fx-solution/v3/userTask.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/utils.d.ts +3 -0
- package/build/plugins/solution/fx-solution/v3/utils.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/utils.js +16 -0
- package/build/plugins/solution/fx-solution/v3/utils.js.map +1 -0
- package/build/plugins/solution/index.d.ts +1 -0
- package/build/plugins/solution/index.d.ts.map +1 -1
- package/build/plugins/solution/index.js +1 -0
- package/build/plugins/solution/index.js.map +1 -1
- package/build/plugins/solution/spfx-solution/constants.d.ts +2 -0
- package/build/plugins/solution/spfx-solution/constants.d.ts.map +1 -0
- package/build/plugins/solution/spfx-solution/constants.js +7 -0
- package/build/plugins/solution/spfx-solution/constants.js.map +1 -0
- package/build/plugins/solution/spfx-solution/index.d.ts +2 -0
- package/build/plugins/solution/spfx-solution/index.d.ts.map +1 -0
- package/build/plugins/solution/spfx-solution/index.js +5 -0
- package/build/plugins/solution/spfx-solution/index.js.map +1 -0
- package/build/plugins/solution/spfx-solution/init.d.ts +3 -0
- package/build/plugins/solution/spfx-solution/init.d.ts.map +1 -0
- package/build/plugins/solution/spfx-solution/init.js +20 -0
- package/build/plugins/solution/spfx-solution/init.js.map +1 -0
- package/build/plugins/solution/spfx-solution/questions.d.ts +6 -0
- package/build/plugins/solution/spfx-solution/questions.d.ts.map +1 -0
- package/build/plugins/solution/spfx-solution/questions.js +36 -0
- package/build/plugins/solution/spfx-solution/questions.js.map +1 -0
- package/build/plugins/solution/spfx-solution/scaffolding.d.ts +17 -0
- package/build/plugins/solution/spfx-solution/scaffolding.d.ts.map +1 -0
- package/build/plugins/solution/spfx-solution/scaffolding.js +29 -0
- package/build/plugins/solution/spfx-solution/scaffolding.js.map +1 -0
- package/build/plugins/solution/spfx-solution/solution.d.ts +23 -0
- package/build/plugins/solution/spfx-solution/solution.d.ts.map +1 -0
- package/build/plugins/solution/spfx-solution/solution.js +29 -0
- package/build/plugins/solution/spfx-solution/solution.js.map +1 -0
- package/package.json +9 -4
- package/resource/strings.json +0 -1
- package/templates/plugins/resource/keyvault/bicep/provision.template.bicep +1 -0
- package/templates/plugins/resource/simpleauth/version.txt +2 -1
- package/build/plugins/resource/localdebug/launch.d.ts.map +0 -1
- package/build/plugins/resource/localdebug/launch.js.map +0 -1
- package/build/plugins/resource/localdebug/legacyPlugin.d.ts +0 -6
- package/build/plugins/resource/localdebug/legacyPlugin.d.ts.map +0 -1
- package/build/plugins/resource/localdebug/legacyPlugin.js +0 -208
- package/build/plugins/resource/localdebug/legacyPlugin.js.map +0 -1
- package/build/plugins/resource/localdebug/settings.d.ts +0 -2
- package/build/plugins/resource/localdebug/settings.d.ts.map +0 -1
- package/build/plugins/resource/localdebug/settings.js +0 -18
- package/build/plugins/resource/localdebug/settings.js.map +0 -1
- package/build/plugins/resource/localdebug/tasks.d.ts.map +0 -1
- package/build/plugins/resource/localdebug/tasks.js.map +0 -1
- package/build/plugins/resource/localdebug/util/codespace.d.ts.map +0 -1
- package/build/plugins/resource/localdebug/util/codespace.js.map +0 -1
- package/build/plugins/resource/localdebug/util/ngrok.d.ts.map +0 -1
- package/build/plugins/resource/localdebug/util/ngrok.js.map +0 -1
- package/templates/azure/config.bicep +0 -25
- package/templates/azure/main.bicep +0 -20
- package/templates/azure/provision/azureSql.bicep +0 -39
- package/templates/azure/provision/frontendHosting.bicep +0 -23
- package/templates/azure/provision/function.bicep +0 -79
- package/templates/azure/provision/simpleAuth.bicep +0 -44
- package/templates/azure/provision.bicep +0 -58
- package/templates/azure/teamsFx/bot.bicep +0 -34
- package/templates/azure/teamsFx/function.bicep +0 -71
- package/templates/azure/teamsFx/simpleAuth.bicep +0 -40
- package/templates/plugins/resource/aad/bicep/param.template.bicep +0 -6
- package/templates/plugins/resource/aad/bicep/variables.template.bicep +0 -13
package/build/core/index.js
CHANGED
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.getProjectSettingsVersion = exports.undefinedName = exports.createV2Context = exports.newProjectSettings = exports.downloadSample = exports.createBasicFolderStructure = exports.FxCore = exports.TOOLS = exports.currentStage = exports.telemetryReporter = exports.Logger = exports.isVsCallingCli = exports.isV2 = void 0;
|
|
5
|
+
exports.getProjectSettingsVersion = exports.undefinedName = exports.createV2Context = exports.newProjectSettings = exports.downloadSample = exports.createBasicFolderStructure = exports.FxCore = exports.setTools = exports.TOOLS = exports.currentStage = exports.telemetryReporter = exports.Logger = exports.isVsCallingCli = exports.isV2 = exports.isV3 = void 0;
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
const hooks_1 = require("@feathersjs/hooks");
|
|
8
8
|
const teamsfx_api_1 = require("@microsoft/teamsfx-api");
|
|
9
9
|
const adm_zip_1 = tslib_1.__importDefault(require("adm-zip"));
|
|
10
10
|
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
11
11
|
const jsonschema = tslib_1.__importStar(require("jsonschema"));
|
|
12
|
+
const lodash_1 = require("lodash");
|
|
12
13
|
const path = tslib_1.__importStar(require("path"));
|
|
14
|
+
const typedi_1 = require("typedi");
|
|
13
15
|
const uuid = tslib_1.__importStar(require("uuid"));
|
|
14
16
|
const __1 = require("..");
|
|
15
17
|
const constants_1 = require("../common/constants");
|
|
@@ -18,13 +20,17 @@ const localSettingsProvider_1 = require("../common/localSettingsProvider");
|
|
|
18
20
|
const telemetry_1 = require("../common/telemetry");
|
|
19
21
|
const tools_1 = require("../common/tools");
|
|
20
22
|
const plugins_1 = require("../plugins");
|
|
23
|
+
const question_1 = require("../plugins/solution/fx-solution/question");
|
|
21
24
|
const ResourcePluginContainer_1 = require("../plugins/solution/fx-solution/ResourcePluginContainer");
|
|
25
|
+
const constants_2 = require("../plugins/solution/fx-solution/v3/constants");
|
|
22
26
|
const callback_1 = require("./callback");
|
|
27
|
+
const crypto_1 = require("./crypto");
|
|
23
28
|
const error_1 = require("./error");
|
|
24
29
|
const concurrentLocker_1 = require("./middleware/concurrentLocker");
|
|
25
30
|
const contextInjector_1 = require("./middleware/contextInjector");
|
|
26
31
|
const envInfoLoader_1 = require("./middleware/envInfoLoader");
|
|
27
32
|
const envInfoWriter_1 = require("./middleware/envInfoWriter");
|
|
33
|
+
const envInfoWriterV3_1 = require("./middleware/envInfoWriterV3");
|
|
28
34
|
const errorHandler_1 = require("./middleware/errorHandler");
|
|
29
35
|
const localSettingsLoader_1 = require("./middleware/localSettingsLoader");
|
|
30
36
|
const localSettingsWriter_1 = require("./middleware/localSettingsWriter");
|
|
@@ -35,12 +41,13 @@ const projectSettingsWriter_1 = require("./middleware/projectSettingsWriter");
|
|
|
35
41
|
const projectUpgrader_1 = require("./middleware/projectUpgrader");
|
|
36
42
|
const questionModel_1 = require("./middleware/questionModel");
|
|
37
43
|
const solutionLoader_1 = require("./middleware/solutionLoader");
|
|
38
|
-
const
|
|
44
|
+
const question_2 = require("./question");
|
|
39
45
|
const SolutionPluginContainer_1 = require("./SolutionPluginContainer");
|
|
40
46
|
const tools_2 = require("./tools");
|
|
41
|
-
const crypto_1 = require("./crypto");
|
|
42
47
|
const supportV1ConditionHandler_1 = require("./middleware/supportV1ConditionHandler");
|
|
43
|
-
const
|
|
48
|
+
const projectSettingsLoaderV3_1 = require("./middleware/projectSettingsLoaderV3");
|
|
49
|
+
const solutionLoaderV3_1 = require("./middleware/solutionLoaderV3");
|
|
50
|
+
const envInfoLoaderV3_1 = require("./middleware/envInfoLoaderV3");
|
|
44
51
|
// TODO: For package.json,
|
|
45
52
|
// use require instead of import because of core building/packaging method.
|
|
46
53
|
// Using import will cause the build folder structure to change.
|
|
@@ -54,6 +61,10 @@ function featureFlagEnabled(flagName) {
|
|
|
54
61
|
return false;
|
|
55
62
|
}
|
|
56
63
|
}
|
|
64
|
+
function isV3() {
|
|
65
|
+
return featureFlagEnabled(constants_1.FeatureFlagName.APIV3);
|
|
66
|
+
}
|
|
67
|
+
exports.isV3 = isV3;
|
|
57
68
|
// API V2 feature flag
|
|
58
69
|
function isV2() {
|
|
59
70
|
return tools_1.isMultiEnvEnabled();
|
|
@@ -64,8 +75,27 @@ function isVsCallingCli() {
|
|
|
64
75
|
return featureFlagEnabled(constants_1.FeatureFlagName.VSCallingCLI);
|
|
65
76
|
}
|
|
66
77
|
exports.isVsCallingCli = isVsCallingCli;
|
|
78
|
+
function setTools(tools) {
|
|
79
|
+
exports.TOOLS = tools;
|
|
80
|
+
}
|
|
81
|
+
exports.setTools = setTools;
|
|
67
82
|
class FxCore {
|
|
68
83
|
constructor(tools) {
|
|
84
|
+
//V1,V2 questions
|
|
85
|
+
this._getQuestionsForCreateProjectV2 = questionModel_1.getQuestionsForCreateProjectV2;
|
|
86
|
+
this._getQuestionsForCreateProjectV3 = questionModel_1.getQuestionsForCreateProjectV3;
|
|
87
|
+
this._getQuestionsForUserTask = questionModel_1.getQuestionsForUserTaskV2;
|
|
88
|
+
this._getQuestions = questionModel_1.getQuestionsV2;
|
|
89
|
+
this._getQuestionsForMigrateV1Project = questionModel_1.getQuestionsForMigrateV1Project;
|
|
90
|
+
//v3 questions
|
|
91
|
+
this._getQuestionsForScaffold = questionModel_1.getQuestionsForScaffold;
|
|
92
|
+
this._getQuestionsForAddModule = questionModel_1.getQuestionsForAddModule;
|
|
93
|
+
this._getQuestionsForAddResource = questionModel_1.getQuestionsForAddResource;
|
|
94
|
+
this._getQuestionsForProvision = questionModel_1.getQuestionsForProvision;
|
|
95
|
+
this._getQuestionsForDeploy = questionModel_1.getQuestionsForDeploy;
|
|
96
|
+
this._getQuestionsForLocalProvision = questionModel_1.getQuestionsForLocalProvision;
|
|
97
|
+
this._getQuestionsForPublish = questionModel_1.getQuestionsForPublish;
|
|
98
|
+
this._getQuestionsForInit = questionModel_1.getQuestionsForInit;
|
|
69
99
|
this.tools = tools;
|
|
70
100
|
exports.TOOLS = tools;
|
|
71
101
|
exports.Logger = tools.logProvider;
|
|
@@ -78,24 +108,37 @@ class FxCore {
|
|
|
78
108
|
on(event, callback) {
|
|
79
109
|
return callback_1.CallbackRegistry.set(event, callback);
|
|
80
110
|
}
|
|
81
|
-
async createProject(inputs
|
|
111
|
+
async createProject(inputs) {
|
|
112
|
+
if (isV3()) {
|
|
113
|
+
return this.createProjectV3(inputs);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
return this.createProjectV2(inputs);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
async createProjectV2(inputs, ctx) {
|
|
82
120
|
if (!ctx) {
|
|
83
121
|
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx for createProject"));
|
|
84
122
|
}
|
|
85
123
|
exports.currentStage = teamsfx_api_1.Stage.create;
|
|
86
124
|
inputs.stage = teamsfx_api_1.Stage.create;
|
|
87
|
-
let folder = inputs[
|
|
125
|
+
let folder = inputs[question_2.QuestionRootFolder.name];
|
|
88
126
|
if (inputs.platform === teamsfx_api_1.Platform.VSCode) {
|
|
89
127
|
folder = tools_1.getRootDirectory();
|
|
90
|
-
|
|
128
|
+
try {
|
|
129
|
+
await fs.ensureDir(folder);
|
|
130
|
+
}
|
|
131
|
+
catch (e) {
|
|
132
|
+
throw error_1.ProjectFolderInvalidError(folder);
|
|
133
|
+
}
|
|
91
134
|
}
|
|
92
|
-
const scratch = inputs[
|
|
135
|
+
const scratch = inputs[question_2.CoreQuestionNames.CreateFromScratch];
|
|
93
136
|
let projectPath;
|
|
94
137
|
let globalStateDescription = "openReadme";
|
|
95
138
|
const multiEnv = tools_1.isMultiEnvEnabled();
|
|
96
|
-
if (scratch ===
|
|
139
|
+
if (scratch === question_2.ScratchOptionNo.id) {
|
|
97
140
|
// create from sample
|
|
98
|
-
const downloadRes = await downloadSample(
|
|
141
|
+
const downloadRes = await downloadSample(inputs, ctx);
|
|
99
142
|
if (downloadRes.isErr()) {
|
|
100
143
|
return teamsfx_api_1.err(downloadRes.error);
|
|
101
144
|
}
|
|
@@ -104,11 +147,11 @@ class FxCore {
|
|
|
104
147
|
}
|
|
105
148
|
else {
|
|
106
149
|
// create from new
|
|
107
|
-
const appName = inputs[
|
|
150
|
+
const appName = inputs[question_2.QuestionAppName.name];
|
|
108
151
|
if (undefined === appName)
|
|
109
152
|
return teamsfx_api_1.err(error_1.InvalidInputError(`App Name is empty`, inputs));
|
|
110
153
|
const validateResult = jsonschema.validate(appName, {
|
|
111
|
-
pattern:
|
|
154
|
+
pattern: question_2.ProjectNamePattern,
|
|
112
155
|
});
|
|
113
156
|
if (validateResult.errors && validateResult.errors.length > 0) {
|
|
114
157
|
return teamsfx_api_1.err(error_1.InvalidInputError(`${validateResult.errors[0].message}`, inputs));
|
|
@@ -144,13 +187,13 @@ class FxCore {
|
|
|
144
187
|
}
|
|
145
188
|
}
|
|
146
189
|
if (isV2()) {
|
|
147
|
-
const solution = await SolutionPluginContainer_1.getSolutionPluginV2ByName(inputs[
|
|
190
|
+
const solution = await SolutionPluginContainer_1.getSolutionPluginV2ByName(inputs[question_2.CoreQuestionNames.Solution]);
|
|
148
191
|
if (!solution) {
|
|
149
192
|
return teamsfx_api_1.err(new error_1.LoadSolutionError());
|
|
150
193
|
}
|
|
151
194
|
ctx.solutionV2 = solution;
|
|
152
195
|
projectSettings.solutionSettings.name = solution.name;
|
|
153
|
-
const contextV2 = createV2Context(
|
|
196
|
+
const contextV2 = createV2Context(projectSettings);
|
|
154
197
|
ctx.contextV2 = contextV2;
|
|
155
198
|
const scaffoldSourceCodeRes = await solution.scaffoldSourceCode(contextV2, inputs);
|
|
156
199
|
if (scaffoldSourceCodeRes.isErr()) {
|
|
@@ -185,7 +228,7 @@ class FxCore {
|
|
|
185
228
|
}
|
|
186
229
|
}
|
|
187
230
|
else {
|
|
188
|
-
const solution = await SolutionPluginContainer_1.getSolutionPluginByName(inputs[
|
|
231
|
+
const solution = await SolutionPluginContainer_1.getSolutionPluginByName(inputs[question_2.CoreQuestionNames.Solution]);
|
|
189
232
|
if (!solution) {
|
|
190
233
|
return teamsfx_api_1.err(new error_1.LoadSolutionError());
|
|
191
234
|
}
|
|
@@ -217,16 +260,196 @@ class FxCore {
|
|
|
217
260
|
}
|
|
218
261
|
return teamsfx_api_1.ok(projectPath);
|
|
219
262
|
}
|
|
263
|
+
async createProjectV3(inputs, ctx) {
|
|
264
|
+
if (!ctx) {
|
|
265
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx for createProject"));
|
|
266
|
+
}
|
|
267
|
+
exports.currentStage = teamsfx_api_1.Stage.create;
|
|
268
|
+
inputs.stage = teamsfx_api_1.Stage.create;
|
|
269
|
+
let folder = inputs[question_2.QuestionRootFolder.name];
|
|
270
|
+
if (inputs.platform === teamsfx_api_1.Platform.VSCode || inputs.platform === teamsfx_api_1.Platform.VS) {
|
|
271
|
+
folder = tools_1.getRootDirectory();
|
|
272
|
+
try {
|
|
273
|
+
await fs.ensureDir(folder);
|
|
274
|
+
}
|
|
275
|
+
catch (e) {
|
|
276
|
+
throw error_1.ProjectFolderInvalidError(folder);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
const scratch = inputs[question_2.CoreQuestionNames.CreateFromScratch];
|
|
280
|
+
let projectPath;
|
|
281
|
+
let globalStateDescription = "openReadme";
|
|
282
|
+
if (scratch === question_2.ScratchOptionNo.id) {
|
|
283
|
+
// create from sample
|
|
284
|
+
const downloadRes = await downloadSample(inputs, ctx);
|
|
285
|
+
if (downloadRes.isErr()) {
|
|
286
|
+
return teamsfx_api_1.err(downloadRes.error);
|
|
287
|
+
}
|
|
288
|
+
projectPath = downloadRes.value;
|
|
289
|
+
globalStateDescription = "openSampleReadme";
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
// create from new
|
|
293
|
+
const appName = inputs[question_2.QuestionAppName.name];
|
|
294
|
+
if (undefined === appName)
|
|
295
|
+
return teamsfx_api_1.err(error_1.InvalidInputError(`App Name is empty`, inputs));
|
|
296
|
+
const validateResult = jsonschema.validate(appName, {
|
|
297
|
+
pattern: question_2.ProjectNamePattern,
|
|
298
|
+
});
|
|
299
|
+
if (validateResult.errors && validateResult.errors.length > 0) {
|
|
300
|
+
return teamsfx_api_1.err(error_1.InvalidInputError(`${validateResult.errors[0].message}`, inputs));
|
|
301
|
+
}
|
|
302
|
+
projectPath = path.join(folder, appName);
|
|
303
|
+
inputs.projectPath = projectPath;
|
|
304
|
+
const folderExist = await fs.pathExists(projectPath);
|
|
305
|
+
if (folderExist) {
|
|
306
|
+
return teamsfx_api_1.err(error_1.ProjectFolderExistError(projectPath));
|
|
307
|
+
}
|
|
308
|
+
await fs.ensureDir(projectPath);
|
|
309
|
+
await fs.ensureDir(path.join(projectPath, `.${teamsfx_api_1.ConfigFolderName}`));
|
|
310
|
+
let capabilities = inputs[question_2.CoreQuestionNames.Capabilities];
|
|
311
|
+
let projectType = "";
|
|
312
|
+
if (capabilities.includes(question_2.TabSPFxItem.id))
|
|
313
|
+
projectType = "spfx";
|
|
314
|
+
else if (capabilities.includes(question_2.TabOptionItem.id) && capabilities.length === 1)
|
|
315
|
+
projectType = "tab";
|
|
316
|
+
else if ((capabilities.includes(question_2.BotOptionItem.id) ||
|
|
317
|
+
capabilities.includes(question_1.MessageExtensionItem.id)) &&
|
|
318
|
+
!capabilities.includes(question_2.TabOptionItem.id))
|
|
319
|
+
projectType = "bot";
|
|
320
|
+
else if ((capabilities.includes(question_2.BotOptionItem.id) ||
|
|
321
|
+
capabilities.includes(question_1.MessageExtensionItem.id)) &&
|
|
322
|
+
capabilities.includes(question_2.TabOptionItem.id))
|
|
323
|
+
projectType = "tab+bot";
|
|
324
|
+
const programmingLanguage = inputs[question_2.CoreQuestionNames.ProgrammingLanguage];
|
|
325
|
+
// const solution = capabilities.includes(TabSPFxItem.id)
|
|
326
|
+
// ? BuiltInSolutionNames.spfx
|
|
327
|
+
// : BuiltInSolutionNames.azure;
|
|
328
|
+
// init
|
|
329
|
+
const initInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath });
|
|
330
|
+
const initRes = await this._init(initInputs, ctx);
|
|
331
|
+
if (initRes.isErr()) {
|
|
332
|
+
return teamsfx_api_1.err(initRes.error);
|
|
333
|
+
}
|
|
334
|
+
// addModule, scaffold and addResource
|
|
335
|
+
if (inputs.platform === teamsfx_api_1.Platform.VS) {
|
|
336
|
+
// addModule
|
|
337
|
+
const addModuleInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath, capabilities: capabilities });
|
|
338
|
+
const addModuleRes = await this._addModule(addModuleInputs, ctx);
|
|
339
|
+
if (addModuleRes.isErr()) {
|
|
340
|
+
return teamsfx_api_1.err(addModuleRes.error);
|
|
341
|
+
}
|
|
342
|
+
// addResource
|
|
343
|
+
const addResourceInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath, module: "0", resource: constants_2.BuiltInResourcePluginNames.webApp });
|
|
344
|
+
const addResourceRes = await this._addResource(addResourceInputs, ctx);
|
|
345
|
+
if (addResourceRes.isErr()) {
|
|
346
|
+
return teamsfx_api_1.err(addResourceRes.error);
|
|
347
|
+
}
|
|
348
|
+
// scaffold
|
|
349
|
+
let templateName = "";
|
|
350
|
+
if (projectType === "tab")
|
|
351
|
+
templateName = "BlazorTab";
|
|
352
|
+
else if (projectType === "bot")
|
|
353
|
+
templateName = "BlazorBot";
|
|
354
|
+
else if (projectType === "tabbot")
|
|
355
|
+
templateName = "BlazorTabBot";
|
|
356
|
+
const scaffoldInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath, module: "0", template: {
|
|
357
|
+
id: `${constants_2.BuiltInScaffoldPluginNames.blazor}/${templateName}`,
|
|
358
|
+
label: `${constants_2.BuiltInScaffoldPluginNames.blazor}/${templateName}`,
|
|
359
|
+
data: {
|
|
360
|
+
pluginName: constants_2.BuiltInScaffoldPluginNames.blazor,
|
|
361
|
+
templateName: templateName,
|
|
362
|
+
},
|
|
363
|
+
} });
|
|
364
|
+
const scaffoldRes = await this._scaffold(scaffoldInputs, ctx);
|
|
365
|
+
if (scaffoldRes.isErr()) {
|
|
366
|
+
return teamsfx_api_1.err(scaffoldRes.error);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
if (capabilities.includes(question_2.TabOptionItem.id) || capabilities.includes(question_2.TabSPFxItem.id)) {
|
|
371
|
+
const addModuleInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath, capabilities: capabilities.includes(question_2.TabOptionItem.id)
|
|
372
|
+
? [question_2.TabOptionItem.id]
|
|
373
|
+
: [question_2.TabSPFxItem.id] });
|
|
374
|
+
const addModuleRes = await this._addModule(addModuleInputs, ctx);
|
|
375
|
+
if (addModuleRes.isErr()) {
|
|
376
|
+
return teamsfx_api_1.err(addModuleRes.error);
|
|
377
|
+
}
|
|
378
|
+
// addResource
|
|
379
|
+
const addResourceInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath, module: "0", resource: capabilities.includes(question_2.TabOptionItem.id)
|
|
380
|
+
? constants_2.BuiltInResourcePluginNames.storage
|
|
381
|
+
: constants_2.BuiltInResourcePluginNames.spfx });
|
|
382
|
+
const addResourceRes = await this._addResource(addResourceInputs, ctx);
|
|
383
|
+
if (addResourceRes.isErr()) {
|
|
384
|
+
return teamsfx_api_1.err(addResourceRes.error);
|
|
385
|
+
}
|
|
386
|
+
// scaffold
|
|
387
|
+
const pluginName = capabilities.includes(question_2.TabOptionItem.id)
|
|
388
|
+
? constants_2.BuiltInScaffoldPluginNames.tab
|
|
389
|
+
: constants_2.BuiltInScaffoldPluginNames.spfx;
|
|
390
|
+
const templateName = capabilities.includes(question_2.TabOptionItem.id)
|
|
391
|
+
? programmingLanguage === "javascript"
|
|
392
|
+
? "ReactTab_JS"
|
|
393
|
+
: "ReactTab_TS"
|
|
394
|
+
: "SPFxTab";
|
|
395
|
+
const scaffoldInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath, module: "0", template: {
|
|
396
|
+
id: `${pluginName}/${templateName}`,
|
|
397
|
+
label: `${pluginName}/${templateName}`,
|
|
398
|
+
data: {
|
|
399
|
+
pluginName: pluginName,
|
|
400
|
+
templateName: templateName, //TODO
|
|
401
|
+
},
|
|
402
|
+
} });
|
|
403
|
+
const scaffoldRes = await this._scaffold(scaffoldInputs, ctx);
|
|
404
|
+
if (scaffoldRes.isErr()) {
|
|
405
|
+
return teamsfx_api_1.err(scaffoldRes.error);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
capabilities = capabilities.filter((c) => c !== question_2.TabOptionItem.id && c !== question_2.TabSPFxItem.id);
|
|
409
|
+
if (capabilities.length > 0) {
|
|
410
|
+
const addModuleInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath, capabilities: capabilities });
|
|
411
|
+
const addModuleRes = await this._addModule(addModuleInputs, ctx);
|
|
412
|
+
if (addModuleRes.isErr()) {
|
|
413
|
+
return teamsfx_api_1.err(addModuleRes.error);
|
|
414
|
+
}
|
|
415
|
+
// addResource
|
|
416
|
+
const addResourceInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath, module: "1", resource: constants_2.BuiltInResourcePluginNames.bot });
|
|
417
|
+
const addResourceRes = await this._addResource(addResourceInputs, ctx);
|
|
418
|
+
if (addResourceRes.isErr()) {
|
|
419
|
+
return teamsfx_api_1.err(addResourceRes.error);
|
|
420
|
+
}
|
|
421
|
+
// scaffold
|
|
422
|
+
const templateName = programmingLanguage === "javascript" ? "NodejsBot_JS" : "NodejsBot_TS";
|
|
423
|
+
const scaffoldInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath, module: "1", resource: constants_2.BuiltInScaffoldPluginNames.bot, template: {
|
|
424
|
+
id: `${constants_2.BuiltInScaffoldPluginNames.bot}/${templateName}`,
|
|
425
|
+
label: `${constants_2.BuiltInScaffoldPluginNames.bot}/${templateName}`,
|
|
426
|
+
data: {
|
|
427
|
+
pluginName: constants_2.BuiltInScaffoldPluginNames.bot,
|
|
428
|
+
templateName: templateName, //TODO
|
|
429
|
+
},
|
|
430
|
+
} });
|
|
431
|
+
const scaffoldRes = await this._scaffold(scaffoldInputs, ctx);
|
|
432
|
+
if (scaffoldRes.isErr()) {
|
|
433
|
+
return teamsfx_api_1.err(scaffoldRes.error);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
if (inputs.platform === teamsfx_api_1.Platform.VSCode) {
|
|
439
|
+
await globalState_1.globalStateUpdate(globalStateDescription, true);
|
|
440
|
+
}
|
|
441
|
+
return teamsfx_api_1.ok(projectPath);
|
|
442
|
+
}
|
|
220
443
|
async migrateV1Project(inputs, ctx) {
|
|
221
444
|
var _a;
|
|
222
445
|
exports.currentStage = teamsfx_api_1.Stage.migrateV1;
|
|
223
446
|
inputs.stage = teamsfx_api_1.Stage.migrateV1;
|
|
224
447
|
const globalStateDescription = "openReadme";
|
|
225
|
-
const appName = ((_a = inputs[
|
|
448
|
+
const appName = ((_a = inputs[question_2.DefaultAppNameFunc.name]) !== null && _a !== void 0 ? _a : inputs[question_2.QuestionV1AppName.name]);
|
|
226
449
|
if (undefined === appName)
|
|
227
450
|
return teamsfx_api_1.err(error_1.InvalidInputError(`App Name is empty`, inputs));
|
|
228
451
|
const validateResult = jsonschema.validate(appName, {
|
|
229
|
-
pattern:
|
|
452
|
+
pattern: question_2.ProjectNamePattern,
|
|
230
453
|
});
|
|
231
454
|
if (validateResult.errors && validateResult.errors.length > 0) {
|
|
232
455
|
return teamsfx_api_1.err(error_1.InvalidInputError(`${validateResult.errors[0].message}`, inputs));
|
|
@@ -302,7 +525,18 @@ class FxCore {
|
|
|
302
525
|
return teamsfx_api_1.err(error_1.ArchiveProjectError(e.message));
|
|
303
526
|
}
|
|
304
527
|
}
|
|
305
|
-
|
|
528
|
+
/**
|
|
529
|
+
* switch to different versions of provisionResources
|
|
530
|
+
*/
|
|
531
|
+
async provisionResources(inputs) {
|
|
532
|
+
if (isV3()) {
|
|
533
|
+
return this.provisionResourcesV3(inputs);
|
|
534
|
+
}
|
|
535
|
+
else {
|
|
536
|
+
return this.provisionResourcesV2(inputs);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
async provisionResourcesV2(inputs, ctx) {
|
|
306
540
|
exports.currentStage = teamsfx_api_1.Stage.provision;
|
|
307
541
|
inputs.stage = teamsfx_api_1.Stage.provision;
|
|
308
542
|
// provision is not ready yet, so use API v1
|
|
@@ -337,7 +571,29 @@ class FxCore {
|
|
|
337
571
|
return provisionRes;
|
|
338
572
|
}
|
|
339
573
|
}
|
|
340
|
-
async
|
|
574
|
+
async provisionResourcesV3(inputs, ctx) {
|
|
575
|
+
exports.currentStage = teamsfx_api_1.Stage.provision;
|
|
576
|
+
inputs.stage = teamsfx_api_1.Stage.provision;
|
|
577
|
+
if (ctx &&
|
|
578
|
+
ctx.solutionV3 &&
|
|
579
|
+
ctx.contextV2 &&
|
|
580
|
+
ctx.envInfoV3 &&
|
|
581
|
+
ctx.solutionV3.provisionResources) {
|
|
582
|
+
const res = await ctx.solutionV3.provisionResources(ctx.contextV2, inputs, ctx.envInfoV3, exports.TOOLS.tokenProvider);
|
|
583
|
+
if (res.isOk()) {
|
|
584
|
+
ctx.envInfoV3 = res.value;
|
|
585
|
+
}
|
|
586
|
+
return res;
|
|
587
|
+
}
|
|
588
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
589
|
+
}
|
|
590
|
+
async deployArtifacts(inputs) {
|
|
591
|
+
if (isV3())
|
|
592
|
+
return this.deployArtifactsV3(inputs);
|
|
593
|
+
else
|
|
594
|
+
return this.deployArtifactsV2(inputs);
|
|
595
|
+
}
|
|
596
|
+
async deployArtifactsV2(inputs, ctx) {
|
|
341
597
|
exports.currentStage = teamsfx_api_1.Stage.deploy;
|
|
342
598
|
inputs.stage = teamsfx_api_1.Stage.deploy;
|
|
343
599
|
if (isV2()) {
|
|
@@ -358,7 +614,22 @@ class FxCore {
|
|
|
358
614
|
return await ctx.solution.deploy(ctx.solutionContext);
|
|
359
615
|
}
|
|
360
616
|
}
|
|
361
|
-
async
|
|
617
|
+
async deployArtifactsV3(inputs, ctx) {
|
|
618
|
+
exports.currentStage = teamsfx_api_1.Stage.deploy;
|
|
619
|
+
inputs.stage = teamsfx_api_1.Stage.deploy;
|
|
620
|
+
if (ctx && ctx.solutionV3 && ctx.contextV2 && ctx.envInfoV3 && ctx.solutionV3.deploy) {
|
|
621
|
+
const res = await ctx.solutionV3.deploy(ctx.contextV2, inputs, ctx.envInfoV3, exports.TOOLS.tokenProvider);
|
|
622
|
+
return res;
|
|
623
|
+
}
|
|
624
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
625
|
+
}
|
|
626
|
+
async localDebug(inputs) {
|
|
627
|
+
if (isV3())
|
|
628
|
+
return this.localDebugV3(inputs);
|
|
629
|
+
else
|
|
630
|
+
return this.localDebugV2(inputs);
|
|
631
|
+
}
|
|
632
|
+
async localDebugV2(inputs, ctx) {
|
|
362
633
|
exports.currentStage = teamsfx_api_1.Stage.debug;
|
|
363
634
|
inputs.stage = teamsfx_api_1.Stage.debug;
|
|
364
635
|
if (isV2()) {
|
|
@@ -398,6 +669,22 @@ class FxCore {
|
|
|
398
669
|
this._setEnvInfoV2(ctx);
|
|
399
670
|
return res;
|
|
400
671
|
}
|
|
672
|
+
async localDebugV3(inputs, ctx) {
|
|
673
|
+
exports.currentStage = teamsfx_api_1.Stage.debug;
|
|
674
|
+
inputs.stage = teamsfx_api_1.Stage.debug;
|
|
675
|
+
if (ctx &&
|
|
676
|
+
ctx.solutionV3 &&
|
|
677
|
+
ctx.contextV2 &&
|
|
678
|
+
ctx.localSettings &&
|
|
679
|
+
ctx.solutionV3.provisionLocalResources) {
|
|
680
|
+
const res = await ctx.solutionV3.provisionLocalResources(ctx.contextV2, inputs, ctx.localSettings, exports.TOOLS.tokenProvider);
|
|
681
|
+
if (res.isOk()) {
|
|
682
|
+
ctx.localSettings = res.value;
|
|
683
|
+
}
|
|
684
|
+
return res;
|
|
685
|
+
}
|
|
686
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
687
|
+
}
|
|
401
688
|
_setEnvInfoV2(ctx) {
|
|
402
689
|
if (isV2() && ctx && ctx.solutionContext) {
|
|
403
690
|
//workaround, compatible to api v2
|
|
@@ -409,7 +696,13 @@ class FxCore {
|
|
|
409
696
|
ctx.envInfoV2.state = tools_1.mapToJson(ctx.solutionContext.envInfo.state);
|
|
410
697
|
}
|
|
411
698
|
}
|
|
412
|
-
async publishApplication(inputs
|
|
699
|
+
async publishApplication(inputs) {
|
|
700
|
+
if (isV3())
|
|
701
|
+
return this.publishApplicationV3(inputs);
|
|
702
|
+
else
|
|
703
|
+
return this.publishApplicationV2(inputs);
|
|
704
|
+
}
|
|
705
|
+
async publishApplicationV2(inputs, ctx) {
|
|
413
706
|
exports.currentStage = teamsfx_api_1.Stage.publish;
|
|
414
707
|
inputs.stage = teamsfx_api_1.Stage.publish;
|
|
415
708
|
if (isV2()) {
|
|
@@ -427,6 +720,19 @@ class FxCore {
|
|
|
427
720
|
return await ctx.solution.publish(ctx.solutionContext);
|
|
428
721
|
}
|
|
429
722
|
}
|
|
723
|
+
async publishApplicationV3(inputs, ctx) {
|
|
724
|
+
exports.currentStage = teamsfx_api_1.Stage.publish;
|
|
725
|
+
inputs.stage = teamsfx_api_1.Stage.publish;
|
|
726
|
+
if (ctx &&
|
|
727
|
+
ctx.solutionV3 &&
|
|
728
|
+
ctx.contextV2 &&
|
|
729
|
+
ctx.envInfoV3 &&
|
|
730
|
+
ctx.solutionV3.publishApplication) {
|
|
731
|
+
const res = await ctx.solutionV3.publishApplication(ctx.contextV2, inputs, ctx.envInfoV3, exports.TOOLS.tokenProvider.appStudioToken);
|
|
732
|
+
return res;
|
|
733
|
+
}
|
|
734
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
735
|
+
}
|
|
430
736
|
async executeUserTask(func, inputs, ctx) {
|
|
431
737
|
exports.currentStage = teamsfx_api_1.Stage.userTask;
|
|
432
738
|
inputs.stage = teamsfx_api_1.Stage.userTask;
|
|
@@ -439,7 +745,7 @@ class FxCore {
|
|
|
439
745
|
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError(`executeUserTask input stuff: ${name}`));
|
|
440
746
|
}
|
|
441
747
|
if (!ctx.contextV2)
|
|
442
|
-
ctx.contextV2 = createV2Context(
|
|
748
|
+
ctx.contextV2 = createV2Context(newProjectSettings());
|
|
443
749
|
if (ctx.solutionV2.executeUserTask) {
|
|
444
750
|
if (!ctx.localSettings)
|
|
445
751
|
ctx.localSettings = {};
|
|
@@ -469,13 +775,11 @@ class FxCore {
|
|
|
469
775
|
exports.currentStage = teamsfx_api_1.Stage.getQuestions;
|
|
470
776
|
if (stage === teamsfx_api_1.Stage.create) {
|
|
471
777
|
delete inputs.projectPath;
|
|
472
|
-
return await this.
|
|
778
|
+
return await this._getQuestionsForCreateProjectV2(inputs);
|
|
473
779
|
}
|
|
474
780
|
else {
|
|
475
781
|
if (isV2()) {
|
|
476
|
-
const contextV2 = ctx.contextV2
|
|
477
|
-
? ctx.contextV2
|
|
478
|
-
: createV2Context(this, newProjectSettings());
|
|
782
|
+
const contextV2 = ctx.contextV2 ? ctx.contextV2 : createV2Context(newProjectSettings());
|
|
479
783
|
const solutionV2 = ctx.solutionV2 ? ctx.solutionV2 : await SolutionPluginContainer_1.getAllSolutionPluginsV2()[0];
|
|
480
784
|
const envInfoV2 = ctx.envInfoV2
|
|
481
785
|
? ctx.envInfoV2
|
|
@@ -498,7 +802,7 @@ class FxCore {
|
|
|
498
802
|
inputs.stage = teamsfx_api_1.Stage.getQuestions;
|
|
499
803
|
exports.currentStage = teamsfx_api_1.Stage.getQuestions;
|
|
500
804
|
if (isV2()) {
|
|
501
|
-
const contextV2 = ctx.contextV2 ? ctx.contextV2 : createV2Context(
|
|
805
|
+
const contextV2 = ctx.contextV2 ? ctx.contextV2 : createV2Context(newProjectSettings());
|
|
502
806
|
const solutionV2 = ctx.solutionV2 ? ctx.solutionV2 : await SolutionPluginContainer_1.getAllSolutionPluginsV2()[0];
|
|
503
807
|
const envInfoV2 = ctx.envInfoV2
|
|
504
808
|
? ctx.envInfoV2
|
|
@@ -593,83 +897,6 @@ class FxCore {
|
|
|
593
897
|
return teamsfx_api_1.ok((_b = ctx === null || ctx === void 0 ? void 0 : ctx.solutionContext) === null || _b === void 0 ? void 0 : _b.envInfo.envName);
|
|
594
898
|
}
|
|
595
899
|
}
|
|
596
|
-
async _getQuestionsForUserTask(ctx, solution, func, inputs, envInfo) {
|
|
597
|
-
const namespace = func.namespace;
|
|
598
|
-
const array = namespace ? namespace.split("/") : [];
|
|
599
|
-
if (namespace && "" !== namespace && array.length > 0) {
|
|
600
|
-
let res = teamsfx_api_1.ok(undefined);
|
|
601
|
-
if (isV2()) {
|
|
602
|
-
const solutionV2 = solution;
|
|
603
|
-
if (solutionV2.getQuestionsForUserTask) {
|
|
604
|
-
res = await solutionV2.getQuestionsForUserTask(ctx, inputs, func, envInfo, this.tools.tokenProvider);
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
else {
|
|
608
|
-
const solutionv1 = solution;
|
|
609
|
-
if (solutionv1.getQuestionsForUserTask) {
|
|
610
|
-
res = await solutionv1.getQuestionsForUserTask(func, ctx);
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
if (res.isOk()) {
|
|
614
|
-
if (res.value) {
|
|
615
|
-
const node = res.value.trim();
|
|
616
|
-
return teamsfx_api_1.ok(node);
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
return res;
|
|
620
|
-
}
|
|
621
|
-
return teamsfx_api_1.err(error_1.FunctionRouterError(func));
|
|
622
|
-
}
|
|
623
|
-
async _getQuestionsForMigrateV1Project(inputs) {
|
|
624
|
-
const node = new teamsfx_api_1.QTreeNode({ type: "group" });
|
|
625
|
-
const globalSolutions = await SolutionPluginContainer_1.getAllSolutionPlugins();
|
|
626
|
-
const solutionContext = await projectSettingsLoader_1.newSolutionContext(this.tools, inputs);
|
|
627
|
-
for (const v of globalSolutions) {
|
|
628
|
-
if (v.getQuestions) {
|
|
629
|
-
const res = await v.getQuestions(teamsfx_api_1.Stage.migrateV1, solutionContext);
|
|
630
|
-
if (res.isErr())
|
|
631
|
-
return res;
|
|
632
|
-
if (res.value) {
|
|
633
|
-
const solutionNode = res.value;
|
|
634
|
-
solutionNode.condition = { equals: v.name };
|
|
635
|
-
if (solutionNode.data)
|
|
636
|
-
node.addChild(solutionNode);
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
const defaultAppNameFunc = new teamsfx_api_1.QTreeNode(question_1.DefaultAppNameFunc);
|
|
641
|
-
node.addChild(defaultAppNameFunc);
|
|
642
|
-
const appNameQuestion = new teamsfx_api_1.QTreeNode(question_1.QuestionV1AppName);
|
|
643
|
-
appNameQuestion.condition = {
|
|
644
|
-
validFunc: (input) => (!input ? undefined : "App name is auto generated."),
|
|
645
|
-
};
|
|
646
|
-
defaultAppNameFunc.addChild(appNameQuestion);
|
|
647
|
-
return teamsfx_api_1.ok(node.trim());
|
|
648
|
-
}
|
|
649
|
-
async _getQuestions(ctx, solution, stage, inputs, envInfo) {
|
|
650
|
-
if (stage !== teamsfx_api_1.Stage.create) {
|
|
651
|
-
let res = teamsfx_api_1.ok(undefined);
|
|
652
|
-
if (isV2()) {
|
|
653
|
-
const solutionV2 = solution;
|
|
654
|
-
if (solutionV2.getQuestions) {
|
|
655
|
-
inputs.stage = stage;
|
|
656
|
-
res = await solutionV2.getQuestions(ctx, inputs, envInfo, this.tools.tokenProvider);
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
else {
|
|
660
|
-
res = await solution.getQuestions(stage, ctx);
|
|
661
|
-
}
|
|
662
|
-
if (res.isErr())
|
|
663
|
-
return res;
|
|
664
|
-
if (res.value) {
|
|
665
|
-
const node = res.value;
|
|
666
|
-
if (node.data) {
|
|
667
|
-
return teamsfx_api_1.ok(node.trim());
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
return teamsfx_api_1.ok(undefined);
|
|
672
|
-
}
|
|
673
900
|
async encrypt(plaintext, inputs, ctx) {
|
|
674
901
|
if (!ctx)
|
|
675
902
|
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx"));
|
|
@@ -759,7 +986,7 @@ class FxCore {
|
|
|
759
986
|
catch (e) {
|
|
760
987
|
return teamsfx_api_1.err(error_1.CopyFileError(e));
|
|
761
988
|
}
|
|
762
|
-
|
|
989
|
+
exports.TOOLS.logProvider.debug(`[core] copy env config file for ${targetEnvName} environment to path ${targetEnvConfigFilePath}`);
|
|
763
990
|
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
764
991
|
}
|
|
765
992
|
// deprecated
|
|
@@ -779,7 +1006,7 @@ class FxCore {
|
|
|
779
1006
|
return teamsfx_api_1.err(error_1.NonExistEnvNameError(env));
|
|
780
1007
|
}
|
|
781
1008
|
const core = ctx.self;
|
|
782
|
-
const solutionContext = await envInfoLoader_1.loadSolutionContext(
|
|
1009
|
+
const solutionContext = await envInfoLoader_1.loadSolutionContext(inputs, ctx.projectSettings, env);
|
|
783
1010
|
if (!solutionContext.isErr()) {
|
|
784
1011
|
if (isV2()) {
|
|
785
1012
|
//TODO core should not know the details of envInfo
|
|
@@ -794,58 +1021,69 @@ class FxCore {
|
|
|
794
1021
|
this.tools.ui.showMessage("info", `[${env}] is activated.`, false);
|
|
795
1022
|
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
796
1023
|
}
|
|
797
|
-
async
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
1024
|
+
async _init(inputs, ctx) {
|
|
1025
|
+
if (!ctx) {
|
|
1026
|
+
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx for createProject"));
|
|
1027
|
+
}
|
|
1028
|
+
const appName = inputs[question_2.QuestionAppName.name];
|
|
1029
|
+
const validateResult = jsonschema.validate(appName, {
|
|
1030
|
+
pattern: question_2.ProjectNamePattern,
|
|
1031
|
+
});
|
|
1032
|
+
if (validateResult.errors && validateResult.errors.length > 0) {
|
|
1033
|
+
return teamsfx_api_1.err(error_1.InvalidInputError("invalid app-name", inputs));
|
|
1034
|
+
}
|
|
1035
|
+
const projectSettings = newProjectSettings();
|
|
1036
|
+
projectSettings.appName = appName;
|
|
1037
|
+
ctx.projectSettings = projectSettings;
|
|
1038
|
+
if (!inputs.solution) {
|
|
1039
|
+
return teamsfx_api_1.err(error_1.InvalidInputError("solution is undefined", inputs));
|
|
1040
|
+
}
|
|
1041
|
+
const createEnvResult = await this.createEnvWithName(__1.environmentManager.getDefaultEnvName(), projectSettings, inputs);
|
|
1042
|
+
if (createEnvResult.isErr()) {
|
|
1043
|
+
return teamsfx_api_1.err(createEnvResult.error);
|
|
1044
|
+
}
|
|
1045
|
+
await fs.ensureDir(path.join(inputs.projectPath, `.${teamsfx_api_1.ConfigFolderName}`));
|
|
1046
|
+
await fs.ensureDir(path.join(inputs.projectPath, "templates", `${teamsfx_api_1.AppPackageFolderName}`));
|
|
1047
|
+
const basicFolderRes = await createBasicFolderStructure(inputs);
|
|
1048
|
+
if (basicFolderRes.isErr()) {
|
|
1049
|
+
return teamsfx_api_1.err(basicFolderRes.error);
|
|
1050
|
+
}
|
|
1051
|
+
const solution = typedi_1.Container.get(inputs.solution);
|
|
1052
|
+
projectSettings.solutionSettings.name = inputs.solution;
|
|
1053
|
+
const context = createV2Context(projectSettings);
|
|
1054
|
+
ctx.contextV2 = context;
|
|
1055
|
+
ctx.solutionV3 = solution;
|
|
1056
|
+
return await solution.init(context, inputs);
|
|
1057
|
+
}
|
|
1058
|
+
async init(inputs, ctx) {
|
|
1059
|
+
return this._init(inputs, ctx);
|
|
1060
|
+
}
|
|
1061
|
+
async _addModule(inputs, ctx) {
|
|
1062
|
+
if (ctx && ctx.solutionV3 && ctx.contextV2) {
|
|
1063
|
+
return await ctx.solutionV3.addModule(ctx.contextV2, {}, inputs);
|
|
836
1064
|
}
|
|
837
|
-
|
|
838
|
-
|
|
1065
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
1066
|
+
}
|
|
1067
|
+
async addModule(inputs, ctx) {
|
|
1068
|
+
return this._addModule(inputs, ctx);
|
|
1069
|
+
}
|
|
1070
|
+
async scaffold(inputs, ctx) {
|
|
1071
|
+
return this._scaffold(inputs, ctx);
|
|
1072
|
+
}
|
|
1073
|
+
async _scaffold(inputs, ctx) {
|
|
1074
|
+
if (ctx && ctx.solutionV3 && ctx.contextV2) {
|
|
1075
|
+
return await ctx.solutionV3.scaffold(ctx.contextV2, inputs);
|
|
839
1076
|
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
1077
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
1078
|
+
}
|
|
1079
|
+
async addResource(inputs, ctx) {
|
|
1080
|
+
return this._addResource(inputs, ctx);
|
|
1081
|
+
}
|
|
1082
|
+
async _addResource(inputs, ctx) {
|
|
1083
|
+
if (ctx && ctx.solutionV3 && ctx.contextV2) {
|
|
1084
|
+
return await ctx.solutionV3.addResource(ctx.contextV2, inputs);
|
|
847
1085
|
}
|
|
848
|
-
return teamsfx_api_1.ok(
|
|
1086
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
849
1087
|
}
|
|
850
1088
|
}
|
|
851
1089
|
tslib_1.__decorate([
|
|
@@ -860,7 +1098,20 @@ tslib_1.__decorate([
|
|
|
860
1098
|
tslib_1.__metadata("design:type", Function),
|
|
861
1099
|
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
862
1100
|
tslib_1.__metadata("design:returntype", Promise)
|
|
863
|
-
], FxCore.prototype, "
|
|
1101
|
+
], FxCore.prototype, "createProjectV2", null);
|
|
1102
|
+
tslib_1.__decorate([
|
|
1103
|
+
hooks_1.hooks([
|
|
1104
|
+
errorHandler_1.ErrorHandlerMW,
|
|
1105
|
+
supportV1ConditionHandler_1.SupportV1ConditionMW(true),
|
|
1106
|
+
questionModel_1.QuestionModelMW,
|
|
1107
|
+
contextInjector_1.ContextInjectorMW,
|
|
1108
|
+
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
1109
|
+
envInfoWriterV3_1.EnvInfoWriterMW_V3(true),
|
|
1110
|
+
]),
|
|
1111
|
+
tslib_1.__metadata("design:type", Function),
|
|
1112
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
1113
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
1114
|
+
], FxCore.prototype, "createProjectV3", null);
|
|
864
1115
|
tslib_1.__decorate([
|
|
865
1116
|
hooks_1.hooks([
|
|
866
1117
|
errorHandler_1.ErrorHandlerMW,
|
|
@@ -883,7 +1134,7 @@ tslib_1.__decorate([
|
|
|
883
1134
|
projectMigrator_1.ProjectMigratorMW,
|
|
884
1135
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
885
1136
|
envInfoLoader_1.EnvInfoLoaderMW(false),
|
|
886
|
-
solutionLoader_1.SolutionLoaderMW
|
|
1137
|
+
solutionLoader_1.SolutionLoaderMW,
|
|
887
1138
|
questionModel_1.QuestionModelMW,
|
|
888
1139
|
contextInjector_1.ContextInjectorMW,
|
|
889
1140
|
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
@@ -892,7 +1143,25 @@ tslib_1.__decorate([
|
|
|
892
1143
|
tslib_1.__metadata("design:type", Function),
|
|
893
1144
|
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
894
1145
|
tslib_1.__metadata("design:returntype", Promise)
|
|
895
|
-
], FxCore.prototype, "
|
|
1146
|
+
], FxCore.prototype, "provisionResourcesV2", null);
|
|
1147
|
+
tslib_1.__decorate([
|
|
1148
|
+
hooks_1.hooks([
|
|
1149
|
+
errorHandler_1.ErrorHandlerMW,
|
|
1150
|
+
concurrentLocker_1.ConcurrentLockerMW,
|
|
1151
|
+
supportV1ConditionHandler_1.SupportV1ConditionMW(false),
|
|
1152
|
+
projectMigrator_1.ProjectMigratorMW,
|
|
1153
|
+
projectSettingsLoaderV3_1.ProjectSettingsLoaderMW_V3,
|
|
1154
|
+
envInfoLoaderV3_1.EnvInfoLoaderMW_V3(false),
|
|
1155
|
+
solutionLoaderV3_1.SolutionLoaderMW_V3,
|
|
1156
|
+
questionModel_1.QuestionModelMW,
|
|
1157
|
+
contextInjector_1.ContextInjectorMW,
|
|
1158
|
+
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
1159
|
+
envInfoWriterV3_1.EnvInfoWriterMW_V3(),
|
|
1160
|
+
]),
|
|
1161
|
+
tslib_1.__metadata("design:type", Function),
|
|
1162
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
1163
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
1164
|
+
], FxCore.prototype, "provisionResourcesV3", null);
|
|
896
1165
|
tslib_1.__decorate([
|
|
897
1166
|
hooks_1.hooks([
|
|
898
1167
|
errorHandler_1.ErrorHandlerMW,
|
|
@@ -901,7 +1170,7 @@ tslib_1.__decorate([
|
|
|
901
1170
|
projectMigrator_1.ProjectMigratorMW,
|
|
902
1171
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
903
1172
|
envInfoLoader_1.EnvInfoLoaderMW(false),
|
|
904
|
-
solutionLoader_1.SolutionLoaderMW
|
|
1173
|
+
solutionLoader_1.SolutionLoaderMW,
|
|
905
1174
|
questionModel_1.QuestionModelMW,
|
|
906
1175
|
contextInjector_1.ContextInjectorMW,
|
|
907
1176
|
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
@@ -910,7 +1179,25 @@ tslib_1.__decorate([
|
|
|
910
1179
|
tslib_1.__metadata("design:type", Function),
|
|
911
1180
|
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
912
1181
|
tslib_1.__metadata("design:returntype", Promise)
|
|
913
|
-
], FxCore.prototype, "
|
|
1182
|
+
], FxCore.prototype, "deployArtifactsV2", null);
|
|
1183
|
+
tslib_1.__decorate([
|
|
1184
|
+
hooks_1.hooks([
|
|
1185
|
+
errorHandler_1.ErrorHandlerMW,
|
|
1186
|
+
concurrentLocker_1.ConcurrentLockerMW,
|
|
1187
|
+
supportV1ConditionHandler_1.SupportV1ConditionMW(false),
|
|
1188
|
+
projectMigrator_1.ProjectMigratorMW,
|
|
1189
|
+
projectSettingsLoaderV3_1.ProjectSettingsLoaderMW_V3,
|
|
1190
|
+
envInfoLoaderV3_1.EnvInfoLoaderMW_V3(false),
|
|
1191
|
+
solutionLoaderV3_1.SolutionLoaderMW_V3,
|
|
1192
|
+
questionModel_1.QuestionModelMW,
|
|
1193
|
+
contextInjector_1.ContextInjectorMW,
|
|
1194
|
+
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
1195
|
+
envInfoWriterV3_1.EnvInfoWriterMW_V3(),
|
|
1196
|
+
]),
|
|
1197
|
+
tslib_1.__metadata("design:type", Function),
|
|
1198
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
1199
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
1200
|
+
], FxCore.prototype, "deployArtifactsV3", null);
|
|
914
1201
|
tslib_1.__decorate([
|
|
915
1202
|
hooks_1.hooks([
|
|
916
1203
|
errorHandler_1.ErrorHandlerMW,
|
|
@@ -921,7 +1208,7 @@ tslib_1.__decorate([
|
|
|
921
1208
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
922
1209
|
envInfoLoader_1.EnvInfoLoaderMW(true),
|
|
923
1210
|
localSettingsLoader_1.LocalSettingsLoaderMW,
|
|
924
|
-
solutionLoader_1.SolutionLoaderMW
|
|
1211
|
+
solutionLoader_1.SolutionLoaderMW,
|
|
925
1212
|
questionModel_1.QuestionModelMW,
|
|
926
1213
|
contextInjector_1.ContextInjectorMW,
|
|
927
1214
|
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
@@ -931,7 +1218,44 @@ tslib_1.__decorate([
|
|
|
931
1218
|
tslib_1.__metadata("design:type", Function),
|
|
932
1219
|
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
933
1220
|
tslib_1.__metadata("design:returntype", Promise)
|
|
934
|
-
], FxCore.prototype, "
|
|
1221
|
+
], FxCore.prototype, "localDebugV2", null);
|
|
1222
|
+
tslib_1.__decorate([
|
|
1223
|
+
hooks_1.hooks([
|
|
1224
|
+
errorHandler_1.ErrorHandlerMW,
|
|
1225
|
+
concurrentLocker_1.ConcurrentLockerMW,
|
|
1226
|
+
supportV1ConditionHandler_1.SupportV1ConditionMW(true),
|
|
1227
|
+
projectMigrator_1.ProjectMigratorMW,
|
|
1228
|
+
projectUpgrader_1.ProjectUpgraderMW,
|
|
1229
|
+
projectSettingsLoaderV3_1.ProjectSettingsLoaderMW_V3,
|
|
1230
|
+
localSettingsLoader_1.LocalSettingsLoaderMW,
|
|
1231
|
+
solutionLoaderV3_1.SolutionLoaderMW_V3,
|
|
1232
|
+
questionModel_1.QuestionModelMW,
|
|
1233
|
+
contextInjector_1.ContextInjectorMW,
|
|
1234
|
+
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
1235
|
+
localSettingsWriter_1.LocalSettingsWriterMW,
|
|
1236
|
+
]),
|
|
1237
|
+
tslib_1.__metadata("design:type", Function),
|
|
1238
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
1239
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
1240
|
+
], FxCore.prototype, "localDebugV3", null);
|
|
1241
|
+
tslib_1.__decorate([
|
|
1242
|
+
hooks_1.hooks([
|
|
1243
|
+
errorHandler_1.ErrorHandlerMW,
|
|
1244
|
+
concurrentLocker_1.ConcurrentLockerMW,
|
|
1245
|
+
supportV1ConditionHandler_1.SupportV1ConditionMW(false),
|
|
1246
|
+
projectMigrator_1.ProjectMigratorMW,
|
|
1247
|
+
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
1248
|
+
envInfoLoader_1.EnvInfoLoaderMW(false),
|
|
1249
|
+
solutionLoader_1.SolutionLoaderMW,
|
|
1250
|
+
questionModel_1.QuestionModelMW,
|
|
1251
|
+
contextInjector_1.ContextInjectorMW,
|
|
1252
|
+
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
1253
|
+
envInfoWriter_1.EnvInfoWriterMW(),
|
|
1254
|
+
]),
|
|
1255
|
+
tslib_1.__metadata("design:type", Function),
|
|
1256
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
1257
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
1258
|
+
], FxCore.prototype, "publishApplicationV2", null);
|
|
935
1259
|
tslib_1.__decorate([
|
|
936
1260
|
hooks_1.hooks([
|
|
937
1261
|
errorHandler_1.ErrorHandlerMW,
|
|
@@ -940,7 +1264,7 @@ tslib_1.__decorate([
|
|
|
940
1264
|
projectMigrator_1.ProjectMigratorMW,
|
|
941
1265
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
942
1266
|
envInfoLoader_1.EnvInfoLoaderMW(false),
|
|
943
|
-
solutionLoader_1.SolutionLoaderMW
|
|
1267
|
+
solutionLoader_1.SolutionLoaderMW,
|
|
944
1268
|
questionModel_1.QuestionModelMW,
|
|
945
1269
|
contextInjector_1.ContextInjectorMW,
|
|
946
1270
|
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
@@ -949,7 +1273,7 @@ tslib_1.__decorate([
|
|
|
949
1273
|
tslib_1.__metadata("design:type", Function),
|
|
950
1274
|
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
951
1275
|
tslib_1.__metadata("design:returntype", Promise)
|
|
952
|
-
], FxCore.prototype, "
|
|
1276
|
+
], FxCore.prototype, "publishApplicationV3", null);
|
|
953
1277
|
tslib_1.__decorate([
|
|
954
1278
|
hooks_1.hooks([
|
|
955
1279
|
errorHandler_1.ErrorHandlerMW,
|
|
@@ -959,7 +1283,7 @@ tslib_1.__decorate([
|
|
|
959
1283
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
960
1284
|
envInfoLoader_1.EnvInfoLoaderMW(false),
|
|
961
1285
|
localSettingsLoader_1.LocalSettingsLoaderMW,
|
|
962
|
-
solutionLoader_1.SolutionLoaderMW
|
|
1286
|
+
solutionLoader_1.SolutionLoaderMW,
|
|
963
1287
|
questionModel_1.QuestionModelMW,
|
|
964
1288
|
contextInjector_1.ContextInjectorMW,
|
|
965
1289
|
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
@@ -976,7 +1300,7 @@ tslib_1.__decorate([
|
|
|
976
1300
|
supportV1ConditionHandler_1.SupportV1ConditionMW(true),
|
|
977
1301
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
978
1302
|
envInfoLoader_1.EnvInfoLoaderMW(true),
|
|
979
|
-
solutionLoader_1.SolutionLoaderMW
|
|
1303
|
+
solutionLoader_1.SolutionLoaderMW,
|
|
980
1304
|
contextInjector_1.ContextInjectorMW,
|
|
981
1305
|
envInfoWriter_1.EnvInfoWriterMW(),
|
|
982
1306
|
]),
|
|
@@ -991,7 +1315,7 @@ tslib_1.__decorate([
|
|
|
991
1315
|
supportV1ConditionHandler_1.SupportV1ConditionMW(true),
|
|
992
1316
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
993
1317
|
envInfoLoader_1.EnvInfoLoaderMW(true),
|
|
994
|
-
solutionLoader_1.SolutionLoaderMW
|
|
1318
|
+
solutionLoader_1.SolutionLoaderMW,
|
|
995
1319
|
contextInjector_1.ContextInjectorMW,
|
|
996
1320
|
envInfoWriter_1.EnvInfoWriterMW(),
|
|
997
1321
|
]),
|
|
@@ -1022,7 +1346,7 @@ tslib_1.__decorate([
|
|
|
1022
1346
|
projectMigrator_1.ProjectMigratorMW,
|
|
1023
1347
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
1024
1348
|
envInfoLoader_1.EnvInfoLoaderMW(false),
|
|
1025
|
-
solutionLoader_1.SolutionLoaderMW
|
|
1349
|
+
solutionLoader_1.SolutionLoaderMW,
|
|
1026
1350
|
questionModel_1.QuestionModelMW,
|
|
1027
1351
|
contextInjector_1.ContextInjectorMW,
|
|
1028
1352
|
]),
|
|
@@ -1038,7 +1362,7 @@ tslib_1.__decorate([
|
|
|
1038
1362
|
projectMigrator_1.ProjectMigratorMW,
|
|
1039
1363
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
1040
1364
|
envInfoLoader_1.EnvInfoLoaderMW(false),
|
|
1041
|
-
solutionLoader_1.SolutionLoaderMW
|
|
1365
|
+
solutionLoader_1.SolutionLoaderMW,
|
|
1042
1366
|
questionModel_1.QuestionModelMW,
|
|
1043
1367
|
contextInjector_1.ContextInjectorMW,
|
|
1044
1368
|
]),
|
|
@@ -1054,7 +1378,7 @@ tslib_1.__decorate([
|
|
|
1054
1378
|
projectMigrator_1.ProjectMigratorMW,
|
|
1055
1379
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
1056
1380
|
envInfoLoader_1.EnvInfoLoaderMW(false),
|
|
1057
|
-
solutionLoader_1.SolutionLoaderMW
|
|
1381
|
+
solutionLoader_1.SolutionLoaderMW,
|
|
1058
1382
|
questionModel_1.QuestionModelMW,
|
|
1059
1383
|
contextInjector_1.ContextInjectorMW,
|
|
1060
1384
|
]),
|
|
@@ -1069,7 +1393,7 @@ tslib_1.__decorate([
|
|
|
1069
1393
|
supportV1ConditionHandler_1.SupportV1ConditionMW(true),
|
|
1070
1394
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
1071
1395
|
envInfoLoader_1.EnvInfoLoaderMW(true),
|
|
1072
|
-
solutionLoader_1.SolutionLoaderMW
|
|
1396
|
+
solutionLoader_1.SolutionLoaderMW,
|
|
1073
1397
|
questionModel_1.QuestionModelMW,
|
|
1074
1398
|
contextInjector_1.ContextInjectorMW,
|
|
1075
1399
|
]),
|
|
@@ -1121,7 +1445,7 @@ tslib_1.__decorate([
|
|
|
1121
1445
|
concurrentLocker_1.ConcurrentLockerMW,
|
|
1122
1446
|
supportV1ConditionHandler_1.SupportV1ConditionMW(false),
|
|
1123
1447
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
1124
|
-
solutionLoader_1.SolutionLoaderMW
|
|
1448
|
+
solutionLoader_1.SolutionLoaderMW,
|
|
1125
1449
|
envInfoLoader_1.EnvInfoLoaderMW(true),
|
|
1126
1450
|
contextInjector_1.ContextInjectorMW,
|
|
1127
1451
|
]),
|
|
@@ -1136,7 +1460,7 @@ tslib_1.__decorate([
|
|
|
1136
1460
|
supportV1ConditionHandler_1.SupportV1ConditionMW(true),
|
|
1137
1461
|
projectMigrator_1.ProjectMigratorMW,
|
|
1138
1462
|
projectSettingsLoader_1.ProjectSettingsLoaderMW,
|
|
1139
|
-
solutionLoader_1.SolutionLoaderMW
|
|
1463
|
+
solutionLoader_1.SolutionLoaderMW,
|
|
1140
1464
|
contextInjector_1.ContextInjectorMW,
|
|
1141
1465
|
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
1142
1466
|
]),
|
|
@@ -1144,26 +1468,73 @@ tslib_1.__decorate([
|
|
|
1144
1468
|
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
1145
1469
|
tslib_1.__metadata("design:returntype", Promise)
|
|
1146
1470
|
], FxCore.prototype, "activateEnv", null);
|
|
1471
|
+
tslib_1.__decorate([
|
|
1472
|
+
hooks_1.hooks([errorHandler_1.ErrorHandlerMW, questionModel_1.QuestionModelMW, contextInjector_1.ContextInjectorMW, projectSettingsWriter_1.ProjectSettingsWriterMW]),
|
|
1473
|
+
tslib_1.__metadata("design:type", Function),
|
|
1474
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
1475
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
1476
|
+
], FxCore.prototype, "init", null);
|
|
1477
|
+
tslib_1.__decorate([
|
|
1478
|
+
hooks_1.hooks([
|
|
1479
|
+
errorHandler_1.ErrorHandlerMW,
|
|
1480
|
+
projectSettingsLoaderV3_1.ProjectSettingsLoaderMW_V3,
|
|
1481
|
+
solutionLoaderV3_1.SolutionLoaderMW_V3,
|
|
1482
|
+
questionModel_1.QuestionModelMW,
|
|
1483
|
+
contextInjector_1.ContextInjectorMW,
|
|
1484
|
+
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
1485
|
+
]),
|
|
1486
|
+
tslib_1.__metadata("design:type", Function),
|
|
1487
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
1488
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
1489
|
+
], FxCore.prototype, "addModule", null);
|
|
1490
|
+
tslib_1.__decorate([
|
|
1491
|
+
hooks_1.hooks([
|
|
1492
|
+
errorHandler_1.ErrorHandlerMW,
|
|
1493
|
+
projectSettingsLoaderV3_1.ProjectSettingsLoaderMW_V3,
|
|
1494
|
+
solutionLoaderV3_1.SolutionLoaderMW_V3,
|
|
1495
|
+
questionModel_1.QuestionModelMW,
|
|
1496
|
+
contextInjector_1.ContextInjectorMW,
|
|
1497
|
+
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
1498
|
+
]),
|
|
1499
|
+
tslib_1.__metadata("design:type", Function),
|
|
1500
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
1501
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
1502
|
+
], FxCore.prototype, "scaffold", null);
|
|
1503
|
+
tslib_1.__decorate([
|
|
1504
|
+
hooks_1.hooks([
|
|
1505
|
+
errorHandler_1.ErrorHandlerMW,
|
|
1506
|
+
projectSettingsLoaderV3_1.ProjectSettingsLoaderMW_V3,
|
|
1507
|
+
solutionLoaderV3_1.SolutionLoaderMW_V3,
|
|
1508
|
+
questionModel_1.QuestionModelMW,
|
|
1509
|
+
contextInjector_1.ContextInjectorMW,
|
|
1510
|
+
projectSettingsWriter_1.ProjectSettingsWriterMW,
|
|
1511
|
+
]),
|
|
1512
|
+
tslib_1.__metadata("design:type", Function),
|
|
1513
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
1514
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
1515
|
+
], FxCore.prototype, "addResource", null);
|
|
1147
1516
|
exports.FxCore = FxCore;
|
|
1148
1517
|
async function createBasicFolderStructure(inputs) {
|
|
1149
1518
|
if (!inputs.projectPath) {
|
|
1150
1519
|
return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("projectPath"));
|
|
1151
1520
|
}
|
|
1152
1521
|
try {
|
|
1153
|
-
const appName = inputs[
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1522
|
+
const appName = inputs[question_2.QuestionAppName.name];
|
|
1523
|
+
if (inputs.platform !== teamsfx_api_1.Platform.VS) {
|
|
1524
|
+
await fs.writeFile(path.join(inputs.projectPath, `package.json`), JSON.stringify({
|
|
1525
|
+
name: appName,
|
|
1526
|
+
version: "0.0.1",
|
|
1527
|
+
description: "",
|
|
1528
|
+
author: "",
|
|
1529
|
+
scripts: {
|
|
1530
|
+
test: 'echo "Error: no test specified" && exit 1',
|
|
1531
|
+
},
|
|
1532
|
+
devDependencies: {
|
|
1533
|
+
"@microsoft/teamsfx-cli": "0.*",
|
|
1534
|
+
},
|
|
1535
|
+
license: "MIT",
|
|
1536
|
+
}, null, 4));
|
|
1537
|
+
}
|
|
1167
1538
|
await fs.writeFile(path.join(inputs.projectPath, `.gitignore`), tools_1.isMultiEnvEnabled()
|
|
1168
1539
|
? [
|
|
1169
1540
|
"node_modules",
|
|
@@ -1184,23 +1555,23 @@ async function createBasicFolderStructure(inputs) {
|
|
|
1184
1555
|
return teamsfx_api_1.ok(null);
|
|
1185
1556
|
}
|
|
1186
1557
|
exports.createBasicFolderStructure = createBasicFolderStructure;
|
|
1187
|
-
async function downloadSample(
|
|
1558
|
+
async function downloadSample(inputs, ctx) {
|
|
1188
1559
|
let fxError;
|
|
1189
|
-
const progress =
|
|
1560
|
+
const progress = exports.TOOLS.ui.createProgressBar("Fetch sample app", 3);
|
|
1190
1561
|
progress.start();
|
|
1191
1562
|
const telemetryProperties = {
|
|
1192
1563
|
[telemetry_1.TelemetryProperty.Success]: telemetry_1.TelemetrySuccess.Yes,
|
|
1193
1564
|
module: "fx-core",
|
|
1194
1565
|
};
|
|
1195
1566
|
try {
|
|
1196
|
-
let folder = inputs[
|
|
1567
|
+
let folder = inputs[question_2.QuestionRootFolder.name];
|
|
1197
1568
|
if (inputs.platform === teamsfx_api_1.Platform.VSCode) {
|
|
1198
1569
|
folder = tools_1.getRootDirectory();
|
|
1199
1570
|
await fs.ensureDir(folder);
|
|
1200
1571
|
}
|
|
1201
|
-
const sampleId = inputs[
|
|
1572
|
+
const sampleId = inputs[question_2.CoreQuestionNames.Samples];
|
|
1202
1573
|
if (!(sampleId && folder)) {
|
|
1203
|
-
throw error_1.InvalidInputError(`invalid answer for '${
|
|
1574
|
+
throw error_1.InvalidInputError(`invalid answer for '${question_2.CoreQuestionNames.Samples}'`, inputs);
|
|
1204
1575
|
}
|
|
1205
1576
|
telemetryProperties[telemetry_1.TelemetryProperty.SampleAppName] = sampleId;
|
|
1206
1577
|
const samples = __1.sampleProvider.SampleCollection.samples.filter((sample) => sample.id.toLowerCase() === sampleId.toLowerCase());
|
|
@@ -1217,12 +1588,15 @@ async function downloadSample(fxCore, inputs, ctx) {
|
|
|
1217
1588
|
}
|
|
1218
1589
|
}
|
|
1219
1590
|
progress.next(`Downloading from ${url}`);
|
|
1220
|
-
const fetchRes = await tools_1.fetchCodeZip(url);
|
|
1221
|
-
if (fetchRes
|
|
1222
|
-
throw
|
|
1591
|
+
const fetchRes = await tools_1.fetchCodeZip(url, sample.id);
|
|
1592
|
+
if (fetchRes.isErr()) {
|
|
1593
|
+
throw fetchRes.error;
|
|
1594
|
+
}
|
|
1595
|
+
else if (!fetchRes.value) {
|
|
1596
|
+
throw error_1.FetchSampleError(sample.id);
|
|
1223
1597
|
}
|
|
1224
1598
|
progress.next("Unzipping the sample package");
|
|
1225
|
-
await tools_1.saveFilesRecursively(new adm_zip_1.default(fetchRes.data), sampleId, sampleAppPath);
|
|
1599
|
+
await tools_1.saveFilesRecursively(new adm_zip_1.default(fetchRes.value.data), sampleId, sampleAppPath);
|
|
1226
1600
|
await tools_1.downloadSampleHook(sampleId, sampleAppPath);
|
|
1227
1601
|
progress.next("Update project settings");
|
|
1228
1602
|
const loadInputs = Object.assign(Object.assign({}, inputs), { projectPath: sampleAppPath });
|
|
@@ -1230,11 +1604,16 @@ async function downloadSample(fxCore, inputs, ctx) {
|
|
|
1230
1604
|
if (projectSettingsRes.isOk()) {
|
|
1231
1605
|
const projectSettings = projectSettingsRes.value;
|
|
1232
1606
|
projectSettings.projectId = inputs.projectId ? inputs.projectId : uuid.v4();
|
|
1607
|
+
projectSettings.isFromSample = true;
|
|
1233
1608
|
inputs.projectId = projectSettings.projectId;
|
|
1234
1609
|
telemetryProperties[telemetry_1.TelemetryProperty.ProjectId] = projectSettings.projectId;
|
|
1235
1610
|
ctx.projectSettings = projectSettings;
|
|
1236
1611
|
inputs.projectPath = sampleAppPath;
|
|
1237
1612
|
}
|
|
1613
|
+
else {
|
|
1614
|
+
telemetryProperties[telemetry_1.TelemetryProperty.ProjectId] =
|
|
1615
|
+
"unknown, failed to set projectId in projectSettings.json";
|
|
1616
|
+
}
|
|
1238
1617
|
progress.end(true);
|
|
1239
1618
|
telemetry_1.sendTelemetryEvent(telemetry_1.Component.core, telemetry_1.TelemetryEvent.DownloadSample, telemetryProperties);
|
|
1240
1619
|
return teamsfx_api_1.ok(sampleAppPath);
|
|
@@ -1260,13 +1639,13 @@ function newProjectSettings() {
|
|
|
1260
1639
|
return projectSettings;
|
|
1261
1640
|
}
|
|
1262
1641
|
exports.newProjectSettings = newProjectSettings;
|
|
1263
|
-
function createV2Context(
|
|
1642
|
+
function createV2Context(projectSettings) {
|
|
1264
1643
|
const context = {
|
|
1265
|
-
userInteraction:
|
|
1266
|
-
logProvider:
|
|
1267
|
-
telemetryReporter:
|
|
1644
|
+
userInteraction: exports.TOOLS.ui,
|
|
1645
|
+
logProvider: exports.TOOLS.logProvider,
|
|
1646
|
+
telemetryReporter: exports.TOOLS.telemetryReporter,
|
|
1268
1647
|
cryptoProvider: new crypto_1.LocalCrypto(projectSettings.projectId),
|
|
1269
|
-
permissionRequestProvider:
|
|
1648
|
+
permissionRequestProvider: exports.TOOLS.permissionRequest,
|
|
1270
1649
|
projectSetting: projectSettings,
|
|
1271
1650
|
};
|
|
1272
1651
|
return context;
|