Skip to content

Commit 82ff4f4

Browse files
committed
refactor: rename webapplication.json and meta XML references to uibundle
Rename all occurrences of webapplication.json to uibundle.json and .webapplication-meta.xml to .uibundle-meta.xml in source code, error messages, comments, and tests to align with the ui-bundle naming.
1 parent 21b892a commit 82ff4f4

File tree

7 files changed

+70
-70
lines changed

7 files changed

+70
-70
lines changed

src/commands/ui-bundle/dev.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export default class UiBundleDev extends SfCommand<WebAppDevResult> {
133133
intervalMs = 500,
134134
start = Date.now()
135135
): Promise<boolean> {
136-
if (await UiBundleDev.isUrlReachable(url)) {
136+
if (await UiBundleDev.isUrlReachable(url)) {
137137
return true;
138138
}
139139
if (Date.now() - start >= timeoutMs) {
@@ -182,7 +182,7 @@ export default class UiBundleDev extends SfCommand<WebAppDevResult> {
182182

183183
try {
184184
// Step 1: Discover and select webapp
185-
this.logger.debug('Discovering webapplication.json manifest(s)...');
185+
this.logger.debug('Discovering uibundle.json manifest(s)...');
186186

187187
const { webapp: discoveredWebapp, allWebapps, autoSelected } = await discoverWebapp(flags.name);
188188

@@ -277,7 +277,7 @@ export default class UiBundleDev extends SfCommand<WebAppDevResult> {
277277
const resolvedUrl = flags.url ?? manifest?.dev?.url ?? (hasDevCommand ? 'http://localhost:5173' : null);
278278
if (!resolvedUrl) {
279279
throw new SfError(
280-
'❌ Unable to determine dev server URL. Specify --url or configure dev.url or dev.command in webapplication.json.',
280+
'❌ Unable to determine dev server URL. Specify --url or configure dev.url or dev.command in uibundle.json.',
281281
'DevServerUrlError'
282282
);
283283
}
@@ -303,7 +303,7 @@ export default class UiBundleDev extends SfCommand<WebAppDevResult> {
303303
// dev.url in manifest but no dev.command - don't start (we can't control the port)
304304
throw new SfError(messages.getMessage('error.dev-url-unreachable', [resolvedUrl]), 'DevServerUrlError', [
305305
`Ensure your dev server is running at ${resolvedUrl}`,
306-
'Or add dev.command to webapplication.json to start it automatically',
306+
'Or add dev.command to uibundle.json to start it automatically',
307307
]);
308308
} else {
309309
// URL not reachable - we have dev.command (or defaults) to start
@@ -372,7 +372,7 @@ export default class UiBundleDev extends SfCommand<WebAppDevResult> {
372372

373373
const suggestions: string[] = [
374374
'The dev server may be taking longer than expected to start',
375-
'Check if the dev server command is correct in webapplication.json',
375+
'Check if the dev server command is correct in uibundle.json',
376376
`Try running the command manually to see the error: ${devCommand}`,
377377
];
378378
const devError =
@@ -403,7 +403,7 @@ export default class UiBundleDev extends SfCommand<WebAppDevResult> {
403403
// Ensure devServerUrl is set (should always be set by step 3)
404404
if (!devServerUrl) {
405405
throw new SfError(
406-
'❌ Unable to determine dev server URL. Please specify --url or configure dev.url in webapplication.json.',
406+
'❌ Unable to determine dev server URL. Please specify --url or configure dev.url in uibundle.json.',
407407
'DevServerUrlError'
408408
);
409409
}

src/config/ManifestWatcher.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export type ManifestChangeEvent = {
3838
*/
3939
type ManifestWatcherOptions = {
4040
/**
41-
* Path to the webapplication.json manifest file
42-
* Defaults to webapplication.json in the current working directory
41+
* Path to the uibundle.json manifest file
42+
* Defaults to uibundle.json in the current working directory
4343
*/
4444
manifestPath?: string;
4545

@@ -66,10 +66,10 @@ type ManifestWatcherEvents = {
6666
};
6767

6868
/**
69-
* ManifestWatcher loads and monitors the webapplication.json manifest file
69+
* ManifestWatcher loads and monitors the uibundle.json manifest file
7070
*
7171
* Features:
72-
* - Loads webapplication.json from project root
72+
* - Loads uibundle.json from project root
7373
* - Watches for file changes and emits events
7474
* - Provides helpful error messages
7575
* - Supports hot-reload without restarting the proxy
@@ -87,7 +87,7 @@ export class ManifestWatcher extends EventEmitter {
8787
super();
8888

8989
this.options = {
90-
manifestPath: options.manifestPath ?? join(process.cwd(), 'webapplication.json'),
90+
manifestPath: options.manifestPath ?? join(process.cwd(), 'uibundle.json'),
9191
watch: options.watch ?? true,
9292
debounceMs: options.debounceMs ?? 300,
9393
};
@@ -175,8 +175,8 @@ export class ManifestWatcher extends EventEmitter {
175175
});
176176
this.emit(
177177
'error',
178-
new SfError('webapplication.json was deleted', 'ManifestRemovedError', [
179-
'Recreate the webapplication.json file to continue',
178+
new SfError('uibundle.json was deleted', 'ManifestRemovedError', [
179+
'Recreate the uibundle.json file to continue',
180180
])
181181
);
182182
} else {
@@ -208,10 +208,10 @@ export class ManifestWatcher extends EventEmitter {
208208
private loadManifest(): void {
209209
// Check if file exists
210210
if (!existsSync(this.options.manifestPath)) {
211-
throw new SfError(`webapplication.json not found at ${this.options.manifestPath}`, 'ManifestNotFoundError', [
211+
throw new SfError(`uibundle.json not found at ${this.options.manifestPath}`, 'ManifestNotFoundError', [
212212
'Make sure you are in the correct directory',
213-
'Create a webapplication.json file in your project root',
214-
'Check that the file is named exactly "webapplication.json"',
213+
'Create a uibundle.json file in your project root',
214+
'Check that the file is named exactly "uibundle.json"',
215215
]);
216216
}
217217

@@ -221,7 +221,7 @@ export class ManifestWatcher extends EventEmitter {
221221
rawContent = readFileSync(this.options.manifestPath, 'utf-8');
222222
} catch (error) {
223223
throw new SfError(
224-
`Failed to read webapplication.json: ${error instanceof Error ? error.message : String(error)}`,
224+
`Failed to read uibundle.json: ${error instanceof Error ? error.message : String(error)}`,
225225
'ManifestReadError',
226226
['Check file permissions', 'Ensure the file is not locked by another process']
227227
);
@@ -232,7 +232,7 @@ export class ManifestWatcher extends EventEmitter {
232232
try {
233233
parsed = JSON.parse(rawContent) as WebAppManifest;
234234
} catch (error) {
235-
throw new SfError(`Invalid JSON in webapplication.json: ${(error as Error).message}`, 'ManifestParseError', [
235+
throw new SfError(`Invalid JSON in uibundle.json: ${(error as Error).message}`, 'ManifestParseError', [
236236
'Check for missing commas or brackets',
237237
'Validate JSON syntax using a JSON validator',
238238
'Common issues: trailing commas, unquoted keys, single quotes instead of double quotes',
@@ -272,7 +272,7 @@ export class ManifestWatcher extends EventEmitter {
272272
this.emit(
273273
'error',
274274
new SfError(`File watcher error: ${error.message}`, 'ManifestWatcherError', [
275-
'The webapplication.json file watcher encountered an error',
275+
'The uibundle.json file watcher encountered an error',
276276
'You may need to restart the command',
277277
])
278278
);

src/config/manifest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export type DevConfig = {
3939
};
4040

4141
/**
42-
* WebApp manifest configuration - defines the structure of webapplication.json file
42+
* WebApp manifest configuration - defines the structure of uibundle.json file
4343
* Extended from @salesforce/webapp-experimental with plugin-specific fields
4444
*/
4545
export type WebAppManifest = BaseWebAppManifest & {

src/config/webappDiscovery.ts

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import type { WebAppManifest } from './manifest.js';
2222
const logger = Logger.childFromRoot('WebappDiscovery');
2323

2424
/**
25-
* Default command to run when no webapplication.json manifest is found
25+
* Default command to run when no uibundle.json manifest is found
2626
*/
2727
export const DEFAULT_DEV_COMMAND = 'npm run dev';
2828

@@ -35,7 +35,7 @@ const WEBAPPLICATIONS_RELATIVE_PATH = 'main/default/uiBundles';
3535
/**
3636
* Pattern to match webapplication metadata XML files
3737
*/
38-
const WEBAPP_META_XML_PATTERN = /^(.+)\.webapplication-meta\.xml$/;
38+
const WEBAPP_META_XML_PATTERN = /^(.+)\.uibundle-meta\.xml$/;
3939

4040
/**
4141
* Discovered webapp with its directory path and optional manifest
@@ -45,15 +45,15 @@ export type DiscoveredWebapp = {
4545
path: string;
4646
/** Relative path from cwd to the webapp directory */
4747
relativePath: string;
48-
/** Parsed manifest content (null if no webapplication.json found) */
48+
/** Parsed manifest content (null if no uibundle.json found) */
4949
manifest: WebAppManifest | null;
50-
/** Webapp name (from .webapplication-meta.xml or folder name) */
50+
/** Webapp name (from .uibundle-meta.xml or folder name) */
5151
name: string;
52-
/** Whether this webapp has a webapplication.json manifest file */
52+
/** Whether this webapp has a uibundle.json manifest file */
5353
hasManifest: boolean;
5454
/** Path to the manifest file (null if no manifest) */
5555
manifestPath: string | null;
56-
/** Whether this webapp has a .webapplication-meta.xml file (valid SFDX webapp) */
56+
/** Whether this webapp has a .uibundle-meta.xml file (valid SFDX webapp) */
5757
hasMetaXml: boolean;
5858
};
5959

@@ -81,7 +81,7 @@ function isWebapplicationsFolder(folderName: string): boolean {
8181
}
8282

8383
/**
84-
* Check if a directory contains a {name}.webapplication-meta.xml file
84+
* Check if a directory contains a {name}.uibundle-meta.xml file
8585
* Returns the webapp name extracted from the filename, or null if not found.
8686
* Logs a warning if multiple metadata files are found (uses first match).
8787
*/
@@ -103,7 +103,7 @@ async function findWebappMetaXml(dirPath: string): Promise<string | null> {
103103

104104
if (matches.length > 1) {
105105
logger.warn(
106-
`Multiple .webapplication-meta.xml files found in ${dirPath}: ${matches.join(', ')}. Using "${matches[0]}".`
106+
`Multiple .uibundle-meta.xml files found in ${dirPath}: ${matches.join(', ')}. Using "${matches[0]}".`
107107
);
108108
}
109109

@@ -126,7 +126,7 @@ async function pathExists(path: string): Promise<boolean> {
126126
}
127127

128128
/**
129-
* Try to parse a webapplication.json file.
129+
* Try to parse a uibundle.json file.
130130
* Accepts any valid JSON object - missing fields will use defaults.
131131
*/
132132
async function tryParseWebappManifest(filePath: string): Promise<WebAppManifest | null> {
@@ -150,7 +150,7 @@ async function tryParseWebappManifest(filePath: string): Promise<WebAppManifest
150150
* Manifest does not have a name property - do not depend on it.
151151
*
152152
* @param folderName - The folder name (fallback)
153-
* @param metaXmlName - Name extracted from .webapplication-meta.xml (or null)
153+
* @param metaXmlName - Name extracted from .uibundle-meta.xml (or null)
154154
* @returns The resolved webapp name
155155
*/
156156
function resolveWebappName(folderName: string, metaXmlName: string | null): string {
@@ -266,12 +266,12 @@ function findWebapplicationsFolderUpward(
266266

267267
/**
268268
* Discover all webapps inside the uiBundles folder.
269-
* Only directories containing a {name}.webapplication-meta.xml file are considered valid webapps.
270-
* If a webapplication.json exists, use it for dev configuration.
269+
* Only directories containing a {name}.uibundle-meta.xml file are considered valid webapps.
270+
* If a uibundle.json exists, use it for dev configuration.
271271
*
272272
* @param webappsFolderPath - Absolute path to the uiBundles folder
273273
* @param cwd - Original working directory for relative path calculation
274-
* @returns Array of discovered webapps (only those with .webapplication-meta.xml)
274+
* @returns Array of discovered webapps (only those with .uibundle-meta.xml)
275275
*/
276276
async function discoverWebappsInFolder(webappsFolderPath: string, cwd: string): Promise<DiscoveredWebapp[]> {
277277
try {
@@ -284,15 +284,15 @@ async function discoverWebappsInFolder(webappsFolderPath: string, cwd: string):
284284
const webappPromises = webappDirs.map(async (entry): Promise<DiscoveredWebapp | null> => {
285285
const webappPath = join(webappsFolderPath, entry.name);
286286

287-
// Check for .webapplication-meta.xml file - this identifies valid webapps
287+
// Check for .uibundle-meta.xml file - this identifies valid webapps
288288
const metaXmlName = await findWebappMetaXml(webappPath);
289289

290-
// Only include directories that have a .webapplication-meta.xml file
290+
// Only include directories that have a .uibundle-meta.xml file
291291
if (!metaXmlName) {
292292
return null;
293293
}
294294

295-
const manifestFilePath = join(webappPath, 'webapplication.json');
295+
const manifestFilePath = join(webappPath, 'uibundle.json');
296296

297297
// Try to load manifest for dev configuration
298298
const manifest = await tryParseWebappManifest(manifestFilePath);
@@ -310,7 +310,7 @@ async function discoverWebappsInFolder(webappsFolderPath: string, cwd: string):
310310

311311
const results = await Promise.all(webappPromises);
312312

313-
// Filter out null results (directories without .webapplication-meta.xml)
313+
// Filter out null results (directories without .uibundle-meta.xml)
314314
return results.filter((webapp): webapp is DiscoveredWebapp => webapp !== null);
315315
} catch {
316316
// Permission denied or other read error
@@ -338,7 +338,7 @@ type FindAllWebappsResult = {
338338
* Discovery strategy (in order):
339339
* 1. Check if inside a uiBundles/<webapp> directory (upward search)
340340
* 2. Check for SFDX project and search uiBundles in all package directories
341-
* 3. If neither, check if current directory is a webapp (has .webapplication-meta.xml)
341+
* 3. If neither, check if current directory is a webapp (has .uibundle-meta.xml)
342342
*
343343
* @param cwd - Directory to search from (defaults to process.cwd())
344344
* @returns Object with discovered webapps and context information
@@ -379,12 +379,12 @@ async function findAllWebapps(cwd: string = process.cwd()): Promise<FindAllWebap
379379
}
380380

381381
// Step 3: If no uiBundles folder found, check if current directory IS a webapp
382-
// (has a .webapplication-meta.xml file) - for running outside SFDX project context
382+
// (has a .uibundle-meta.xml file) - for running outside SFDX project context
383383
if (!webappsFolder) {
384384
const metaXmlName = await findWebappMetaXml(cwd);
385385
if (metaXmlName) {
386386
// Current directory is a standalone webapp
387-
const manifestFilePath = join(cwd, 'webapplication.json');
387+
const manifestFilePath = join(cwd, 'uibundle.json');
388388
const manifest = await tryParseWebappManifest(manifestFilePath);
389389
const webappName = resolveWebappName(basename(cwd), metaXmlName);
390390

@@ -444,14 +444,14 @@ export type DiscoverWebappResult = {
444444
*
445445
* Discovery use cases:
446446
* 1. SFDX Project Root: Search uiBundles in all package directories
447-
* - Webapps identified by {name}.webapplication-meta.xml
447+
* - Webapps identified by {name}.uibundle-meta.xml
448448
* - Always prompt for selection (even if only 1 webapp)
449449
*
450450
* 2. Inside uiBundles/<webapp> directory:
451451
* - Auto-select current webapp
452452
* - Error if --name conflicts with current directory
453453
*
454-
* 3. Outside SFDX project with .webapplication-meta.xml in current dir:
454+
* 3. Outside SFDX project with .uibundle-meta.xml in current dir:
455455
* - Use current directory as standalone webapp
456456
*
457457
* @param name - Optional webapp name to search for (--name flag)
@@ -468,15 +468,15 @@ export async function discoverWebapp(
468468
// No webapps found
469469
if (allWebapps.length === 0) {
470470
if (webappsFolderFound) {
471-
// Folder exists but no valid webapps (no .webapplication-meta.xml files)
471+
// Folder exists but no valid webapps (no .uibundle-meta.xml files)
472472
throw new SfError(
473473
'Found "uiBundles" folder but no valid webapps inside it.\n' +
474-
'Each webapp must have a {name}.webapplication-meta.xml file.\n\n' +
474+
'Each webapp must have a {name}.uibundle-meta.xml file.\n\n' +
475475
'Expected structure:\n' +
476476
' uiBundles/\n' +
477477
' └── my-app/\n' +
478-
' ├── my-app.webapplication-meta.xml (required)\n' +
479-
' └── webapplication.json (optional, for dev config)',
478+
' ├── my-app.uibundle-meta.xml (required)\n' +
479+
' └── uibundle.json (optional, for dev config)',
480480
'WebappNotFoundError'
481481
);
482482
} else if (inSfdxProject) {
@@ -486,8 +486,8 @@ export async function discoverWebapp(
486486
'Create the folder structure in any package directory (e.g. force-app, packages/my-pkg):\n' +
487487
' <package-path>/main/default/uiBundles/\n' +
488488
' └── my-app/\n' +
489-
' ├── my-app.webapplication-meta.xml (required)\n' +
490-
' └── webapplication.json (optional, for dev config)',
489+
' ├── my-app.uibundle-meta.xml (required)\n' +
490+
' └── uibundle.json (optional, for dev config)',
491491
'WebappNotFoundError'
492492
);
493493
} else {
@@ -497,7 +497,7 @@ export async function discoverWebapp(
497497
'To use this command, either:\n' +
498498
'1. Run from an SFDX project with webapps in <package>/main/default/uiBundles/\n' +
499499
'2. Run from inside a uiBundles/<webapp>/ directory\n' +
500-
'3. Run from a directory containing a {name}.webapplication-meta.xml file',
500+
'3. Run from a directory containing a {name}.uibundle-meta.xml file',
501501
'WebappNotFoundError'
502502
);
503503
}

src/server/DevServerManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ export class DevServerManager extends EventEmitter {
359359
this.logger.error(`Dev server process error: ${error.message}`);
360360

361361
const sfError = new SfError(`❌ Dev server process error: ${error.message}`, 'DevServerProcessError', [
362-
'Check that the command is correct in webapplication.json',
362+
'Check that the command is correct in uibundle.json',
363363
'Verify all dependencies are installed',
364364
'Try running the command manually to see the error',
365365
]);

test/config/ManifestWatcher.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import type { WebAppManifest, ManifestChangeEvent } from '../../src/config/types
2525
describe('ManifestWatcher', () => {
2626
const $$ = new TestContext();
2727
const testDir = join(process.cwd(), '.test-manifests');
28-
const testManifestPath = join(testDir, 'webapplication.json');
28+
const testManifestPath = join(testDir, 'uibundle.json');
2929

3030
const validManifest: WebAppManifest = {
3131
name: 'testApp',
@@ -90,7 +90,7 @@ describe('ManifestWatcher', () => {
9090
} catch (error) {
9191
expect(error).to.be.instanceOf(SfError);
9292
expect((error as SfError).name).to.equal('ManifestNotFoundError');
93-
expect((error as SfError).message).to.include('webapplication.json not found');
93+
expect((error as SfError).message).to.include('uibundle.json not found');
9494
expect((error as SfError).actions).to.exist;
9595
}
9696

@@ -125,7 +125,7 @@ describe('ManifestWatcher', () => {
125125

126126
it('should handle read permission errors', async () => {
127127
// Create a file path that doesn't exist to simulate read error
128-
const invalidPath = join(testDir, 'nonexistent', 'webapplication.json');
128+
const invalidPath = join(testDir, 'nonexistent', 'uibundle.json');
129129

130130
const watcher = new ManifestWatcher({ manifestPath: invalidPath, watch: false });
131131

@@ -431,8 +431,8 @@ describe('ManifestWatcher', () => {
431431
});
432432

433433
describe('Default Options', () => {
434-
it('should use webapplication.json in current directory by default', async () => {
435-
const defaultPath = join(process.cwd(), 'webapplication.json');
434+
it('should use uibundle.json in current directory by default', async () => {
435+
const defaultPath = join(process.cwd(), 'uibundle.json');
436436

437437
// Create manifest in current directory
438438
writeFileSync(defaultPath, JSON.stringify(validManifest, null, 2));

0 commit comments

Comments
 (0)