Skip to content
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
4 changes: 2 additions & 2 deletions src/commands/ui-bundle/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type { UiBundleManifest } from '../../config/manifest.js';
import { ManifestWatcher } from '../../config/ManifestWatcher.js';
import { DevServerManager } from '../../server/DevServerManager.js';
import { ProxyServer } from '../../proxy/ProxyServer.js';
import { discoverUiBundle, DEFAULT_DEV_COMMAND, type DiscoveredUiBundle } from '../../config/webappDiscovery.js';
import { discoverUiBundle, DEFAULT_DEV_COMMAND, type DiscoveredUiBundle } from '../../config/uiBundleDiscovery.js';

Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('@salesforce/plugin-ui-bundle-dev', 'ui-bundle.dev');
Expand Down Expand Up @@ -160,7 +160,7 @@ export default class UiBundleDev extends SfCommand<UiBundleDevResult> {
method: 'GET',
signal: AbortSignal.timeout(3000), // 3 second timeout
});
return response.headers.get('X-Salesforce-UiBundle-Proxy') === 'true';
return response.headers.get('X-Salesforce-UIBundle-Proxy') === 'true';
} catch {
// Health check failed - Vite proxy not active
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ export const DEFAULT_DEV_COMMAND = 'npm run dev';
* Standard metadata path segment for uiBundles (relative to package directory).
* Consistent with other metadata types: packagePath/main/default/uiBundles
*/
const WEBAPPLICATIONS_RELATIVE_PATH = 'main/default/uiBundles';
const UI_BUNDLES_RELATIVE_PATH = 'main/default/uiBundles';

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

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

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

const existenceChecks = await Promise.all(
packageDirs.map(async (pkg) => {
const uiBundlesPath = join(projectRoot, pkg.path, WEBAPPLICATIONS_RELATIVE_PATH);
const uiBundlesPath = join(projectRoot, pkg.path, UI_BUNDLES_RELATIVE_PATH);
return (await pathExists(uiBundlesPath)) ? uiBundlesPath : null;
})
);
Expand Down Expand Up @@ -444,7 +444,7 @@ export type DiscoverUiBundleResult = {
*
* Discovery use cases:
* 1. SFDX Project Root: Search uiBundles in all package directories
* - Webapps identified by {name}.uibundle-meta.xml
* - uiBundles identified by {name}.uibundle-meta.xml
* - Always prompt for selection (even if only 1 uiBundle)
*
* 2. Inside uiBundles/<uiBundle> directory:
Expand Down
2 changes: 1 addition & 1 deletion test/commands/ui-bundle/dev.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
ensureSfCli,
authOrgViaUrl,
REAL_HOME,
} from './helpers/webappProjectUtils.js';
} from './helpers/uiBundleProjectUtils.js';

/* ------------------------------------------------------------------ *
* Tier 1 — No Auth *
Expand Down
2 changes: 1 addition & 1 deletion test/commands/ui-bundle/devPort.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import type { Server } from 'node:net';
import { TestSession } from '@salesforce/cli-plugins-testkit';
import { expect } from 'chai';
import { createProjectWithDevServer, ensureSfCli, authOrgViaUrl } from './helpers/webappProjectUtils.js';
import { createProjectWithDevServer, ensureSfCli, authOrgViaUrl } from './helpers/uiBundleProjectUtils.js';
import {
occupyPort,
spawnUiBundleDev,
Expand Down
2 changes: 1 addition & 1 deletion test/commands/ui-bundle/devWithUrl.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
writeManifest,
ensureSfCli,
authOrgViaUrl,
} from './helpers/webappProjectUtils.js';
} from './helpers/uiBundleProjectUtils.js';
import {
spawnUiBundleDev,
startTestHttpServer,
Expand Down
6 changes: 3 additions & 3 deletions test/commands/ui-bundle/helpers/devServerUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { createServer, type Server } from 'node:net';
* parallelism is enabled later, overlapping ranges would cause EADDRINUSE.
*/

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

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

/**
* Start an HTTP server that mimics a Vite dev server with the
* WebAppProxyHandler plugin active. Responds to health check requests
* (`?sfProxyHealthCheck=true`) with `X-Salesforce-UiBundle-Proxy: true`.
* UIBundleProxyHandler plugin active. Responds to health check requests
* (`?sfProxyHealthCheck=true`) with `X-Salesforce-UIBundle-Proxy: true`.
*/
export function startViteProxyServer(port: number): Promise<HttpServer> {
return new Promise((resolve, reject) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { mkdirSync, rmSync, writeFileSync } from 'node:fs';
import { homedir, tmpdir } from 'node:os';
import { join } from 'node:path';
import type { TestSession } from '@salesforce/cli-plugins-testkit';
import { UI_BUNDLES_FOLDER } from '../../../../src/config/webappDiscovery.js';
import { UI_BUNDLES_FOLDER } from '../../../../src/config/uiBundleDiscovery.js';

/**
* Real home directory captured at module load, before TestSession overrides process.env.HOME.
Expand Down Expand Up @@ -118,10 +118,10 @@ export function createProjectWithUiBundle(session: TestSession, projectName: str
export function createProjectWithMultipleUiBundles(
session: TestSession,
projectName: string,
webAppNames: string[]
uiBundleNames: string[]
): string {
const projectDir = createProject(session, projectName);
for (const name of webAppNames) {
for (const name of uiBundleNames) {
execSync(`sf ui-bundle generate --name ${name}`, {
cwd: projectDir,
stdio: 'pipe',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import { mkdirSync, rmSync, writeFileSync } from 'node:fs';
import { join } from 'node:path';
import { expect } from 'chai';
import { SfError, SfProject } from '@salesforce/core';
import { DEFAULT_DEV_COMMAND, discoverUiBundle, UI_BUNDLES_FOLDER } from '../../src/config/webappDiscovery.js';
import { DEFAULT_DEV_COMMAND, discoverUiBundle, UI_BUNDLES_FOLDER } from '../../src/config/uiBundleDiscovery.js';

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

// Standard SFDX uiBundles path
Expand Down
Loading