Skip to content

Commit 8ec4ddd

Browse files
refactor: rename webapp references to uiBundle across src and test files (#46)
- Rename webappDiscovery.ts -> uiBundleDiscovery.ts - Rename webappProjectUtils.ts -> uiBundleProjectUtils.ts - Rename webappDiscovery.test.ts -> uiBundleDiscovery.test.ts - Update all import paths to reference renamed files - Rename WEBAPPLICATIONS_RELATIVE_PATH -> UI_BUNDLES_RELATIVE_PATH - Rename WEBAPP_META_XML_PATTERN -> UIBUNDLE_META_XML_PATTERN - Rename param webAppNames -> uiBundleNames in createProjectWithMultipleUiBundles - Fix proxy health check header: X-Salesforce-UiBundle-Proxy -> X-Salesforce-UIBundle-Proxy - Update stale comments referencing WebAppProxyHandler and webapp terminology @W21818614 Made-with: Cursor
1 parent ed7adde commit 8ec4ddd

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

src/commands/ui-bundle/dev.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import type { UiBundleManifest } from '../../config/manifest.js';
2323
import { ManifestWatcher } from '../../config/ManifestWatcher.js';
2424
import { DevServerManager } from '../../server/DevServerManager.js';
2525
import { ProxyServer } from '../../proxy/ProxyServer.js';
26-
import { discoverUiBundle, DEFAULT_DEV_COMMAND, type DiscoveredUiBundle } from '../../config/webappDiscovery.js';
26+
import { discoverUiBundle, DEFAULT_DEV_COMMAND, type DiscoveredUiBundle } from '../../config/uiBundleDiscovery.js';
2727

2828
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
2929
const messages = Messages.loadMessages('@salesforce/plugin-ui-bundle-dev', 'ui-bundle.dev');
@@ -160,7 +160,7 @@ export default class UiBundleDev extends SfCommand<UiBundleDevResult> {
160160
method: 'GET',
161161
signal: AbortSignal.timeout(3000), // 3 second timeout
162162
});
163-
return response.headers.get('X-Salesforce-UiBundle-Proxy') === 'true';
163+
return response.headers.get('X-Salesforce-UIBundle-Proxy') === 'true';
164164
} catch {
165165
// Health check failed - Vite proxy not active
166166
return false;
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ export const DEFAULT_DEV_COMMAND = 'npm run dev';
3030
* Standard metadata path segment for uiBundles (relative to package directory).
3131
* Consistent with other metadata types: packagePath/main/default/uiBundles
3232
*/
33-
const WEBAPPLICATIONS_RELATIVE_PATH = 'main/default/uiBundles';
33+
const UI_BUNDLES_RELATIVE_PATH = 'main/default/uiBundles';
3434

3535
/**
3636
* Pattern to match uibundle metadata XML files
3737
*/
38-
const WEBAPP_META_XML_PATTERN = /^(.+)\.uibundle-meta\.xml$/;
38+
const UIBUNDLE_META_XML_PATTERN = /^(.+)\.uibundle-meta\.xml$/;
3939

4040
/**
4141
* Discovered uiBundle with its directory path and optional manifest
@@ -47,7 +47,7 @@ export type DiscoveredUiBundle = {
4747
relativePath: string;
4848
/** Parsed manifest content (null if no ui-bundle.json found) */
4949
manifest: UiBundleManifest | null;
50-
/** Webapp name (from .uibundle-meta.xml or folder name) */
50+
/** uiBundle name (from .uibundle-meta.xml or folder name) */
5151
name: string;
5252
/** Whether this uiBundle has a ui-bundle.json manifest file */
5353
hasManifest: boolean;
@@ -91,7 +91,7 @@ async function findUiBundleMetaXml(dirPath: string): Promise<string | null> {
9191
const matches: string[] = [];
9292

9393
for (const entry of entries) {
94-
const match = WEBAPP_META_XML_PATTERN.exec(entry);
94+
const match = UIBUNDLE_META_XML_PATTERN.exec(entry);
9595
if (match) {
9696
matches.push(match[1]);
9797
}
@@ -187,7 +187,7 @@ async function getUiBundlesPathsFromProject(projectRoot: string): Promise<string
187187

188188
const existenceChecks = await Promise.all(
189189
packageDirs.map(async (pkg) => {
190-
const uiBundlesPath = join(projectRoot, pkg.path, WEBAPPLICATIONS_RELATIVE_PATH);
190+
const uiBundlesPath = join(projectRoot, pkg.path, UI_BUNDLES_RELATIVE_PATH);
191191
return (await pathExists(uiBundlesPath)) ? uiBundlesPath : null;
192192
})
193193
);
@@ -444,7 +444,7 @@ export type DiscoverUiBundleResult = {
444444
*
445445
* Discovery use cases:
446446
* 1. SFDX Project Root: Search uiBundles in all package directories
447-
* - Webapps identified by {name}.uibundle-meta.xml
447+
* - uiBundles identified by {name}.uibundle-meta.xml
448448
* - Always prompt for selection (even if only 1 uiBundle)
449449
*
450450
* 2. Inside uiBundles/<uiBundle> directory:

test/commands/ui-bundle/dev.nut.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
ensureSfCli,
3131
authOrgViaUrl,
3232
REAL_HOME,
33-
} from './helpers/webappProjectUtils.js';
33+
} from './helpers/uiBundleProjectUtils.js';
3434

3535
/* ------------------------------------------------------------------ *
3636
* Tier 1 — No Auth *

test/commands/ui-bundle/devPort.nut.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import type { Server } from 'node:net';
1818
import { TestSession } from '@salesforce/cli-plugins-testkit';
1919
import { expect } from 'chai';
20-
import { createProjectWithDevServer, ensureSfCli, authOrgViaUrl } from './helpers/webappProjectUtils.js';
20+
import { createProjectWithDevServer, ensureSfCli, authOrgViaUrl } from './helpers/uiBundleProjectUtils.js';
2121
import {
2222
occupyPort,
2323
spawnUiBundleDev,

test/commands/ui-bundle/devWithUrl.nut.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
writeManifest,
2424
ensureSfCli,
2525
authOrgViaUrl,
26-
} from './helpers/webappProjectUtils.js';
26+
} from './helpers/uiBundleProjectUtils.js';
2727
import {
2828
spawnUiBundleDev,
2929
startTestHttpServer,

test/commands/ui-bundle/helpers/devServerUtils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { createServer, type Server } from 'node:net';
2929
* parallelism is enabled later, overlapping ranges would cause EADDRINUSE.
3030
*/
3131

32-
/** Mocha suite-level timeout for describe blocks that spawn webapp dev. */
32+
/** Mocha suite-level timeout for describe blocks that spawn ui-bundle dev. */
3333
export const SUITE_TIMEOUT = 180_000;
3434

3535
/** Timeout for spawnUiBundleDev when the command is expected to start successfully. */
@@ -178,8 +178,8 @@ export function startTestHttpServer(port: number): Promise<HttpServer> {
178178

179179
/**
180180
* Start an HTTP server that mimics a Vite dev server with the
181-
* WebAppProxyHandler plugin active. Responds to health check requests
182-
* (`?sfProxyHealthCheck=true`) with `X-Salesforce-UiBundle-Proxy: true`.
181+
* UIBundleProxyHandler plugin active. Responds to health check requests
182+
* (`?sfProxyHealthCheck=true`) with `X-Salesforce-UIBundle-Proxy: true`.
183183
*/
184184
export function startViteProxyServer(port: number): Promise<HttpServer> {
185185
return new Promise((resolve, reject) => {

test/commands/ui-bundle/helpers/webappProjectUtils.ts renamed to test/commands/ui-bundle/helpers/uiBundleProjectUtils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { mkdirSync, rmSync, writeFileSync } from 'node:fs';
1919
import { homedir, tmpdir } from 'node:os';
2020
import { join } from 'node:path';
2121
import type { TestSession } from '@salesforce/cli-plugins-testkit';
22-
import { UI_BUNDLES_FOLDER } from '../../../../src/config/webappDiscovery.js';
22+
import { UI_BUNDLES_FOLDER } from '../../../../src/config/uiBundleDiscovery.js';
2323

2424
/**
2525
* Real home directory captured at module load, before TestSession overrides process.env.HOME.
@@ -118,10 +118,10 @@ export function createProjectWithUiBundle(session: TestSession, projectName: str
118118
export function createProjectWithMultipleUiBundles(
119119
session: TestSession,
120120
projectName: string,
121-
webAppNames: string[]
121+
uiBundleNames: string[]
122122
): string {
123123
const projectDir = createProject(session, projectName);
124-
for (const name of webAppNames) {
124+
for (const name of uiBundleNames) {
125125
execSync(`sf ui-bundle generate --name ${name}`, {
126126
cwd: projectDir,
127127
stdio: 'pipe',
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ import { mkdirSync, rmSync, writeFileSync } from 'node:fs';
1818
import { join } from 'node:path';
1919
import { expect } from 'chai';
2020
import { SfError, SfProject } from '@salesforce/core';
21-
import { DEFAULT_DEV_COMMAND, discoverUiBundle, UI_BUNDLES_FOLDER } from '../../src/config/webappDiscovery.js';
21+
import { DEFAULT_DEV_COMMAND, discoverUiBundle, UI_BUNDLES_FOLDER } from '../../src/config/uiBundleDiscovery.js';
2222

23-
describe('webappDiscovery', () => {
23+
describe('uiBundleDiscovery', () => {
2424
const testDir = join(process.cwd(), '.test-uiBundle-discovery');
2525

2626
// Standard SFDX uiBundles path

0 commit comments

Comments
 (0)