Skip to content

Commit

Permalink
fix: revert beta GA (#446)
Browse files Browse the repository at this point in the history
* fix: revert beta GA

* chore: some more renameReplacedCommands

* chore: bump STL
  • Loading branch information
WillieRuemmele authored Mar 7, 2022
1 parent 501cd80 commit 0efcaa1
Show file tree
Hide file tree
Showing 18 changed files with 168 additions and 141 deletions.
66 changes: 33 additions & 33 deletions command-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,36 @@
"flags": ["apiversion", "folder", "json", "loglevel", "metadatatype", "resultfile", "targetusername"],
"alias": []
},
{
"command": "force:source:beta:pull",
"plugin": "@salesforce/plugin-source",
"flags": ["apiversion", "forceoverwrite", "json", "loglevel", "targetusername", "wait"],
"alias": []
},
{
"command": "force:source:beta:push",
"plugin": "@salesforce/plugin-source",
"flags": ["apiversion", "forceoverwrite", "ignorewarnings", "json", "loglevel", "quiet", "targetusername", "wait"],
"alias": []
},
{
"command": "force:source:beta:status",
"plugin": "@salesforce/plugin-source",
"flags": ["apiversion", "concise", "json", "local", "loglevel", "remote", "targetusername"],
"alias": []
},
{
"command": "force:source:beta:tracking:clear",
"plugin": "@salesforce/plugin-source",
"flags": ["apiversion", "json", "loglevel", "noprompt", "targetusername"],
"alias": []
},
{
"command": "force:source:beta:tracking:reset",
"plugin": "@salesforce/plugin-source",
"flags": ["apiversion", "json", "loglevel", "noprompt", "revision", "targetusername"],
"alias": []
},
{
"command": "force:source:convert",
"plugin": "@salesforce/plugin-source",
Expand Down Expand Up @@ -168,15 +198,15 @@
"plugin": "@salesforce/plugin-source",
"flags": [
"apiversion",
"fromorg",
"includepackages",
"json",
"loglevel",
"manifestname",
"manifesttype",
"metadata",
"outputdir",
"sourcepath",
"includepackages",
"fromorg"
"sourcepath"
],
"alias": []
},
Expand All @@ -186,18 +216,6 @@
"flags": ["apiversion", "json", "loglevel", "sourcefile", "targetusername", "urlonly"],
"alias": []
},
{
"command": "force:source:pull",
"plugin": "@salesforce/plugin-source",
"flags": ["apiversion", "forceoverwrite", "json", "loglevel", "targetusername", "wait"],
"alias": ["force:source:beta:pull"]
},
{
"command": "force:source:push",
"plugin": "@salesforce/plugin-source",
"flags": ["apiversion", "forceoverwrite", "ignorewarnings", "json", "loglevel", "quiet", "targetusername", "wait"],
"alias": ["force:source:beta:push"]
},
{
"command": "force:source:retrieve",
"plugin": "@salesforce/plugin-source",
Expand All @@ -216,23 +234,5 @@
"wait"
],
"alias": []
},
{
"command": "force:source:status",
"plugin": "@salesforce/plugin-source",
"flags": ["apiversion", "concise", "json", "local", "loglevel", "remote", "targetusername"],
"alias": ["force:source:beta:status"]
},
{
"command": "force:source:tracking:clear",
"plugin": "@salesforce/plugin-source",
"flags": ["apiversion", "json", "loglevel", "noprompt", "targetusername"],
"alias": ["force:source:beta:tracking:clear"]
},
{
"command": "force:source:tracking:reset",
"plugin": "@salesforce/plugin-source",
"flags": ["apiversion", "json", "loglevel", "noprompt", "revision", "targetusername"],
"alias": ["force:source:beta:tracking:reset"]
}
]
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
"description": "Commands to interact with source formatted metadata",
"version": "1.8.17",
"author": "Salesforce",
"main": "lib/index.js",
"bugs": "https://github.com/forcedotcom/cli/issues",
"dependencies": {
"@oclif/config": "^1.18.2",
"@salesforce/command": "^4.2.2",
"@salesforce/core": "^2.35.0",
"@salesforce/source-deploy-retrieve": "^5.12.2",
"@salesforce/source-tracking": "^1.1.1",
"@salesforce/source-tracking": "^1.1.3",
"chalk": "^4.1.2",
"cli-ux": "^5.6.3",
"open": "^8.4.0",
Expand Down Expand Up @@ -108,8 +109,13 @@
"manifest": {
"description": "create a manifest to use in a deploy/retrieve"
},
"tracking": {
"description": "new versions of source tracking commands"
"beta": {
"description": "new versions of source tracking commands",
"subtopics": {
"tracking": {
"description": "new versions of source tracking commands"
}
}
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@ import {
RetrieveResult,
SourceComponent,
} from '@salesforce/source-deploy-retrieve';
import { ChangeResult, SourceTracking } from '@salesforce/source-tracking';
import { SourceCommand } from '../../../sourceCommand';
import { PullResponse, PullResultFormatter } from '../../../formatters/source/pullFormatter';
import { updateTracking, trackingSetup } from '../../../trackingFunctions';
import { ChangeResult, replaceRenamedCommands, SourceTracking } from '@salesforce/source-tracking';
import { SourceCommand } from '../../../../sourceCommand';
import { PullResponse, PullResultFormatter } from '../../../../formatters/source/pullFormatter';
import { trackingSetup, updateTracking } from '../../../../trackingFunctions';

Messages.importMessagesDirectory(__dirname);
const messages: Messages = Messages.loadMessages('@salesforce/plugin-source', 'pull');

export default class Pull extends SourceCommand {
public static description = messages.getMessage('description');
public static aliases = ['force:source:beta:pull'];
public static help = messages.getMessage('help');
protected static readonly flagsConfig: FlagsConfig = {
forceoverwrite: flags.boolean({
Expand Down Expand Up @@ -66,7 +65,7 @@ export default class Pull extends SourceCommand {
protected async preChecks(): Promise<void> {
this.ux.startSpinner('Loading source tracking information');
this.tracking = await trackingSetup({
commandName: 'force:source:pull',
commandName: replaceRenamedCommands('force:source:pull'),
ignoreConflicts: this.getFlag<boolean>('forceoverwrite', false),
org: this.org,
project: this.project,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,20 @@ import { flags, FlagsConfig } from '@salesforce/command';
import { Duration, env } from '@salesforce/kit';
import { Messages } from '@salesforce/core';
import { DeployResult, RequestStatus } from '@salesforce/source-deploy-retrieve';
import { SourceTracking } from '@salesforce/source-tracking';
import { replaceRenamedCommands, SourceTracking } from '@salesforce/source-tracking';
import { getBoolean } from '@salesforce/ts-types';
import { DeployCommand, getVersionMessage } from '../../../deployCommand';
import { PushResponse, PushResultFormatter } from '../../../formatters/source/pushResultFormatter';
import { ProgressFormatter } from '../../../formatters/progressFormatter';
import { DeployProgressBarFormatter } from '../../../formatters/deployProgressBarFormatter';
import { DeployProgressStatusFormatter } from '../../../formatters/deployProgressStatusFormatter';
import { updateTracking, trackingSetup } from '../../../trackingFunctions';
import { DeployCommand, getVersionMessage } from '../../../../deployCommand';
import { PushResponse, PushResultFormatter } from '../../../../formatters/source/pushResultFormatter';
import { ProgressFormatter } from '../../../../formatters/progressFormatter';
import { DeployProgressBarFormatter } from '../../../../formatters/deployProgressBarFormatter';
import { DeployProgressStatusFormatter } from '../../../../formatters/deployProgressStatusFormatter';
import { trackingSetup, updateTracking } from '../../../../trackingFunctions';

Messages.importMessagesDirectory(__dirname);
const messages: Messages = Messages.loadMessages('@salesforce/plugin-source', 'push');

export default class Push extends DeployCommand {
public static description = messages.getMessage('description');
public static aliases = ['force:source:beta:push'];
public static help = messages.getMessage('help');
protected static readonly flagsConfig: FlagsConfig = {
forceoverwrite: flags.boolean({
Expand Down Expand Up @@ -65,7 +64,7 @@ export default class Push extends DeployCommand {

protected async prechecks(): Promise<void> {
this.tracking = await trackingSetup({
commandName: 'force:source:push',
commandName: replaceRenamedCommands('force:source:push'),
ignoreConflicts: this.getFlag<boolean>('forceoverwrite', false),
org: this.org,
project: this.project,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@
import * as os from 'os';
import { flags, FlagsConfig, SfdxCommand } from '@salesforce/command';
import { Messages } from '@salesforce/core';
import { ChangeResult, StatusOutputRow } from '@salesforce/source-tracking';
import { StatusFormatter, StatusResult } from '../../../formatters/source/statusFormatter';
import { trackingSetup } from '../../../trackingFunctions';
import { ChangeResult, replaceRenamedCommands, StatusOutputRow, throwIfInvalid } from '@salesforce/source-tracking';
import { StatusFormatter, StatusResult } from '../../../../formatters/source/statusFormatter';
import { trackingSetup } from '../../../../trackingFunctions';

Messages.importMessagesDirectory(__dirname);
const messages: Messages = Messages.loadMessages('@salesforce/plugin-source', 'status');

export default class Status extends SfdxCommand {
public static description = messages.getMessage('description');
public static aliases = ['force:source:beta:status'];
public static readonly examples = messages.getMessage('examples').split(os.EOL);
protected static flagsConfig: FlagsConfig = {
local: flags.boolean({
Expand All @@ -42,6 +41,13 @@ export default class Status extends SfdxCommand {
protected localAdds: ChangeResult[] = [];

public async run(): Promise<StatusResult[]> {
throwIfInvalid({
org: this.org,
projectPath: this.project.getPath(),
toValidate: 'plugin-source',
command: replaceRenamedCommands('force:source:status'),
});

const wantsLocal = (this.flags.local as boolean) || (!this.flags.remote && !this.flags.local);
const wantsRemote = (this.flags.remote as boolean) || (!this.flags.remote && !this.flags.local);

Expand All @@ -52,7 +58,7 @@ export default class Status extends SfdxCommand {
.join(',')}`
);
const tracking = await trackingSetup({
commandName: 'force:source:status',
commandName: replaceRenamedCommands('force:source:status'),
ignoreConflicts: true,
org: this.org,
project: this.project,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { flags, FlagsConfig, SfdxCommand } from '@salesforce/command';
import { Messages } from '@salesforce/core';
import * as chalk from 'chalk';
import { SourceTracking, throwIfInvalid } from '@salesforce/source-tracking';
import { replaceRenamedCommands, SourceTracking, throwIfInvalid } from '@salesforce/source-tracking';

Messages.importMessagesDirectory(__dirname);
const messages: Messages = Messages.loadMessages('@salesforce/plugin-source', 'tracking');
Expand All @@ -18,8 +18,7 @@ export type SourceTrackingClearResult = {
};

export class Clear extends SfdxCommand {
public static readonly description = messages.getMessage('clearDescription');
public static aliases = ['force:source:beta:tracking:clear'];
public static readonly description = replaceRenamedCommands(messages.getMessage('clearDescription'));

public static readonly requiresProject = true;
public static readonly requiresUsername = true;
Expand All @@ -37,10 +36,13 @@ export class Clear extends SfdxCommand {
org: this.org,
projectPath: this.project.getPath(),
toValidate: 'plugin-source',
command: 'force:source:tracking:clear',
command: replaceRenamedCommands('force:source:tracking:clear'),
});
let clearedFiles: string[] = [];
if (this.flags.noprompt || (await this.ux.confirm(chalk.dim(messages.getMessage('promptMessage'))))) {
if (
this.flags.noprompt ||
(await this.ux.confirm(chalk.dim(replaceRenamedCommands(messages.getMessage('promptMessage')))))
) {
const sourceTracking = await SourceTracking.create({
project: this.project,
org: this.org,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { flags, FlagsConfig, SfdxCommand } from '@salesforce/command';
import { Messages } from '@salesforce/core';
import * as chalk from 'chalk';
import { SourceTracking, throwIfInvalid } from '@salesforce/source-tracking';
import { replaceRenamedCommands, SourceTracking, throwIfInvalid } from '@salesforce/source-tracking';

Messages.importMessagesDirectory(__dirname);
const messages: Messages = Messages.loadMessages('@salesforce/plugin-source', 'tracking');
Expand All @@ -19,8 +19,7 @@ export type SourceTrackingResetResult = {
};

export class Reset extends SfdxCommand {
public static readonly description = messages.getMessage('resetDescription');
public static aliases = ['force:source:beta:tracking:reset'];
public static readonly description = replaceRenamedCommands(messages.getMessage('resetDescription'));

public static readonly requiresProject = true;
public static readonly requiresUsername = true;
Expand All @@ -42,10 +41,13 @@ export class Reset extends SfdxCommand {
org: this.org,
projectPath: this.project.getPath(),
toValidate: 'plugin-source',
command: 'force:source:tracking:clear',
command: replaceRenamedCommands('force:source:tracking:clear'),
});

if (this.flags.noprompt || (await this.ux.confirm(chalk.dim(messages.getMessage('promptMessage'))))) {
if (
this.flags.noprompt ||
(await this.ux.confirm(chalk.dim(replaceRenamedCommands(messages.getMessage('promptMessage')))))
) {
const sourceTracking = await SourceTracking.create({
project: this.project,
org: this.org,
Expand Down
17 changes: 9 additions & 8 deletions src/trackingFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@
*/
import { UX } from '@salesforce/command';
import {
ChangeResult,
getTrackingFileVersion,
replaceRenamedCommands,
SourceTracking,
SourceTrackingOptions,
ChangeResult,
throwIfInvalid,
getTrackingFileVersion,
} from '@salesforce/source-tracking';
import { Messages, SfdxError } from '@salesforce/core';
import {
RetrieveResult,
DeployResult,
ComponentStatus,
ComponentSet,
ComponentStatus,
DeployResult,
FileResponse,
RetrieveResult,
} from '@salesforce/source-deploy-retrieve';

Messages.importMessagesDirectory(__dirname);
Expand Down Expand Up @@ -70,13 +71,13 @@ export const filterConflictsByComponentSet = async ({
export const trackingSetup = async (options: TrackingSetupRequest): Promise<SourceTracking> => {
const { ux, org, ignoreConflicts, commandName, ...createOptions } = options;
const projectPath = options.project.getPath();
// 3 commands use throwIfInvalid
// 2 commands use throwIfInvalid
if (commandName.endsWith('push') || commandName.endsWith('pull') || commandName.endsWith('status')) {
throwIfInvalid({
org,
projectPath,
toValidate: 'plugin-source',
command: commandName,
command: replaceRenamedCommands(commandName),
});
} else {
// confirm tracking file version is plugin-source for all --tracksource flags (deploy, retrieve, delete)
Expand All @@ -85,7 +86,7 @@ export const trackingSetup = async (options: TrackingSetupRequest): Promise<Sour
'You cannot use the "tracksource" flag with the old version of the tracking files',
'sourceTrackingFileVersionMismatch',
[
'Clear the old version of the tracking files with "sfdx force:source:legacy:tracking:clear"',
'Clear the old version of the tracking files with "sfdx force:source:tracking:clear"',
'Create a new org to use the new tracking files',
]
);
Expand Down
Loading

0 comments on commit 0efcaa1

Please sign in to comment.