split-operation-description-fix (#99)

This commit is contained in:
Qiaoqiao Zhang 2020-10-22 11:50:04 +08:00 коммит произвёл GitHub
Родитель 504bc6145e
Коммит 4cb6f4678a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 14 добавлений и 16 удалений

Просмотреть файл

@ -2,7 +2,7 @@ trigger:
- master
variables:
NodeVersion: '12.x'
NodeVersion: '12.16.1'
jobs:

Просмотреть файл

@ -13,7 +13,7 @@ schedules:
- master
variables:
NodeVersion: '12.x'
NodeVersion: '12.16.1'
VAR_REPO_URL: $(Build.Repository.Uri)
VAR_REPO_BRANCHNAME: $(Build.SourceBranchName)
VAR_BUILD_NUMBER: $(Build.BuildNumber)

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "@autorest/clicommon",
"version": "0.5.4",
"version": "0.5.5",
"description": "Autorest Azure Cli Common Module",
"main": "dist/index.js",
"engines": {

Просмотреть файл

@ -49,7 +49,7 @@
* Specify a SemVer range to ensure developers use a NodeJS version that is appropriate
* for your repo.
*/
"nodeSupportedVersionRange": ">=8.9.4 <11.0.0",
"nodeSupportedVersionRange": ">=8.9.4 <14.0.0",
"ensureConsistentVersions": true,
"projectFolderMinDepth": 1,
"projectFolderMaxDepth": 2,

Просмотреть файл

@ -1,5 +1,5 @@
import { Host, Session, startSession } from "@azure-tools/autorest-extension-base";
import { CodeModel, Operation, codeModelSchema, OperationGroup } from "@azure-tools/codemodel";
import { CodeModel, Operation, codeModelSchema } from "@azure-tools/codemodel";
import { Helper } from "../helper";
import { CliConst, CliCommonSchema } from "../schema";
import { NodeCliHelper, NodeExtensionHelper } from "../nodeHelper";
@ -31,7 +31,7 @@ export class SplitOperation{
// Link splitted operation to src opreation
NodeExtensionHelper.setSplitOperationOriginalOperation(splittedOperation, operation);
this.updateSplitOperationDescription(splittedOperation, group);
this.updateSplitOperationDescription(splittedOperation);
splittedGroupOperations.push(splittedOperation);
});
@ -43,20 +43,18 @@ export class SplitOperation{
}
}
private updateSplitOperationDescription(operation: Operation, group: OperationGroup): void {
private updateSplitOperationDescription(operation: Operation): void {
const create = 'Create';
const update = 'Update';
const opCliKey = NodeCliHelper.getCliKey(operation, '').toLowerCase();
const createOrUpdate: string = opCliKey.endsWith('#create') ? create : opCliKey.endsWith('#update') ? update : null;
if (!createOrUpdate) {
return;
if (opCliKey.endsWith("#create")) {
operation.language.default.description = operation.language.default.description.replace(/[cC]reates?( or |\/)[uU]pdates?|[uU]pdates?( or |\/)[cC]reates?/g, create);
}
if (opCliKey.endsWith("#update")) {
operation.language.default.description = operation.language.default.description.replace(/[cC]reates?( or |\/)[uU]pdates?|[uU]pdates?( or |\/)[cC]reates?|[cC]reates?/g, update);
}
const groupCliKey = NodeCliHelper.getCliKey(group, '');
const namingConvention: CliCommonSchema.NamingConvention = {
glossary: []
};
operation.language.default.description = createOrUpdate + ' ' + Helper.singularize(namingConvention, groupCliKey);
}
private async modifier(): Promise<void> {