Skip to content

Commit

Permalink
fix: deploy and retrieve from sfdx to sf (#5451)
Browse files Browse the repository at this point in the history
* fix: deploy and retrieve from sfdx to sf

* chore: update tests names

---------

Co-authored-by: Daphne Yang <[email protected]>
  • Loading branch information
CristiCanizales and daphne-sfdc authored Feb 23, 2024
1 parent fdaaf25 commit ed9348c
Show file tree
Hide file tree
Showing 38 changed files with 237 additions and 308 deletions.
74 changes: 37 additions & 37 deletions packages/salesforcedx-vscode-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,36 +188,36 @@
"group": "inline"
},
{
"command": "sfdx.force.source.retrieve.open.component",
"command": "sfdx.retrieve.open.component",
"when": "view == metadata && viewItem == component",
"group": "inline"
},
{
"command": "sfdx.force.source.retrieve.component",
"command": "sfdx.retrieve.component",
"when": "view == metadata && viewItem =~ /(type|component|folder)/",
"group": "inline"
},
{
"command": "sfdx.force.conflict.open",
"command": "sfdx.conflict.open",
"when": "view == conflicts && viewItem == conflict-actions",
"group": "inline"
}
],
"editor/context": [
{
"command": "sfdx.force.source.retrieve.current.source.file",
"command": "sfdx.retrieve.current.source.file",
"when": "sfdx:project_opened && resourceLangId != 'forcesourcemanifest' && sfdx:has_default_username"
},
{
"command": "sfdx.force.source.retrieve.in.manifest",
"command": "sfdx.retrieve.in.manifest",
"when": "sfdx:project_opened && resourceLangId == 'forcesourcemanifest' && sfdx:has_default_username"
},
{
"command": "sfdx.force.source.deploy.current.source.file",
"command": "sfdx.deploy.current.source.file",
"when": "sfdx:project_opened && resourceLangId != 'forcesourcemanifest' && sfdx:has_default_username"
},
{
"command": "sfdx.force.source.deploy.in.manifest",
"command": "sfdx.deploy.in.manifest",
"when": "sfdx:project_opened && resourceLangId == 'forcesourcemanifest' && sfdx:has_default_username"
},
{
Expand Down Expand Up @@ -307,19 +307,19 @@
"when": "!explorerResourceIsFolder && sfdx:project_opened && resourceLangId != 'forcesourcemanifest' && sfdx:has_default_username"
},
{
"command": "sfdx.force.source.retrieve.source.path",
"command": "sfdx.retrieve.source.path",
"when": "sfdx:project_opened && resourceLangId != 'forcesourcemanifest' && sfdx:has_default_username"
},
{
"command": "sfdx.force.source.retrieve.in.manifest",
"command": "sfdx.retrieve.in.manifest",
"when": "sfdx:project_opened && resourceLangId == 'forcesourcemanifest' && sfdx:has_default_username"
},
{
"command": "sfdx.force.source.deploy.source.path",
"command": "sfdx.deploy.source.path",
"when": "sfdx:project_opened && resourceLangId != 'forcesourcemanifest' && sfdx:has_default_username"
},
{
"command": "sfdx.force.source.deploy.in.manifest",
"command": "sfdx.deploy.in.manifest",
"when": "sfdx:project_opened && resourceLangId == 'forcesourcemanifest' && sfdx:has_default_username"
},
{
Expand Down Expand Up @@ -485,35 +485,35 @@
"when": "!sfdx:internal_dev"
},
{
"command": "sfdx.force.source.retrieve.component",
"command": "sfdx.retrieve.component",
"when": "false"
},
{
"command": "sfdx.force.source.retrieve.open.component",
"command": "sfdx.retrieve.open.component",
"when": "false"
},
{
"command": "sfdx.force.source.retrieve.source.path",
"command": "sfdx.retrieve.source.path",
"when": "false"
},
{
"command": "sfdx.force.source.deploy.source.path",
"command": "sfdx.deploy.source.path",
"when": "false"
},
{
"command": "sfdx.force.source.retrieve.current.source.file",
"command": "sfdx.retrieve.current.source.file",
"when": "sfdx:project_opened && resourceLangId != 'forcesourcemanifest' && editorIsOpen && sfdx:has_default_username"
},
{
"command": "sfdx.force.source.retrieve.in.manifest",
"command": "sfdx.retrieve.in.manifest",
"when": "sfdx:project_opened && resourceLangId == 'forcesourcemanifest' && sfdx:has_default_username"
},
{
"command": "sfdx.force.source.deploy.current.source.file",
"command": "sfdx.deploy.current.source.file",
"when": "sfdx:project_opened && resourceLangId != 'forcesourcemanifest' && editorIsOpen && sfdx:has_default_username"
},
{
"command": "sfdx.force.source.deploy.in.manifest",
"command": "sfdx.deploy.in.manifest",
"when": "sfdx:project_opened && resourceLangId == 'forcesourcemanifest' && sfdx:has_default_username"
},
{
Expand Down Expand Up @@ -593,7 +593,7 @@
"when": "false"
},
{
"command": "sfdx.force.conflict.open",
"command": "sfdx.conflict.open",
"when": "false"
},
{
Expand Down Expand Up @@ -800,28 +800,28 @@
"title": "%isv_bootstrap_command_text%"
},
{
"command": "sfdx.force.source.retrieve.source.path",
"title": "%force_source_retrieve_text%"
"command": "sfdx.retrieve.source.path",
"title": "%retrieve_text%"
},
{
"command": "sfdx.force.source.retrieve.current.source.file",
"title": "%force_source_retrieve_this_source_text%"
"command": "sfdx.retrieve.current.source.file",
"title": "%retrieve_this_source_text%"
},
{
"command": "sfdx.force.source.retrieve.in.manifest",
"title": "%force_source_retrieve_in_manifest_text%"
"command": "sfdx.retrieve.in.manifest",
"title": "%retrieve_in_manifest_text%"
},
{
"command": "sfdx.force.source.deploy.source.path",
"title": "%force_source_deploy_text%"
"command": "sfdx.deploy.source.path",
"title": "%deploy_text%"
},
{
"command": "sfdx.force.source.deploy.current.source.file",
"title": "%force_source_deploy_this_source_text%"
"command": "sfdx.deploy.current.source.file",
"title": "%deploy_this_source_text%"
},
{
"command": "sfdx.force.source.deploy.in.manifest",
"title": "%force_source_deploy_in_manifest_text%"
"command": "sfdx.deploy.in.manifest",
"title": "%deploy_in_manifest_text%"
},
{
"command": "sfdx.delete.source",
Expand Down Expand Up @@ -864,16 +864,16 @@
}
},
{
"command": "sfdx.force.source.retrieve.component",
"title": "%force_source_retrieve_display_text%",
"command": "sfdx.retrieve.component",
"title": "%retrieve_display_text%",
"icon": {
"light": "resources/light/retrieve.svg",
"dark": "resources/dark/retrieve.svg"
}
},
{
"command": "sfdx.force.source.retrieve.open.component",
"title": "%force_source_retrieve_and_open_display_text%",
"command": "sfdx.retrieve.open.component",
"title": "%retrieve_and_open_display_text%",
"icon": {
"light": "resources/light/code.svg",
"dark": "resources/dark/code.svg"
Expand All @@ -892,7 +892,7 @@
"title": "%diff_folder_against_org%"
},
{
"command": "sfdx.force.conflict.open",
"command": "sfdx.conflict.open",
"title": "%conflict_detect_open_file%",
"icon": {
"light": "resources/light/go-to-file.svg",
Expand Down
16 changes: 8 additions & 8 deletions packages/salesforcedx-vscode-core/package.nls.ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
"force_manifest_editor_show_text": "SFDX: パッケージマニフェストエディタを表示",
"package_install_text": "SFDX: パッケージをインストール",
"sobjects_refresh": "SFDX: SObject 定義を更新",
"force_source_deploy_in_manifest_text": "SFDX: マニフェストファイルのソースを組織へデプロイ",
"force_source_deploy_text": "SFDX: 組織へソースをデプロイ",
"force_source_deploy_this_source_text": "SFDX: このソースを組織へデプロイ",
"force_source_retrieve_and_open_display_text": "ソースを取得して開く",
"force_source_retrieve_display_text": "組織からソースを取得",
"force_source_retrieve_in_manifest_text": "SFDX: マニフェストファイルのソースを組織から取得",
"force_source_retrieve_text": "SFDX: 組織からソースを取得",
"force_source_retrieve_this_source_text": "SFDX: このソースを組織から取得",
"deploy_in_manifest_text": "SFDX: マニフェストファイルのソースを組織へデプロイ",
"deploy_text": "SFDX: 組織へソースをデプロイ",
"deploy_this_source_text": "SFDX: このソースを組織へデプロイ",
"retrieve_and_open_display_text": "ソースを取得して開く",
"retrieve_display_text": "組織からソースを取得",
"retrieve_in_manifest_text": "SFDX: マニフェストファイルのソースを組織から取得",
"retrieve_text": "SFDX: 組織からソースを取得",
"retrieve_this_source_text": "SFDX: このソースを組織から取得",
"view_local_changes_text": "SFDX: ローカルの変更を表示",
"view_remote_changes_text": "SFDX: デフォルトのスクラッチ組織内の変更を表示",
"view_all_changes_text": "SFDX: すべての変更を表示 (ローカルとデフォルトのスクラッチ組織内)",
Expand Down
16 changes: 8 additions & 8 deletions packages/salesforcedx-vscode-core/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
"enable_source_tracking_for_deploy_and_retrieve": "Specifies whether source-tracking is enabled for deploy or retrieve operations in a source-tracked org. Disable source-tracking if you are experiencing performance issues using deploy or retrieve commands on your source-tracked orgs.",
"force_lightning_lwc_test_create_text": "SFDX: Create Lightning Web Component Test",
"force_manifest_editor_show_text": "SFDX: Show Package Manifest Editor",
"force_source_deploy_in_manifest_text": "SFDX: Deploy Source in Manifest to Org",
"force_source_deploy_text": "SFDX: Deploy Source to Org",
"force_source_deploy_this_source_text": "SFDX: Deploy This Source to Org",
"force_source_retrieve_and_open_display_text": "Retrieve and Open Source",
"force_source_retrieve_display_text": "Retrieve Source from Org",
"force_source_retrieve_in_manifest_text": "SFDX: Retrieve Source in Manifest from Org",
"force_source_retrieve_text": "SFDX: Retrieve Source from Org",
"force_source_retrieve_this_source_text": "SFDX: Retrieve This Source from Org",
"deploy_in_manifest_text": "SFDX: Deploy Source in Manifest to Org",
"deploy_text": "SFDX: Deploy Source to Org",
"deploy_this_source_text": "SFDX: Deploy This Source to Org",
"retrieve_and_open_display_text": "Retrieve and Open Source",
"retrieve_display_text": "Retrieve Source from Org",
"retrieve_in_manifest_text": "SFDX: Retrieve Source in Manifest from Org",
"retrieve_text": "SFDX: Retrieve Source from Org",
"retrieve_this_source_text": "SFDX: Retrieve This Source from Org",
"ignore_conflicts_on_push_description": "Specifies whether to always use --ignore-conflicts when you run project:deploy:start on save",
"isv_bootstrap_command_text": "SFDX: Create and Set Up Project for ISV Debugging",
"launch_apex_replay_debugger_with_current_file": "SFDX: Launch Apex Replay Debugger with Current File",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,11 @@ import { SfdxPackageDirectories } from '../sfdxProject';
import { telemetryService } from '../telemetry';
import { workspaceUtils } from '../util';
import { DeployExecutor } from './baseDeployRetrieve';
import {
FilePathGatherer,
SfdxCommandlet,
SfdxWorkspaceChecker
} from './util';
import { FilePathGatherer, SfdxCommandlet, SfdxWorkspaceChecker } from './util';

export class LibrarySourceDeployManifestExecutor extends DeployExecutor<
string
> {
export class LibraryDeployManifestExecutor extends DeployExecutor<string> {
constructor() {
super(
nls.localize('force_source_deploy_text'),
'force_source_deploy_with_manifest_beta'
);
super(nls.localize('deploy_text'), 'deploy_with_manifest_beta');
}

protected async getComponents(
Expand All @@ -51,33 +42,28 @@ export class LibrarySourceDeployManifestExecutor extends DeployExecutor<
}
}

export async function forceSourceDeployManifest(manifestUri: vscode.Uri) {
export async function deployManifest(manifestUri: vscode.Uri) {
if (!manifestUri) {
const editor = vscode.window.activeTextEditor;
if (editor && editor.document.languageId === 'forcesourcemanifest') {
manifestUri = editor.document.uri;
} else {
const errorMessage = nls.localize('force_source_deploy_select_manifest');
telemetryService.sendException(
'force_source_deploy_with_manifest',
errorMessage
);
const errorMessage = nls.localize('deploy_select_manifest');
telemetryService.sendException('deploy_with_manifest', errorMessage);
notificationService.showErrorMessage(errorMessage);
channelService.appendLine(errorMessage);
channelService.showChannelOutput();
return;
}
}

const messages = getConflictMessagesFor(
'force_source_deploy_with_manifest_beta'
);
const messages = getConflictMessagesFor('deploy_with_manifest_beta');

if (messages) {
const commandlet = new SfdxCommandlet(
new SfdxWorkspaceChecker(),
new FilePathGatherer(manifestUri),
new LibrarySourceDeployManifestExecutor(),
new LibraryDeployManifestExecutor(),
new TimestampConflictChecker(true, messages)
);
await commandlet.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { nls } from '../messages';
import { notificationService } from '../notifications';
import { telemetryService } from '../telemetry';
import { DeployExecutor } from './baseDeployRetrieve';
import { SourcePathChecker } from './forceSourceRetrieveSourcePath';
import { SourcePathChecker } from './retrieveSourcePath';
import {
LibraryPathsGatherer,
SfdxCommandlet,
Expand All @@ -24,10 +24,7 @@ import { TimestampConflictChecker } from './util/timestampConflictChecker';

export class LibraryDeploySourcePathExecutor extends DeployExecutor<string[]> {
constructor() {
super(
nls.localize('force_source_deploy_text'),
'force_source_deploy_with_sourcepath_beta'
);
super(nls.localize('deploy_text'), 'deploy_with_sourcepath_beta');
}

public async getComponents(
Expand All @@ -41,7 +38,7 @@ export class LibraryDeploySourcePathExecutor extends DeployExecutor<string[]> {
}
}

export const forceSourceDeploySourcePaths = async (
export const deploySourcePaths = async (
sourceUri: vscode.Uri | vscode.Uri[] | undefined,
uris: vscode.Uri[] | undefined
) => {
Expand Down Expand Up @@ -74,9 +71,7 @@ export const forceSourceDeploySourcePaths = async (
}
}

const messages = getConflictMessagesFor(
'force_source_deploy_with_sourcepath_beta'
);
const messages = getConflictMessagesFor('deploy_with_sourcepath_beta');

if (messages) {
const commandlet = new SfdxCommandlet<string[]>(
Expand All @@ -99,13 +94,8 @@ export const getUriFromActiveEditor = (): vscode.Uri | undefined => {
return editor.document.uri;
}

const errorMessage = nls.localize(
'force_source_deploy_select_file_or_directory'
);
telemetryService.sendException(
'force_source_deploy_with_sourcepath',
errorMessage
);
const errorMessage = nls.localize('deploy_select_file_or_directory');
telemetryService.sendException('deploy_with_sourcepath', errorMessage);
notificationService.showErrorMessage(errorMessage);
channelService.appendLine(errorMessage);
channelService.showChannelOutput();
Expand Down
14 changes: 7 additions & 7 deletions packages/salesforcedx-vscode-core/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,19 @@ export {
initSObjectDefinitions
} from './refreshSObjects';
export { renameLightningComponent } from './renameLightningComponent';
export { forceSourceDeployManifest } from './forceSourceDeployManifest';
export { deployManifest } from './deployManifest';
export {
LibraryDeploySourcePathExecutor,
forceSourceDeploySourcePaths
} from './forceSourceDeploySourcePath';
deploySourcePaths
} from './deploySourcePath';
export { sourceDiff, sourceFolderDiff, handleCacheResults } from './sourceDiff';
export { forceSourceRetrieveManifest } from './forceSourceRetrieveManifest';
export { forceSourceRetrieveCmp } from './forceSourceRetrieveMetadata';
export { retrieveManifest } from './retrieveManifest';
export { retrieveComponent } from './retrieveMetadata';
export {
LibraryRetrieveSourcePathExecutor,
SourcePathChecker,
forceSourceRetrieveSourcePaths
} from './forceSourceRetrieveSourcePath';
retrieveSourcePaths
} from './retrieveSourcePath';
export { openDocumentation } from './openDocumentation';
export { AliasGatherer, OrgCreateExecutor, orgCreate } from './orgCreate';
export { orgDelete } from './orgDelete';
Expand Down
Loading

0 comments on commit ed9348c

Please sign in to comment.