Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .eslintrc.cjs

This file was deleted.

4 changes: 4 additions & 0 deletions .github/workflows/onRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ jobs:
- uses: salesforcecli/github-workflows/.github/actions/getPreReleaseTag@main
id: distTag
npm:
permissions:
id-token: write
contents: read
uses: salesforcecli/github-workflows/.github/workflows/npmPublish.yml@main
needs: [getDistTag]
with:
trustedPublishing: true
ctc: true
sign: true
tag: ${{ needs.getDistTag.outputs.tag || 'latest' }}
Expand Down
214 changes: 214 additions & 0 deletions eslint-suppressions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
{
"src/commands/devops/stage/branch/delete.ts": {
"complexity": {
"count": 1
}
},
"src/common/flags/flags.ts": {
"@typescript-eslint/no-base-to-string": {
"count": 1
}
},
"src/common/outputService/deploySummaryBuilder.ts": {
"@typescript-eslint/no-misused-promises": {
"count": 1
},
"@typescript-eslint/switch-exhaustiveness-check": {
"count": 1
}
},
"src/common/outputService/promoteOutputService.ts": {
"@typescript-eslint/no-misused-promises": {
"count": 2
}
},
"src/common/outputService/resumeOutputService.ts": {
"@typescript-eslint/no-misused-promises": {
"count": 1
}
},
"src/utils/createPullRequest.ts": {
"@typescript-eslint/no-base-to-string": {
"count": 1
},
"preserve-caught-error": {
"count": 1
}
},
"src/utils/workItems.ts": {
"@typescript-eslint/no-base-to-string": {
"count": 1
}
},
"test/commands/devops/pipeline/stage/update.test.ts": {
"@typescript-eslint/no-unsafe-call": {
"count": 1
},
"@typescript-eslint/no-unsafe-member-access": {
"count": 1
}
},
"test/commands/devops/work-item/combine.test.ts": {
"@typescript-eslint/no-unsafe-member-access": {
"count": 2
}
},
"test/commands/devops/work-item/prepare.test.ts": {
"@typescript-eslint/no-unsafe-member-access": {
"count": 2
}
},
"test/commands/project/deploy/pipeline/quick.test.ts": {
"@typescript-eslint/no-unsafe-call": {
"count": 20
},
"@typescript-eslint/no-unsafe-member-access": {
"count": 21
}
},
"test/commands/project/deploy/pipeline/report.test.ts": {
"@typescript-eslint/no-unsafe-call": {
"count": 11
},
"@typescript-eslint/no-unsafe-member-access": {
"count": 15
}
},
"test/commands/project/deploy/pipeline/resume.test.ts": {
"@typescript-eslint/no-unsafe-call": {
"count": 9
},
"@typescript-eslint/no-unsafe-member-access": {
"count": 10
}
},
"test/commands/project/deploy/pipeline/start.test.ts": {
"@typescript-eslint/no-unsafe-call": {
"count": 19
},
"@typescript-eslint/no-unsafe-member-access": {
"count": 20
}
},
"test/commands/project/deploy/pipeline/validate.test.ts": {
"@typescript-eslint/no-unsafe-call": {
"count": 2
},
"@typescript-eslint/no-unsafe-member-access": {
"count": 3
}
},
"test/common/outputService/aorOutputService.test.ts": {
"@typescript-eslint/no-misused-promises": {
"count": 1
}
},
"test/common/outputService/promoteOutputService.test.ts": {
"@typescript-eslint/no-unsafe-call": {
"count": 17
},
"@typescript-eslint/no-unsafe-member-access": {
"count": 5
}
},
"test/common/outputService/resumeCommandOutputService.test.ts": {
"@typescript-eslint/no-unsafe-call": {
"count": 8
},
"@typescript-eslint/no-unsafe-member-access": {
"count": 8
},
"@typescript-eslint/no-unsafe-return": {
"count": 1
}
},
"test/common/utils.test.ts": {
"@typescript-eslint/no-unsafe-call": {
"count": 10
}
},
"test/configMeta.test.ts": {
"@typescript-eslint/no-unsafe-call": {
"count": 3
},
"@typescript-eslint/no-unsafe-member-access": {
"count": 6
}
},
"test/streamer/asyncOpStream.test.ts": {
"@typescript-eslint/no-misused-promises": {
"count": 1
}
},
"test/utils/activatePipeline.test.ts": {
"@typescript-eslint/no-unsafe-member-access": {
"count": 2
}
},
"test/utils/addStageBranch.test.ts": {
"@typescript-eslint/no-unsafe-member-access": {
"count": 8
}
},
"test/utils/addStageEnvironment.test.ts": {
"@typescript-eslint/no-unsafe-member-access": {
"count": 16
}
},
"test/utils/attachProject.test.ts": {
"@typescript-eslint/no-unsafe-call": {
"count": 2
},
"@typescript-eslint/no-unsafe-member-access": {
"count": 3
}
},
"test/utils/combineWorkItems.test.ts": {
"@typescript-eslint/no-unsafe-member-access": {
"count": 7
}
},
"test/utils/createPipeline.test.ts": {
"@typescript-eslint/no-unsafe-member-access": {
"count": 10
}
},
"test/utils/createProject.test.ts": {
"@typescript-eslint/no-unsafe-member-access": {
"count": 1
}
},
"test/utils/deleteStageBranch.test.ts": {
"@typescript-eslint/no-unsafe-member-access": {
"count": 1
}
},
"test/utils/prepareWorkItem.test.ts": {
"@typescript-eslint/no-unsafe-member-access": {
"count": 9
}
},
"test/utils/promoteStage.test.ts": {
"@typescript-eslint/no-unsafe-member-access": {
"count": 5
}
},
"test/utils/promotionUtils.test.ts": {
"@typescript-eslint/no-unsafe-member-access": {
"count": 15
}
},
"test/utils/updateWorkItem.test.ts": {
"@typescript-eslint/no-unsafe-member-access": {
"count": 2
}
},
"test/utils/workItems.test.ts": {
"@typescript-eslint/no-unsafe-call": {
"count": 8
},
"@typescript-eslint/no-unsafe-member-access": {
"count": 18
}
}
}
6 changes: 6 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import tsconfigs from 'eslint-config-salesforce-typescript';
import plugin from 'eslint-plugin-sf-plugin';

const configs = [...tsconfigs, ...plugin.configs.recommended];

export default configs;
19 changes: 13 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,20 @@
"@oclif/plugin-command-snapshot": "^5.2.3",
"@oclif/test": "^3",
"@salesforce/cli-plugins-testkit": "^5.3.20",
"@salesforce/dev-scripts": "^11",
"@salesforce/plugin-command-reference": "^3.1.38",
"@salesforce/ts-sinon": "^1.4.30",
"eslint-plugin-sf-plugin": "^1.20.13",
"@salesforce/dev-scripts": "^15.0.0",
"@salesforce/plugin-command-reference": "^3.1.141",
"@salesforce/ts-sinon": "^1.4.39",
"@types/chai": "^4.3.17",
"@types/mocha": "^10.0.10",
"@types/node": "^18",
"@types/sinon": "^10.0.20",
"eslint": "^10.4.0",
"eslint-config-salesforce-typescript": "^7.0.0",
"eslint-plugin-sf-plugin": "^3.0.1",
"esmock": "^2.7.6",
"oclif": "^4",
"oclif": "^6.0.8",
"tsx": "^4",
"typescript": "^5.7.2"
"typescript": "^6.0.0"
},
"engines": {
"node": ">=22.0.0"
Expand Down Expand Up @@ -177,6 +183,7 @@
"src/**/*.ts",
"test/**/*.ts",
"messages/**",
"**/eslint.config.*",
"**/.eslint*",
"**/tsconfig.json"
],
Expand Down
2 changes: 1 addition & 1 deletion src/commands/devops/pipeline/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default class DevopsPipelineUpdate extends SfCommand<PipelineUpdateResult
this.error(messages.getMessage('error.NoFlags'));
}

let stages: PipelineStageRecord[] = [];
let stages: PipelineStageRecord[];
try {
stages = await fetchPipelineStages(connection, pipelineId);
} catch (error: unknown) {
Expand Down
11 changes: 7 additions & 4 deletions src/common/base/abstractAsyncOperation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'comm

export abstract class AsyncCommand extends SfCommand<AsyncOperationResultJson> {
public static readonly enableJsonFlag = true;
protected targetOrg: Org;
private asyncOperationId: string;
private outputService: PromoteOutputService;
// assigned by the subclass command before monitorOperation runs
protected targetOrg!: Org;
// assigned in setAsyncOperationId
private asyncOperationId!: string;
// assigned in setOutputService
private outputService!: PromoteOutputService;

protected abstract baseCommand: string;

Expand Down Expand Up @@ -70,7 +73,7 @@ export abstract class AsyncCommand extends SfCommand<AsyncOperationResultJson> {
* @returns
*/
protected catch(error: Error | SfError): Promise<never> {
if (error.name && error.name.includes('GenericTimeoutError')) {
if (error.name?.includes('GenericTimeoutError')) {
const err = messages.createError('error.ClientTimeout', [this.config.bin, this.baseCommand]);
return super.catch({ ...error, name: err.name, message: err.message, code: err.code });
}
Expand Down
29 changes: 13 additions & 16 deletions src/common/base/abstractPromote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@
import { SfCommand } from '@salesforce/sf-plugins-core';
import { Interfaces } from '@oclif/core';
import { HttpRequest } from '@jsforce/jsforce-node';
import {
fetchAndValidatePipelineStage,
PipelineStage,
PromoteOptions,
TestLevel,
validateTestFlags,
} from '../index.js';
import { fetchAndValidatePipelineStage, PipelineStage, PromoteOptions, validateTestFlags } from '../index.js';
import { devopsCenterProjectName, requiredDoceOrgFlag, wait, verbose, concise } from '../flags/flags.js';
import {
branchName,
Expand Down Expand Up @@ -61,27 +55,30 @@ export abstract class PromoteCommand<T extends typeof SfCommand> extends AsyncCo
};

protected flags!: Flags<T>;
private targetStage: PipelineStage;
private sourceStageId: string;
private deployOptions: Partial<PromoteOptions>;
// assigned in executePromotion
private targetStage!: PipelineStage;
// assigned in executePromotion
private sourceStageId!: string;
// assigned in buildPromoteOptions
private deployOptions!: Partial<PromoteOptions>;
private numRetries409 = 50; // this is the number of times we retry if we get a http-409-Conflict response

public async init(): Promise<void> {
await super.init();
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment

const { flags } = await this.parse({
flags: this.ctor.flags,
baseFlags: (super.ctor as typeof PromoteCommand).baseFlags,
enableJsonFlag: this.ctor.enableJsonFlag,
});
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment

this.flags = flags as Flags<T>;
this.targetOrg = this.flags['devops-center-username'];
this.setOutputService(new OutputServiceFactory().forDeployment(this.flags, this.targetOrg.getConnection()));
}

protected async executePromotion(): Promise<AsyncOperationResultJson> {
validateTestFlags(this.flags['test-level'] as TestLevel | undefined, this.flags.tests);
validateTestFlags(this.flags['test-level'], this.flags.tests);
this.targetStage = await fetchAndValidatePipelineStage(
this.targetOrg,
this.flags['devops-center-project-name'],
Expand All @@ -90,7 +87,7 @@ export abstract class PromoteCommand<T extends typeof SfCommand> extends AsyncCo
this.sourceStageId = this.getSourceStageId();
this.setAsyncOperationId(await this.requestPromotionFlow());

return this.monitorOperation(this.flags.async as boolean, this.flags.wait);
return this.monitorOperation(this.flags.async, this.flags.wait);
}

/**
Expand Down Expand Up @@ -163,8 +160,8 @@ export abstract class PromoteCommand<T extends typeof SfCommand> extends AsyncCo

private buildPromoteOptions(): void {
this.deployOptions = {
fullDeploy: this.flags['deploy-all'] as boolean,
testLevel: (this.flags['test-level'] as string) ?? 'Default',
fullDeploy: this.flags['deploy-all'],
testLevel: this.flags['test-level'] ?? 'Default',
runTests: this.flags.tests ? this.flags.tests.join(',') : undefined,
// get more promote options from the concrete implementation if needed
...this.getPromoteOptions(),
Expand Down
Loading
Loading