Skip to content

Commit bbf3f89

Browse files
committed
feat: add Code Sync feature to VS Code extension with cartridge management
Add file watcher with automatic upload, deploy command, cartridge tree view, and code version management to the VS Code extension. Extract reusable uploadFiles and downloadSingleCartridge functions in the SDK for efficient per-file and per-cartridge operations. SDK changes: - Extract batch upload pipeline into uploadFiles() from watchCartridges() - Add downloadSingleCartridge() for per-cartridge download (ZIPs only the target cartridge instead of entire code version) - downloadCartridges() now uses per-cartridge download when include filter set - Add autoUpload config field (dw.json: "autoUpload" / "auto-upload") VS Code extension: - CodeSyncManager: file watcher using VS Code FileSystemWatcher with debounced batch upload, status bar toggle, per-instance state persistence - Deploy command with cartridge selection and activate/reload options - Cartridge tree view with discovered cartridges and context menu actions: upload, download from instance, add/remove site cartridge path - Code version management: list, create, activate, reload, delete - Auto-start based on workspaceState or dw.json autoUpload setting - Auto-detect new cartridges via .project file watcher - Move API Browser to separate SCAPI sidebar
1 parent 70ccffb commit bbf3f89

18 files changed

Lines changed: 1940 additions & 224 deletions

File tree

.changeset/code-upload-sdk.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@salesforce/b2c-tooling-sdk': minor
3+
---
4+
5+
Add `uploadFiles` and `downloadSingleCartridge` functions for efficient per-file and per-cartridge operations. Extract batch upload pipeline from `watchCartridges` into reusable `uploadFiles` function. `downloadCartridges` now downloads individual cartridges when `include` filter is specified instead of zipping the entire code version. Add `autoUpload` config field for IDE auto-sync.

.changeset/code-upload-vscode.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'b2c-vs-extension': minor
3+
---
4+
5+
Add Code Sync feature: file watcher with automatic upload to instance, deploy command, cartridge tree view with download/upload/site path management, and code version management. Includes status bar toggle, per-instance state persistence, and `autoUpload` dw.json support. Move API Browser to separate SCAPI sidebar.

packages/b2c-tooling-sdk/src/config/dw-json.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ export interface DwJsonConfig {
7575
sandboxApiHost?: string;
7676
/** Default ODS realm for sandbox operations */
7777
realm?: string;
78+
/** Whether to auto-start code upload/sync in IDE extensions */
79+
autoUpload?: boolean;
7880
/** Cartridge names to include in deploy/watch (string with colon/comma separators, or array) */
7981
cartridges?: string | string[];
8082
/** Default content library ID for content export/list commands */

packages/b2c-tooling-sdk/src/config/mapping.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ export function mapDwJsonToNormalizedConfig(json: DwJsonConfig): NormalizedConfi
156156
tenantId: json.tenantId,
157157
sandboxApiHost: json.sandboxApiHost,
158158
realm: json.realm,
159+
autoUpload: json.autoUpload,
159160
cartridges: parseCartridges(json.cartridges),
160161
contentLibrary: json.contentLibrary,
161162
catalogs: json.catalogs,
@@ -274,6 +275,9 @@ export function mapNormalizedConfigToDwJson(config: Partial<NormalizedConfig>, n
274275
if (config.accountManagerHost !== undefined) {
275276
result.accountManagerHost = config.accountManagerHost;
276277
}
278+
if (config.autoUpload !== undefined) {
279+
result.autoUpload = config.autoUpload;
280+
}
277281
if (config.cartridges !== undefined) {
278282
result.cartridges = config.cartridges;
279283
}
@@ -420,6 +424,7 @@ export function mergeConfigsWithProtection(
420424
accountManagerHost: overrides.accountManagerHost ?? base.accountManagerHost,
421425
shortCode: overrides.shortCode ?? base.shortCode,
422426
tenantId: overrides.tenantId ?? base.tenantId,
427+
autoUpload: overrides.autoUpload ?? base.autoUpload,
423428
cartridges: overrides.cartridges ?? base.cartridges,
424429
contentLibrary: overrides.contentLibrary ?? base.contentLibrary,
425430
catalogs: overrides.catalogs ?? base.catalogs,

packages/b2c-tooling-sdk/src/config/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ export interface NormalizedConfig {
8989
/** MRT API origin URL override */
9090
mrtOrigin?: string;
9191

92+
// Code upload
93+
/** Whether to auto-start code upload/sync in IDE extensions */
94+
autoUpload?: boolean;
95+
9296
// Cartridges
9397
/** Cartridge names to include in deploy/watch operations */
9498
cartridges?: string[];

0 commit comments

Comments
 (0)