Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

Commit

Permalink
split-operation-description-fix (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaozha authored Oct 22, 2020
1 parent 504bc61 commit 4cb6f46
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion azure-pipelines/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ trigger:
- master

variables:
NodeVersion: '12.x'
NodeVersion: '12.16.1'

jobs:

Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion rush.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
22 changes: 10 additions & 12 deletions src/plugins/splitOperation.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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);
});

Expand All @@ -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> {
Expand Down

0 comments on commit 4cb6f46

Please sign in to comment.