Prompts user for desired action when autorest is not installed (#17305)

* Giving user option to install autorest globally or run via npx

* Adds message for when no files are generated (no models in spec)

* Adding test

* Reinstating the rest of the test suite

* PR feedback

* Fixing tests to stub new prompt when test runner doesn't have autorest installed

* PR feedback

* fix typo

* fix typo
This commit is contained in:
Benjin Dubishar
2021-10-15 13:26:58 -07:00
committed by GitHub
parent 7b66acd58b
commit 901b90317c
5 changed files with 62 additions and 14 deletions

View File

@@ -423,9 +423,14 @@ export enum DatabaseProjectItemType {
// AutoRest
export const autorestPostDeploymentScriptName = 'PostDeploymentScript.sql';
export const nodeButNotAutorestFound = localize('nodeButNotAutorestFound', "Autorest tool not found in system path, but found Node.js. Running via npx. Please execute 'npm install autorest -g' to install permanently.");
export const nodeNotFound = localize('nodeNotFound', "Neither autorest nor Node.js (npx) found in system path. Please install Node.js for autorest generation to work.");
export const nodeNotFound = localize('nodeNotFound', "Neither Autorest nor Node.js (npx) found in system path. Please install Node.js for Autorest generation to work.");
export const nodeButNotAutorestFoundPrompt = localize('nodeButNotAutorestFoundPrompt', "Autorest is not installed. To proceed, choose whether to run Autorest from a temporary location via 'npx' or install Autorest globally then run.");
export const installGlobally = localize('installGlobally', "Install globally");
export const runViaNpx = localize('runViaNpx', "Run via npx");
export const selectSpecFile = localize('selectSpecFile', "Select OpenAPI/Swagger spec file");
export function generatingProjectFailed(errorMessage: string) { return localize('generatingProjectFailed', "Generating project via AutoRest failed. Check output pane for more details. Error: {0}", errorMessage); }
export const noSqlFilesGenerated = localize('noSqlFilesGenerated', "No .sql files were generated by Autorest. Please confirm that your spec contains model definitions, or check the output log for details.");
export function multipleMostDeploymentScripts(count: number) { return localize('multipleMostDeploymentScripts', "Unexpected number of {0} files: {1}", autorestPostDeploymentScriptName, count); }
export const specSelectionText = localize('specSelectionText', "OpenAPI/Swagger spec");