Skip to content

Commit 92e4259

Browse files
fix: update to latest dev-scripts (#323)
Co-authored-by: Cristian Dominguez <cdominguez@salesforce.com>
1 parent c9e3658 commit 92e4259

13 files changed

Lines changed: 1881 additions & 840 deletions

File tree

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ docs
3030
*.sig
3131
package.json.bak.
3232

33+
34+
npm-shrinkwrap.json
35+
oclif.manifest.json
36+
oclif.lock
37+
3338
# -- CLEAN ALL
3439
*.tsbuildinfo
3540
.eslintcache
@@ -43,6 +48,5 @@ node_modules
4348
.DS_Store
4449
.idea
4550

46-
oclif.manifest.json
51+
4752
tsconfig.tsbuildinfo
48-
oclif.lock

package.json

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,27 @@
55
"author": "Salesforce",
66
"bugs": "https://github.com/forcedotcom/cli/issues",
77
"dependencies": {
8-
"@oclif/core": "^2.15.0",
9-
"@salesforce/core": "^5.3.20",
10-
"@salesforce/kit": "^3.0.9",
11-
"@salesforce/sf-plugins-core": "^3.1.25",
8+
"@oclif/core": "^3",
9+
"@salesforce/core": "^6.4.2",
10+
"@salesforce/kit": "^3.0.15",
11+
"@salesforce/sf-plugins-core": "^5.0.1",
12+
"@salesforce/ts-types": "^2.0.9",
13+
"chalk": "^4",
14+
"jsforce": "^2.0.0-beta.29",
1215
"tslib": "^2"
1316
},
1417
"devDependencies": {
15-
"@oclif/plugin-command-snapshot": "^4.0.14",
16-
"@oclif/test": "^2.4.2",
17-
"@salesforce/cli-plugins-testkit": "^4.4.12",
18-
"@salesforce/dev-scripts": "^6.0.4",
18+
"@oclif/plugin-command-snapshot": "^5",
19+
"@oclif/test": "^3",
20+
"@salesforce/cli-plugins-testkit": "^5",
21+
"@salesforce/dev-scripts": "^8",
1922
"@salesforce/plugin-command-reference": "^3.0.68",
2023
"@salesforce/ts-sinon": "^1.4.19",
21-
"@swc/cli": "^0.3.10",
22-
"@swc/core": "1.3.39",
24+
"@swc/cli": "^0.3.9",
25+
"@swc/core": "^1.3.39",
2326
"eslint-plugin-sf-plugin": "^1.17.4",
24-
"oclif": "^3.17.2",
25-
"shx": "0.3.4",
26-
"ts-node": "^10.9.1",
27+
"oclif": "^4",
28+
"ts-node": "^10.9.2",
2729
"typescript": "^4.9.5"
2830
},
2931
"engines": {
@@ -32,9 +34,10 @@
3234
"files": [
3335
"/lib",
3436
"/messages",
37+
"/npm-shrinkwrap.json",
38+
"/oclif.lock",
3539
"/oclif.manifest.json",
36-
"/schemas",
37-
"/oclif.lock"
40+
"/schemas"
3841
],
3942
"homepage": "https://github.com/salesforcecli/plugin-devops-center",
4043
"keywords": [
@@ -79,12 +82,12 @@
7982
"build": "wireit",
8083
"clean": "sf-clean",
8184
"clean-all": "sf-clean all",
82-
"clean:lib": "shx rm -rf lib && shx rm -rf coverage && shx rm -rf .nyc_output && shx rm -f oclif.manifest.json",
8385
"compile": "wireit",
8486
"docs": "sf-docs",
8587
"format": "wireit",
88+
"link-check": "wireit",
8689
"lint": "wireit",
87-
"postpack": "shx rm -f oclif.manifest.json",
90+
"postpack": "sf-clean --ignore-signing-artifacts",
8891
"prepack": "sf-prepack",
8992
"prepare": "sf-install",
9093
"test": "wireit",
@@ -152,7 +155,8 @@
152155
"test:command-reference",
153156
"test:deprecation-policy",
154157
"lint",
155-
"test:json-schema"
158+
"test:json-schema",
159+
"link-check"
156160
]
157161
},
158162
"test:only": {
@@ -198,6 +202,15 @@
198202
"schemas"
199203
],
200204
"output": []
205+
},
206+
"link-check": {
207+
"command": "node -e \"process.exit(process.env.CI ? 0 : 1)\" || linkinator \"**/*.md\" --skip \"CHANGELOG.md|node_modules|test/|confluence.internal.salesforce.com|my.salesforce.com|%s\" --markdown --retry --directory-listing --verbosity error",
208+
"files": [
209+
"./*.md",
210+
"./!(CHANGELOG).md",
211+
"messages/**/*.md"
212+
],
213+
"output": []
201214
}
202215
}
203216
}

src/common/base/abstractAsyncOperation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Messages.importMessagesDirectory(__dirname);
1717
const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
1818

1919
export abstract class AsyncCommand extends SfCommand<AsyncOperationResultJson> {
20+
public static readonly enableJsonFlag = true;
2021
protected targetOrg: Org;
2122
private asyncOperationId: string;
2223
private outputService: PromoteOutputService;

src/common/base/abstractPromote.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
* Licensed under the BSD 3-Clause license.
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
7-
import { Org } from '@salesforce/core';
87
import { SfCommand } from '@salesforce/sf-plugins-core';
9-
import { Flags, Interfaces } from '@oclif/core';
8+
import { Interfaces } from '@oclif/core';
109
import { HttpRequest } from 'jsforce';
1110
import { fetchAndValidatePipelineStage, PipelineStage, PromoteOptions, validateTestFlags } from '..';
1211
import { devopsCenterProjectName, requiredDoceOrgFlag, wait, verbose, concise } from '../flags/flags';
@@ -29,6 +28,7 @@ export type Flags<T extends typeof SfCommand> = Interfaces.InferredFlags<
2928
>;
3029

3130
export abstract class PromoteCommand<T extends typeof SfCommand> extends AsyncCommand {
31+
public static readonly enableJsonFlag = true;
3232
// common flags that can be inherited by any command that extends PromoteCommand
3333
public static baseFlags = {
3434
'branch-name': branchName,
@@ -56,10 +56,11 @@ export abstract class PromoteCommand<T extends typeof SfCommand> extends AsyncCo
5656
const { flags } = await this.parse({
5757
flags: this.ctor.flags,
5858
baseFlags: (super.ctor as typeof PromoteCommand).baseFlags,
59+
enableJsonFlag: this.ctor.enableJsonFlag,
5960
});
6061
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
6162
this.flags = flags as Flags<T>;
62-
this.targetOrg = this.flags['devops-center-username'] as Org;
63+
this.targetOrg = this.flags['devops-center-username'];
6364
this.setOutputService(new OutputServiceFactory().forDeployment(this.flags, this.targetOrg.getConnection()));
6465
}
6566

src/common/base/abstractQuick.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
77
import { Interfaces } from '@oclif/core';
8-
import { Messages, Org } from '@salesforce/core';
9-
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
8+
import { Messages } from '@salesforce/core';
9+
import { Flags as SfFlags, SfCommand } from '@salesforce/sf-plugins-core';
1010
import { HttpRequest } from 'jsforce';
1111
import { ApiPromoteResponse, AsyncOperationStatus, PipelineStage, PromoteOptions } from '..';
1212
import { REST_PROMOTE_BASE_URL } from '../constants';
@@ -30,19 +30,20 @@ Messages.importMessagesDirectory(__dirname);
3030
const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'project.deploy.pipeline.quick');
3131

3232
export default abstract class QuickPromotionCommand<T extends typeof SfCommand> extends AsyncCommand {
33+
public static readonly enableJsonFlag = true;
3334
public static baseFlags = {
3435
async,
3536
concise,
3637
verbose,
3738
wait,
3839
'devops-center-username': requiredDoceOrgFlag(),
39-
'job-id': Flags.salesforceId({
40+
'job-id': SfFlags.salesforceId({
4041
char: 'i',
4142
description: messages.getMessage('flags.job-id.description'),
4243
summary: messages.getMessage('flags.job-id.summary'),
4344
exactlyOne: ['use-most-recent', 'job-id'],
4445
}),
45-
'use-most-recent': Flags.boolean({
46+
'use-most-recent': SfFlags.boolean({
4647
char: 'r',
4748
description: messages.getMessage('flags.use-most-recent.description'),
4849
summary: messages.getMessage('flags.use-most-recent.summary'),
@@ -59,9 +60,10 @@ export default abstract class QuickPromotionCommand<T extends typeof SfCommand>
5960
const { flags } = await this.parse({
6061
flags: this.ctor.flags,
6162
baseFlags: (super.ctor as typeof QuickPromotionCommand).baseFlags,
63+
enableJsonFlag: this.ctor.enableJsonFlag,
6264
});
6365
this.flags = flags as Flags<T>;
64-
this.targetOrg = this.flags['devops-center-username'] as Org;
66+
this.targetOrg = this.flags['devops-center-username'];
6567
}
6668

6769
/**
@@ -79,7 +81,7 @@ export default abstract class QuickPromotionCommand<T extends typeof SfCommand>
7981
this.setOutputService(
8082
new OutputServiceFactory().forQuickDeployment(
8183
this.flags,
82-
(this.flags['devops-center-username'] as Org).getConnection(),
84+
this.flags['devops-center-username'].getConnection(),
8385
this.targetStage.sf_devops__Branch__r.sf_devops__Name__c
8486
)
8587
);

src/common/base/abstractReportOnPromote.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* Licensed under the BSD 3-Clause license.
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
7-
import { Messages, Org } from '@salesforce/core';
7+
import { Messages } from '@salesforce/core';
88
import { SfCommand } from '@salesforce/sf-plugins-core';
9-
import { Flags, Interfaces } from '@oclif/core';
9+
import { Interfaces } from '@oclif/core';
1010
import { DeployPipelineCache } from '../../common/deployPipelineCache';
1111
import { PromotePipelineResult } from '../../common';
1212
import { requiredDoceOrgFlag } from '../../common/flags/flags';
@@ -23,6 +23,7 @@ export type Flags<T extends typeof SfCommand> = Interfaces.InferredFlags<
2323
>;
2424

2525
export abstract class ReportOnPromoteCommand<T extends typeof SfCommand> extends SfCommand<PromotePipelineResult> {
26+
public static readonly enableJsonFlag = true;
2627
public static baseFlags = {
2728
'devops-center-username': requiredDoceOrgFlag(),
2829
};
@@ -35,6 +36,7 @@ export abstract class ReportOnPromoteCommand<T extends typeof SfCommand> extends
3536
const { flags } = await this.parse({
3637
flags: this.ctor.flags,
3738
baseFlags: (super.ctor as typeof ReportOnPromoteCommand).baseFlags,
39+
enableJsonFlag: this.ctor.enableJsonFlag,
3840
});
3941
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
4042
this.flags = flags as Flags<T>;
@@ -47,7 +49,7 @@ export abstract class ReportOnPromoteCommand<T extends typeof SfCommand> extends
4749
const asyncJobId = this.flags['use-most-recent']
4850
? (await DeployPipelineCache.create()).getLatestKeyOrThrow()
4951
: (this.flags['job-id'] as string);
50-
const org = this.flags['devops-center-username'] as Org;
52+
const org = this.flags['devops-center-username'];
5153

5254
// query the deployment result related to the promote operation.
5355
const operationResult: DeploymentResult | null = await selectOneDeploymentResultByAsyncJobId(

src/common/base/abstractResume.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Licensed under the BSD 3-Clause license.
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
7-
import { Messages, Org } from '@salesforce/core';
7+
import { Messages } from '@salesforce/core';
88
import { SfCommand } from '@salesforce/sf-plugins-core';
99
import { Flags, Interfaces } from '@oclif/core';
1010
import {
@@ -37,10 +37,11 @@ export type Flags<T extends typeof SfCommand> = Interfaces.InferredFlags<
3737

3838
/**
3939
*
40-
* Base class with the common logic to resume an in progress opeation
40+
* Base class with the common logic to resume an in progress operation
4141
*/
4242

4343
export abstract class ResumeCommand<T extends typeof SfCommand> extends AsyncCommand {
44+
public static readonly enableJsonFlag = true;
4445
// common flags that can be inherited by any command that extends ResumeCommand
4546
public static baseFlags = {
4647
'devops-center-username': requiredDoceOrgFlag(),
@@ -67,7 +68,7 @@ export abstract class ResumeCommand<T extends typeof SfCommand> extends AsyncCom
6768
new OutputServiceFactory().forResume(
6869
this.flags,
6970
this.operationType,
70-
(this.flags['devops-center-username'] as Org).getConnection()
71+
this.flags['devops-center-username'].getConnection()
7172
)
7273
);
7374
}
@@ -78,7 +79,7 @@ export abstract class ResumeCommand<T extends typeof SfCommand> extends AsyncCom
7879
: (this.flags['job-id'] as string);
7980

8081
// get the latest state of the async job and validate that it's resumable
81-
this.targetOrg = this.flags['devops-center-username'] as Org;
82+
this.targetOrg = this.flags['devops-center-username'];
8283
const asyncJob: AsyncOperationResult = await fetchAsyncOperationResult(this.targetOrg.getConnection(), asyncJobId);
8384
if (asyncJob.sf_devops__Status__c && isNotResumable(asyncJob.sf_devops__Status__c)) {
8485
throw messages.createError('error.JobNotResumable', [asyncJobId, asyncJob.sf_devops__Status__c]);

src/common/deployPipelineCache.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import { Global, Messages, TTLConfig } from '@salesforce/core';
99
import { Duration } from '@salesforce/kit';
10-
import { JsonMap } from '@salesforce/ts-types';
1110

1211
Messages.importMessagesDirectory(__dirname);
1312
const cacheMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'cache');
@@ -63,7 +62,7 @@ export class DeployPipelineCache extends TTLConfig<TTLConfig.Options, AsyncOpera
6362
* Updates the aorId with the data sent
6463
* Merges the data sent with the existing one
6564
*/
66-
public static async update(aorId: string, data: JsonMap): Promise<void> {
65+
public static async update(aorId: string, data: Partial<TTLConfig.Entry<AsyncOperationData>>): Promise<void> {
6766
const cache = await DeployPipelineCache.create();
6867
cache.update(aorId, data);
6968
await cache.write();

src/common/selectors/selectorUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export async function runSafeQuery<T extends Record>(
2727
// Run the query and verify for results
2828
try {
2929
// We query for 10000 results and we use autoFetch to queryMore automatically.
30-
const result: QueryResult<T> = await con.query(queryStr, { autoFetch: true, maxFetch: 10000 });
30+
const result: QueryResult<T> = await con.query(queryStr, { autoFetch: true, maxFetch: 10_000 });
3131
if ((result.totalSize > 0 && result.records) || (result.totalSize === 0 && allowNullResults)) {
3232
return result;
3333
}

0 commit comments

Comments
 (0)