Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: devScripts update #1260

Merged
merged 2 commits into from
Jul 30, 2024
Merged
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
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"dependencies": {
"@oclif/core": "^4",
"@salesforce/apex-node": "^7.0.4",
"@salesforce/core": "^8.1.1",
"@salesforce/core": "^8.2.7",
"@salesforce/kit": "^3.1.6",
"@salesforce/sf-plugins-core": "^11.2.1",
"@salesforce/sf-plugins-core": "^11.2.4",
"@salesforce/source-deploy-retrieve": "^12.1.8",
"@salesforce/source-tracking": "^7.1.0",
"@salesforce/ts-types": "^2.0.10",
"@salesforce/ts-types": "^2.0.11",
"chalk": "^5.3.0",
"cli-progress": "^3.12.0",
"got": "^13.0.0",
Expand All @@ -21,8 +21,8 @@
"devDependencies": {
"@oclif/plugin-command-snapshot": "^5.2.9",
"@oclif/plugin-help": "^6.2.3",
"@salesforce/cli-plugins-testkit": "^5.3.15",
"@salesforce/dev-scripts": "^10.2.6",
"@salesforce/cli-plugins-testkit": "^5.3.20",
"@salesforce/dev-scripts": "^10.2.8",
"@salesforce/plugin-command-reference": "^3.1.10",
"@salesforce/source-testkit": "^2.2.41",
"@salesforce/ts-sinon": "1.4.22",
Expand Down
20 changes: 9 additions & 11 deletions src/commands/force/mdapi/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@
import { Duration, env } from '@salesforce/kit';
import { Lifecycle, Messages, Org } from '@salesforce/core';
import { AsyncResult, DeployVersionData, MetadataApiDeploy } from '@salesforce/source-deploy-retrieve';
import {
arrayWithDeprecation,
Flags,
loglevel,
orgApiVersionFlagWithDeprecations,
Ux,
} from '@salesforce/sf-plugins-core';
import { Flags, loglevel, orgApiVersionFlagWithDeprecations, Ux } from '@salesforce/sf-plugins-core';
import { Interfaces } from '@oclif/core';
import {
DeployCommand,
Expand Down Expand Up @@ -76,8 +70,10 @@ export class Deploy extends DeployCommand {
summary: messages.getMessage('flags.testLevel.summary'),
options: ['NoTestRun', 'RunSpecifiedTests', 'RunLocalTests', 'RunAllTestsInOrg'],
}),
runtests: arrayWithDeprecation({
runtests: Flags.string({
char: 'r',
multiple: true,
delimiter: ',',
summary: messages.getMessage('flags.runTests.summary'),
}),
ignoreerrors: Flags.boolean({
Expand Down Expand Up @@ -128,7 +124,9 @@ export class Deploy extends DeployCommand {
resultsdir: Flags.directory({
summary: messages.getMessage('flags.resultsDir.summary'),
}),
coverageformatters: arrayWithDeprecation({
coverageformatters: Flags.string({
multiple: true,
delimiter: ',',
summary: messages.getMessage('flags.coverageFormatters.summary'),
options: reportsFormatters,
helpValue: reportsFormatters.join(','),
Expand Down Expand Up @@ -216,7 +214,7 @@ export class Deploy extends DeployCommand {

protected formatResult(): MdDeployResult | DeployCommandAsyncResult {
this.resultsDir = this.resolveOutputDir(
this.flags.coverageformatters,
this.flags.coverageformatters ?? [],
this.flags.junit,
this.flags.resultsdir,
this.deployResult?.response?.id,
Expand All @@ -242,7 +240,7 @@ export class Deploy extends DeployCommand {

if (!this.isAsync) {
this.maybeCreateRequestedReports({
coverageformatters: this.flags.coverageformatters,
coverageformatters: this.flags.coverageformatters ?? [],
junit: this.flags.junit,
org: this.org,
});
Expand Down
9 changes: 5 additions & 4 deletions src/commands/force/mdapi/deploy/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { Messages, Org } from '@salesforce/core';
import { Duration, env } from '@salesforce/kit';
import { RequestStatus } from '@salesforce/source-deploy-retrieve';
import {
arrayWithDeprecation,
Flags,
loglevel,
orgApiVersionFlagWithDeprecations,
Expand Down Expand Up @@ -65,7 +64,9 @@ export class Report extends DeployCommand {
resultsdir: Flags.directory({
summary: messages.getMessage('flags.resultsDir.summary'),
}),
coverageformatters: arrayWithDeprecation({
coverageformatters: Flags.string({
multiple: true,
delimiter: ',',
summary: messages.getMessage('flags.coverageFormatters.summary'),
options: reportsFormatters,
helpValue: reportsFormatters.join(','),
Expand Down Expand Up @@ -97,7 +98,7 @@ export class Report extends DeployCommand {
const deployId = this.resolveDeployId(this.flags.jobid);

this.resultsDir = this.resolveOutputDir(
this.flags.coverageformatters,
this.flags.coverageformatters ?? [],
this.flags.junit,
this.flags.resultsdir,
deployId,
Expand Down Expand Up @@ -160,7 +161,7 @@ export class Report extends DeployCommand {
);

this.maybeCreateRequestedReports({
coverageformatters: this.flags.coverageformatters,
coverageformatters: this.flags.coverageformatters ?? [],
junit: this.flags.junit,
org: this.org,
});
Expand Down
16 changes: 6 additions & 10 deletions src/commands/force/mdapi/retrieve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@ import {
RetrieveVersionData,
} from '@salesforce/source-deploy-retrieve';
import { Optional, ensure } from '@salesforce/ts-types';
import {
arrayWithDeprecation,
Flags,
loglevel,
requiredOrgFlagWithDeprecations,
Ux,
} from '@salesforce/sf-plugins-core';
import { Flags, loglevel, requiredOrgFlagWithDeprecations, Ux } from '@salesforce/sf-plugins-core';
import { Interfaces } from '@oclif/core';
import { resolveZipFileName, SourceCommand } from '../../../sourceCommand.js';
import { Stash } from '../../../stash.js';
Expand Down Expand Up @@ -66,7 +60,9 @@ export class Retrieve extends SourceCommand {
summary: messages.getMessage('flags.sourcedir.summary'),
exclusive: ['unpackaged', 'packagenames'],
}),
packagenames: arrayWithDeprecation({
packagenames: Flags.string({
multiple: true,
delimiter: ',',
char: 'p',
summary: messages.getMessage('flags.packagenames.summary'),
exclusive: ['sourcedir', 'unpackaged'],
Expand Down Expand Up @@ -123,7 +119,7 @@ export class Retrieve extends SourceCommand {

protected async retrieve(): Promise<void> {
const packagenames = this.flags.packagenames;
if (!packagenames && !this.flags.unpackaged) {
if (packagenames === this.unzip && !this.flags.unpackaged) {
this.sourceDir = this.resolveRootDir(this.flags.sourcedir);
}
this.retrieveTargetDir = this.resolveOutputDir(this.flags.retrievetargetdir);
Expand All @@ -135,7 +131,7 @@ export class Retrieve extends SourceCommand {
this.wait = waitFlag.minutes === -1 ? Duration.days(7) : waitFlag;
this.isAsync = this.wait.quantity === 0;

if (singlePackage && packagenames?.length > 1) {
if (singlePackage && packagenames?.length) {
throw new SfError(messages.getMessage('InvalidPackageNames', [packagenames.toString()]), 'InvalidPackageNames');
}

Expand Down
30 changes: 16 additions & 14 deletions src/commands/force/source/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ import { Lifecycle, Messages, Org } from '@salesforce/core';
import { Duration, env } from '@salesforce/kit';
import { SourceTracking } from '@salesforce/source-tracking';
import { AsyncResult, ComponentSetBuilder, DeployVersionData } from '@salesforce/source-deploy-retrieve';
import {
arrayWithDeprecation,
Flags,
loglevel,
orgApiVersionFlagWithDeprecations,
Ux,
} from '@salesforce/sf-plugins-core';
import { Flags, loglevel, orgApiVersionFlagWithDeprecations, Ux } from '@salesforce/sf-plugins-core';
import { Interfaces } from '@oclif/core';
import {
DeployCommand,
Expand Down Expand Up @@ -83,13 +77,15 @@ export class Deploy extends DeployCommand {
summary: messages.getMessage('flags.testLevel.summary'),
options: ['NoTestRun', 'RunSpecifiedTests', 'RunLocalTests', 'RunAllTestsInOrg'],
}),
runtests: arrayWithDeprecation({
runtests: Flags.string({
multiple: true,
delimiter: ',',
char: 'r',
summary: messages.getMessage('flags.runTests.summary'),
}),
ignoreerrors: Flags.boolean({
char: 'o',
// brfeak this
// break this
description: messages.getMessage('flags.ignoreErrors.description'),
summary: messages.getMessage('flags.ignoreErrors.summary'),
}),
Expand All @@ -113,14 +109,18 @@ export class Deploy extends DeployCommand {
verbose: Flags.boolean({
summary: messages.getMessage('flags.verbose.summary'),
}),
metadata: arrayWithDeprecation({
metadata: Flags.string({
multiple: true,
delimiter: ',',
char: 'm',
description: messages.getMessage('flags.metadata.description'),
summary: messages.getMessage('flags.metadata.summary'),
exactlyOne: xorFlags,
}),
sourcepath: arrayWithDeprecation({
sourcepath: Flags.string({
char: 'p',
multiple: true,
delimiter: ',',
description: messages.getMessage('flags.sourcePath.description'),
summary: messages.getMessage('flags.sourcePath.summary'),
exactlyOne: xorFlags,
Expand Down Expand Up @@ -153,7 +153,9 @@ export class Deploy extends DeployCommand {
resultsdir: Flags.directory({
summary: messages.getMessage('flags.resultsDir.summary'),
}),
coverageformatters: arrayWithDeprecation({
coverageformatters: Flags.string({
multiple: true,
delimiter: ',',
summary: messages.getMessage('flags.coverageFormatters.summary'),
options: reportsFormatters,
helpValue: reportsFormatters.join(','),
Expand Down Expand Up @@ -301,7 +303,7 @@ export class Deploy extends DeployCommand {

protected formatResult(): DeployCommandResult | DeployCommandAsyncResult {
this.resultsDir = this.resolveOutputDir(
this.flags.coverageformatters,
this.flags.coverageformatters ?? [],
this.flags.junit,
this.flags.resultsdir,
this.deployResult?.response?.id,
Expand All @@ -327,7 +329,7 @@ export class Deploy extends DeployCommand {

if (!this.isAsync) {
this.maybeCreateRequestedReports({
coverageformatters: this.flags.coverageformatters,
coverageformatters: this.flags.coverageformatters ?? [],
junit: this.flags.junit,
org: this.org,
});
Expand Down
9 changes: 5 additions & 4 deletions src/commands/force/source/deploy/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { Messages, SfProject } from '@salesforce/core';
import { Duration, env } from '@salesforce/kit';
import { ComponentSetBuilder } from '@salesforce/source-deploy-retrieve';
import {
arrayWithDeprecation,
Flags,
loglevel,
orgApiVersionFlagWithDeprecations,
Expand Down Expand Up @@ -65,7 +64,9 @@ export class Report extends DeployCommand {
resultsdir: Flags.directory({
summary: messages.getMessage('flags.resultsDir.summary'),
}),
coverageformatters: arrayWithDeprecation({
coverageformatters: Flags.string({
multiple: true,
delimiter: ',',
summary: messages.getMessage('flags.coverageFormatters.summary'),
options: reportsFormatters,
helpValue: reportsFormatters.join(','),
Expand All @@ -87,7 +88,7 @@ export class Report extends DeployCommand {
const deployId = this.resolveDeployId(this.flags.jobid);

this.resultsDir = this.resolveOutputDir(
this.flags.coverageformatters,
this.flags.coverageformatters ?? [],
this.flags.junit,
this.flags.resultsdir,
deployId,
Expand Down Expand Up @@ -151,7 +152,7 @@ export class Report extends DeployCommand {
);

this.maybeCreateRequestedReports({
coverageformatters: this.flags.coverageformatters,
coverageformatters: this.flags.coverageformatters ?? [],
junit: this.flags.junit,
org: this.flags['target-org'],
});
Expand Down
13 changes: 9 additions & 4 deletions src/commands/force/source/retrieve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
import { SourceTracking } from '@salesforce/source-tracking';
import { Interfaces } from '@oclif/core';
import {
arrayWithDeprecation,
Flags,
loglevel,
orgApiVersionFlagWithDeprecations,
Expand Down Expand Up @@ -65,7 +64,9 @@ export class Retrieve extends SourceCommand {
summary: messages.getMessage('flags.retrievetargetdir.summary'),
exclusive: ['packagenames', 'sourcepath'],
}),
sourcepath: arrayWithDeprecation({
sourcepath: Flags.string({
multiple: true,
delimiter: ',',
char: 'p',
description: messages.getMessage('flags.sourcePath.description'),
summary: messages.getMessage('flags.sourcePath.summary'),
Expand All @@ -85,13 +86,17 @@ export class Retrieve extends SourceCommand {
summary: messages.getMessage('flags.manifest.summary'),
exclusive: ['metadata', 'sourcepath'],
}),
metadata: arrayWithDeprecation({
metadata: Flags.string({
multiple: true,
delimiter: ',',
char: 'm',
description: messages.getMessage('flags.metadata.description'),
summary: messages.getMessage('flags.metadata.summary'),
exclusive: ['manifest', 'sourcepath'],
}),
packagenames: arrayWithDeprecation({
packagenames: Flags.string({
multiple: true,
delimiter: ',',
char: 'n',
summary: messages.getMessage('flags.packagename.summary'),
}),
Expand Down
2 changes: 1 addition & 1 deletion src/deployCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export abstract class DeployCommand extends SourceCommand {
if (resultsDir) {
return resultsDir;
}
if (coverageFormatters || junit) {
if (coverageFormatters.length || junit) {
if (deployId) {
return deployId;
}
Expand Down
1 change: 0 additions & 1 deletion test/commands/mdapi/retrieve.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ describe('force:mdapi:retrieve', () => {
sandbox.restore();
});

// Ensure SourceCommand.createComponentSet() args
const ensureCreateComponentSetArgs = (overrides?: Partial<ComponentSetOptions>) => {
const defaultArgs = {
packagenames: undefined,
Expand Down
Loading
Loading