@salesforce/ui-bundle-template-cli 1.117.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/LICENSE.txt +82 -0
  2. package/README.md +1613 -0
  3. package/dist/commands/apply-patches.d.ts +23 -0
  4. package/dist/commands/apply-patches.d.ts.map +1 -0
  5. package/dist/commands/apply-patches.js +804 -0
  6. package/dist/commands/apply-patches.js.map +1 -0
  7. package/dist/commands/new-app-feature.d.ts +7 -0
  8. package/dist/commands/new-app-feature.d.ts.map +1 -0
  9. package/dist/commands/new-app-feature.js +215 -0
  10. package/dist/commands/new-app-feature.js.map +1 -0
  11. package/dist/commands/new-app.d.ts +6 -0
  12. package/dist/commands/new-app.d.ts.map +1 -0
  13. package/dist/commands/new-app.js +7 -0
  14. package/dist/commands/new-app.js.map +1 -0
  15. package/dist/commands/watch-patches.d.ts +4 -0
  16. package/dist/commands/watch-patches.d.ts.map +1 -0
  17. package/dist/commands/watch-patches.js +134 -0
  18. package/dist/commands/watch-patches.js.map +1 -0
  19. package/dist/core/dependency-resolver.d.ts +40 -0
  20. package/dist/core/dependency-resolver.d.ts.map +1 -0
  21. package/dist/core/dependency-resolver.js +126 -0
  22. package/dist/core/dependency-resolver.js.map +1 -0
  23. package/dist/core/file-operations.d.ts +55 -0
  24. package/dist/core/file-operations.d.ts.map +1 -0
  25. package/dist/core/file-operations.js +350 -0
  26. package/dist/core/file-operations.js.map +1 -0
  27. package/dist/core/package-json-merger.d.ts +19 -0
  28. package/dist/core/package-json-merger.d.ts.map +1 -0
  29. package/dist/core/package-json-merger.js +104 -0
  30. package/dist/core/package-json-merger.js.map +1 -0
  31. package/dist/core/patch-loader.d.ts +18 -0
  32. package/dist/core/patch-loader.d.ts.map +1 -0
  33. package/dist/core/patch-loader.js +115 -0
  34. package/dist/core/patch-loader.js.map +1 -0
  35. package/dist/index.d.ts +3 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +95 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/nx-plugin/executors/apply-patches/executor.d.ts +20 -0
  40. package/dist/nx-plugin/executors/apply-patches/executor.d.ts.map +1 -0
  41. package/dist/nx-plugin/executors/apply-patches/executor.js +77 -0
  42. package/dist/nx-plugin/executors/apply-patches/executor.js.map +1 -0
  43. package/dist/nx-plugin/executors/build-dist-app/executor.d.ts +20 -0
  44. package/dist/nx-plugin/executors/build-dist-app/executor.d.ts.map +1 -0
  45. package/dist/nx-plugin/executors/build-dist-app/executor.js +88 -0
  46. package/dist/nx-plugin/executors/build-dist-app/executor.js.map +1 -0
  47. package/dist/nx-plugin/executors/dev-server/executor.d.ts +20 -0
  48. package/dist/nx-plugin/executors/dev-server/executor.d.ts.map +1 -0
  49. package/dist/nx-plugin/executors/dev-server/executor.js +59 -0
  50. package/dist/nx-plugin/executors/dev-server/executor.js.map +1 -0
  51. package/dist/nx-plugin/executors/utils.d.ts +9 -0
  52. package/dist/nx-plugin/executors/utils.d.ts.map +1 -0
  53. package/dist/nx-plugin/executors/utils.js +25 -0
  54. package/dist/nx-plugin/executors/utils.js.map +1 -0
  55. package/dist/nx-plugin/executors/watch-patches/executor.d.ts +20 -0
  56. package/dist/nx-plugin/executors/watch-patches/executor.d.ts.map +1 -0
  57. package/dist/nx-plugin/executors/watch-patches/executor.js +71 -0
  58. package/dist/nx-plugin/executors/watch-patches/executor.js.map +1 -0
  59. package/dist/types.d.ts +28 -0
  60. package/dist/types.d.ts.map +1 -0
  61. package/dist/types.js +2 -0
  62. package/dist/types.js.map +1 -0
  63. package/dist/utils/debounce.d.ts +9 -0
  64. package/dist/utils/debounce.d.ts.map +1 -0
  65. package/dist/utils/debounce.js +20 -0
  66. package/dist/utils/debounce.js.map +1 -0
  67. package/dist/utils/import-merger.d.ts +17 -0
  68. package/dist/utils/import-merger.d.ts.map +1 -0
  69. package/dist/utils/import-merger.js +244 -0
  70. package/dist/utils/import-merger.js.map +1 -0
  71. package/dist/utils/logger.d.ts +7 -0
  72. package/dist/utils/logger.d.ts.map +1 -0
  73. package/dist/utils/logger.js +23 -0
  74. package/dist/utils/logger.js.map +1 -0
  75. package/dist/utils/path-mappings.d.ts +94 -0
  76. package/dist/utils/path-mappings.d.ts.map +1 -0
  77. package/dist/utils/path-mappings.js +139 -0
  78. package/dist/utils/path-mappings.js.map +1 -0
  79. package/dist/utils/paths.d.ts +61 -0
  80. package/dist/utils/paths.d.ts.map +1 -0
  81. package/dist/utils/paths.js +182 -0
  82. package/dist/utils/paths.js.map +1 -0
  83. package/dist/utils/route-merger.d.ts +107 -0
  84. package/dist/utils/route-merger.d.ts.map +1 -0
  85. package/dist/utils/route-merger.js +358 -0
  86. package/dist/utils/route-merger.js.map +1 -0
  87. package/dist/utils/validation.d.ts +35 -0
  88. package/dist/utils/validation.d.ts.map +1 -0
  89. package/dist/utils/validation.js +137 -0
  90. package/dist/utils/validation.js.map +1 -0
  91. package/executors.json +24 -0
  92. package/package.json +48 -0
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+ import { join, isAbsolute } from "path";
7
+ import { loadPatch } from "./patch-loader";
8
+ import { getMonorepoRoot } from "../utils/paths";
9
+ import { validateAndResolveFeaturePath } from "../utils/validation";
10
+ /**
11
+ * Base error for dependency resolution failures
12
+ */
13
+ export class DependencyResolutionError extends Error {
14
+ constructor(message) {
15
+ super(message);
16
+ this.name = "DependencyResolutionError";
17
+ }
18
+ }
19
+ /**
20
+ * Error thrown when a circular dependency is detected
21
+ */
22
+ export class CircularDependencyError extends DependencyResolutionError {
23
+ cycle;
24
+ constructor(cycle) {
25
+ const cycleStr = cycle.join(" → ");
26
+ super(`Circular dependency detected:\n ${cycleStr}\n\nPlease remove one of these dependencies to break the cycle.`);
27
+ this.cycle = cycle;
28
+ this.name = "CircularDependencyError";
29
+ }
30
+ }
31
+ /**
32
+ * Normalize a patch path to an absolute path for consistent comparison
33
+ *
34
+ * @param patchPath - Relative or absolute patch path
35
+ * @returns Absolute path to the patch
36
+ */
37
+ function normalizePath(patchPath) {
38
+ // If already absolute, return as-is
39
+ if (isAbsolute(patchPath)) {
40
+ return patchPath;
41
+ }
42
+ // If relative, resolve from monorepo root
43
+ return join(getMonorepoRoot(), patchPath);
44
+ }
45
+ /**
46
+ * Recursively resolve dependencies using depth-first search with post-order traversal
47
+ *
48
+ * @param patchPath - Path to the patch to resolve
49
+ * @param visited - Set of patches currently being processed (for cycle detection)
50
+ * @param resolved - Set of patches that have been fully processed
51
+ * @param result - Accumulator for ordered patches
52
+ * @param dependencyGraph - Map of patch paths to their dependencies
53
+ * @param dependencyChain - Current chain of dependencies (for error messages)
54
+ */
55
+ async function resolveDependenciesRecursive(patchPath, visited, resolved, result, dependencyGraph, dependencyChain) {
56
+ const normalizedPath = normalizePath(patchPath);
57
+ // Skip if already resolved (handles diamond dependencies)
58
+ if (resolved.has(normalizedPath)) {
59
+ return;
60
+ }
61
+ // Circular dependency detection
62
+ if (visited.has(normalizedPath)) {
63
+ const cycle = [...dependencyChain, patchPath];
64
+ throw new CircularDependencyError(cycle);
65
+ }
66
+ // Mark as visiting
67
+ visited.add(normalizedPath);
68
+ dependencyChain.push(patchPath);
69
+ try {
70
+ // Validate and load patch
71
+ const patchDir = validateAndResolveFeaturePath(patchPath);
72
+ const config = await loadPatch(patchDir);
73
+ // Store in dependency graph for debugging
74
+ dependencyGraph.set(normalizedPath, config.dependencies);
75
+ // Recursively resolve dependencies (depth-first)
76
+ for (const depPath of config.dependencies) {
77
+ await resolveDependenciesRecursive(depPath, visited, resolved, result, dependencyGraph, [...dependencyChain]);
78
+ }
79
+ // Post-order: add after all dependencies are resolved
80
+ result.push({
81
+ patchPath,
82
+ patchDir,
83
+ config,
84
+ });
85
+ // Mark as resolved
86
+ resolved.add(normalizedPath);
87
+ }
88
+ finally {
89
+ // Clean up visiting state
90
+ visited.delete(normalizedPath);
91
+ dependencyChain.pop();
92
+ }
93
+ }
94
+ /**
95
+ * Resolve all dependencies for a patch recursively
96
+ * Returns patches in dependency order (dependencies first, main patch last)
97
+ *
98
+ * @param patchPath - Path to the main patch
99
+ * @returns Resolution result with ordered patches and dependency graph
100
+ * @throws CircularDependencyError if circular dependencies are detected
101
+ * @throws DependencyResolutionError if a dependency cannot be loaded
102
+ */
103
+ export async function resolveDependencies(patchPath) {
104
+ const visited = new Set();
105
+ const resolved = new Set();
106
+ const result = [];
107
+ const dependencyGraph = new Map();
108
+ const dependencyChain = [];
109
+ try {
110
+ await resolveDependenciesRecursive(patchPath, visited, resolved, result, dependencyGraph, dependencyChain);
111
+ return {
112
+ orderedPatches: result,
113
+ dependencyGraph,
114
+ };
115
+ }
116
+ catch (err) {
117
+ // Re-throw our custom errors as-is
118
+ if (err instanceof DependencyResolutionError) {
119
+ throw err;
120
+ }
121
+ // Wrap other errors
122
+ const message = err instanceof Error ? err.message : String(err);
123
+ throw new DependencyResolutionError(`Failed to resolve dependencies: ${message}`);
124
+ }
125
+ }
126
+ //# sourceMappingURL=dependency-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependency-resolver.js","sourceRoot":"","sources":["../../src/core/dependency-resolver.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,SAAS,EAAoB,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAmBpE;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IACnD,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IACzC,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,yBA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,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjE,MAAM,IAAI,yBAAyB,CAAC,mCAAmC,OAAO,EAAE,CAAC,CAAC;IACnF,CAAC;AACF,CAAC"}
@@ -0,0 +1,55 @@
1
+ export declare class FileOperationError extends Error {
2
+ constructor(message: string);
3
+ }
4
+ /**
5
+ * Process UI bundle meta.xml file: replace template parameters and rename
6
+ * @param targetFilePath - Full path to the target file
7
+ * @param appName - Application name to use for masterLabel and filename
8
+ * @returns New file path if file was renamed, or original path
9
+ */
10
+ export declare function processUIBundleMetaFile(targetFilePath: string, appName: string): string;
11
+ /**
12
+ * Copy site-container template into target force-app/main/default, replacing
13
+ * template params (appName, siteName, siteName1, siteNameLower, etc.) and path
14
+ * placeholders (__siteName__, __siteName1__) in directory and file names.
15
+ *
16
+ * @param templateRoot - Path to template-site-container/force-app/main/default
17
+ * @param targetForceAppDefault - Path to target's force-app/main/default
18
+ * @param appName - Application name (used as site name base)
19
+ */
20
+ export declare function copySiteContainerTemplate(templateRoot: string, targetForceAppDefault: string, appName: string): void;
21
+ /**
22
+ * Apply a file from patch to target, optionally merging with base
23
+ *
24
+ * @param patchFilePath - Full path to the patch file from the feature
25
+ * @param baseFilePath - Full path to the original base app file (used for merging)
26
+ * @param targetFilePath - Full path to where the result should be written
27
+ * @param relativeTargetPath - Relative path for logging (e.g. "src/routes.tsx")
28
+ * @param shouldMerge - If true, merges patch with base using route merge strategy
29
+ * @param appName - Application name for template processing (optional)
30
+ */
31
+ export declare function applyFile(patchFilePath: string, baseFilePath: string, targetFilePath: string, relativeTargetPath: string, shouldMerge?: boolean, appName?: string): Promise<void>;
32
+ /**
33
+ * Delete a file or directory from the target app
34
+ *
35
+ * @param targetFilePath - Full path to the file/directory to delete
36
+ * @param relativeTargetPath - Relative path for logging (e.g. "src/routes.tsx")
37
+ */
38
+ export declare function deleteFile(targetFilePath: string, relativeTargetPath: string): Promise<void>;
39
+ /**
40
+ * Prepend content from a feature file to the beginning of a target file
41
+ *
42
+ * @param featureFilePath - Full path to the feature file with content to prepend
43
+ * @param targetFilePath - Full path to the target file to prepend to
44
+ * @param relativeTargetPath - Relative path for logging (e.g. "src/styles/global.css")
45
+ */
46
+ export declare function prependToFile(featureFilePath: string, targetFilePath: string, relativeTargetPath: string): Promise<void>;
47
+ /**
48
+ * Append content from a feature file to the end of a target file
49
+ *
50
+ * @param featureFilePath - Full path to the feature file with content to append
51
+ * @param targetFilePath - Full path to the target file to append to
52
+ * @param relativeTargetPath - Relative path for logging (e.g. "src/styles/global.css")
53
+ */
54
+ export declare function appendToFile(featureFilePath: string, targetFilePath: string, relativeTargetPath: string): Promise<void>;
55
+ //# sourceMappingURL=file-operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-operations.d.ts","sourceRoot":"","sources":["../../src/core/file-operations.ts"],"names":[],"mappings":"AAqBA,qBAAa,kBAAmB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAI3B;AAgGD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAmCvF;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACxC,YAAY,EAAE,MAAM,EACpB,qBAAqB,EAAE,MAAM,EAC7B,OAAO,EAAE,MAAM,GACb,IAAI,CAyCN;AAED;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAC9B,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,MAAM,EAC1B,WAAW,UAAQ,EACnB,OAAO,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAiGf;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAC/B,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,MAAM,GACxB,OAAO,CAAC,IAAI,CAAC,CAef;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAClC,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,MAAM,GACxB,OAAO,CAAC,IAAI,CAAC,CA6Bf;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CACjC,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,MAAM,GACxB,OAAO,CAAC,IAAI,CAAC,CA6Bf"}
@@ -0,0 +1,350 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+ import { readFileSync, readdirSync, existsSync, mkdirSync, writeFileSync, rmSync, statSync, renameSync, } from "fs";
7
+ import { dirname, extname, basename, join } from "path";
8
+ import * as logger from "../utils/logger";
9
+ import { mergeRoutes } from "../utils/route-merger";
10
+ const _INHERIT_PREFIX = "__inherit__";
11
+ export class FileOperationError extends Error {
12
+ constructor(message) {
13
+ super(message);
14
+ this.name = "FileOperationError";
15
+ }
16
+ }
17
+ /**
18
+ * Fix import paths by removing __inherit__ prefix from import/require statements
19
+ *
20
+ * Examples:
21
+ * - import { x } from './__inherit__routes' -> import { x } from './routes'
22
+ * - import x from '../__inherit__routes.tsx' -> import x from '../routes.tsx'
23
+ * - require('./__inherit__file') -> require('./file')
24
+ *
25
+ * @param content - File content to process
26
+ * @returns Content with fixed import paths
27
+ */
28
+ function fixInheritImportPaths(content) {
29
+ // Match import/export statements with __inherit__ in the path
30
+ // Handles: import ... from '...__inherit__...'
31
+ // export ... from '...__inherit__...'
32
+ // import('...__inherit__...')
33
+ // require('...__inherit__...')
34
+ // Pattern explanation:
35
+ // (from\s+|import\(|require\() - matches 'from ', 'import(', or 'require('
36
+ // (['"`]) - captures opening quote
37
+ // ([^'"`]*) - captures path before __inherit__
38
+ // __inherit__ - the prefix to remove
39
+ // ([^'"`]*) - captures rest of path
40
+ // \2 - matches same quote type as opening
41
+ return content.replace(/(from\s+|import\(|require\()(['"`])([^'"`]*)__inherit__([^'"`]*)\2/g, (match, prefix, quote, before, after) => {
42
+ return `${prefix}${quote}${before}${after}${quote}`;
43
+ });
44
+ }
45
+ /**
46
+ * Check if file is a JS/TS file that may contain imports
47
+ */
48
+ function isJavaScriptFile(filePath) {
49
+ const ext = extname(filePath);
50
+ return ["", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"].includes(ext);
51
+ }
52
+ /**
53
+ * Check if file is a UI bundle meta.xml file that needs template processing.
54
+ * Accepts both _uibundle.uibundle-meta.xml and _uibundle.uiBundle-meta.xml (case variation).
55
+ */
56
+ function isUIBundleMetaFile(filePath) {
57
+ const fileName = basename(filePath);
58
+ return fileName.toLowerCase() === "_uibundle.uibundle-meta.xml";
59
+ }
60
+ /**
61
+ * Check if file is a site-container metadata file that needs template parameter replacement
62
+ * (digitalExperienceConfigs, digitalExperiences, networks, sites under force-app/main/default)
63
+ */
64
+ function isSiteContainerMetaFile(filePath) {
65
+ const normalized = filePath.replace(/\\/g, "/");
66
+ return (normalized.includes("/digitalExperienceConfigs/") ||
67
+ normalized.includes("/digitalExperiences/") ||
68
+ normalized.includes("/networks/") ||
69
+ normalized.includes("/sites/"));
70
+ }
71
+ /**
72
+ * Replace site-container template parameters with values derived from app name.
73
+ * Uses <%= appName %>, <%= urlPathPrefixVForceSite %>, <%= appSpace %>,
74
+ * <%= siteName %>, <%= siteName1 %>, <%= siteNameLower %> (siteName = appName, siteName1 = appName + "1", siteNameLower = appName.toLowerCase()).
75
+ */
76
+ function replaceSiteContainerParams(content, appName) {
77
+ const urlPathPrefixVForceSite = `${appName}vforcesite`;
78
+ const appSpace = `c__${appName}`;
79
+ const siteName = appName;
80
+ const siteName1 = `${appName}1`;
81
+ const siteNameLower = appName.toLowerCase();
82
+ return content
83
+ .replace(/<%= appName %>/g, appName)
84
+ .replace(/<%= urlPathPrefixVForceSite %>/g, urlPathPrefixVForceSite)
85
+ .replace(/<%= appSpace %>/g, appSpace)
86
+ .replace(/<%= siteName %>/g, siteName)
87
+ .replace(/<%= siteName1 %>/g, siteName1)
88
+ .replace(/<%= siteNameLower %>/g, siteNameLower);
89
+ }
90
+ /** Translate placeholder path segments to actual site name values (handles dir names and filenames like __siteName1__.digitalExperienceConfig). */
91
+ function translateSiteContainerPathSegment(segment, siteName, siteName1) {
92
+ return segment.replace(/__siteName1__/g, siteName1).replace(/__siteName__/g, siteName);
93
+ }
94
+ /**
95
+ * Process UI bundle meta.xml file: replace template parameters and rename
96
+ * @param targetFilePath - Full path to the target file
97
+ * @param appName - Application name to use for masterLabel and filename
98
+ * @returns New file path if file was renamed, or original path
99
+ */
100
+ export function processUIBundleMetaFile(targetFilePath, appName) {
101
+ if (!isUIBundleMetaFile(targetFilePath)) {
102
+ return targetFilePath;
103
+ }
104
+ // Read the file content
105
+ let content = readFileSync(targetFilePath, "utf-8");
106
+ // Replace template parameters
107
+ content = content.replace(/<%= masterLabel %>/g, appName);
108
+ // Write the updated content
109
+ writeFileSync(targetFilePath, content, "utf-8");
110
+ // Rename the file from _uibundle.*-meta.xml to <appName>.uibundle-meta.xml
111
+ const targetDir = dirname(targetFilePath);
112
+ const newFileName = `${appName}.uibundle-meta.xml`;
113
+ const newFilePath = join(targetDir, newFileName);
114
+ // If the new file already exists, update it with the new content
115
+ if (existsSync(newFilePath)) {
116
+ const existingContent = readFileSync(newFilePath, "utf-8");
117
+ if (existingContent !== content) {
118
+ // Content is different, update it
119
+ writeFileSync(newFilePath, content, "utf-8");
120
+ }
121
+ // Delete the old file regardless
122
+ rmSync(targetFilePath, { force: true });
123
+ return newFilePath;
124
+ }
125
+ // Rename the file
126
+ renameSync(targetFilePath, newFilePath);
127
+ logger.info(`Renamed ${basename(targetFilePath)} to ${newFileName}`);
128
+ return newFilePath;
129
+ }
130
+ /**
131
+ * Copy site-container template into target force-app/main/default, replacing
132
+ * template params (appName, siteName, siteName1, siteNameLower, etc.) and path
133
+ * placeholders (__siteName__, __siteName1__) in directory and file names.
134
+ *
135
+ * @param templateRoot - Path to template-site-container/force-app/main/default
136
+ * @param targetForceAppDefault - Path to target's force-app/main/default
137
+ * @param appName - Application name (used as site name base)
138
+ */
139
+ export function copySiteContainerTemplate(templateRoot, targetForceAppDefault, appName) {
140
+ if (!existsSync(templateRoot)) {
141
+ return;
142
+ }
143
+ const siteName = appName;
144
+ const siteName1 = `${appName}1`;
145
+ function translateRelativePath(relativePath) {
146
+ return relativePath
147
+ .split("/")
148
+ .map((seg) => translateSiteContainerPathSegment(seg, siteName, siteName1))
149
+ .join("/");
150
+ }
151
+ function walk(dir, base = "") {
152
+ const entries = readdirSync(dir, { withFileTypes: true });
153
+ for (const entry of entries) {
154
+ const relativePath = base ? `${base}/${entry.name}` : entry.name;
155
+ const targetRelativePath = translateRelativePath(relativePath);
156
+ const srcPath = join(dir, entry.name);
157
+ const destPath = join(targetForceAppDefault, targetRelativePath);
158
+ if (entry.isDirectory()) {
159
+ if (!existsSync(destPath)) {
160
+ mkdirSync(destPath, { recursive: true });
161
+ }
162
+ walk(srcPath, relativePath);
163
+ }
164
+ else {
165
+ let content = readFileSync(srcPath, "utf-8");
166
+ content = replaceSiteContainerParams(content, appName);
167
+ if (!existsSync(dirname(destPath))) {
168
+ mkdirSync(dirname(destPath), { recursive: true });
169
+ }
170
+ writeFileSync(destPath, content, "utf-8");
171
+ logger.info(`Site container: ${targetRelativePath}`);
172
+ }
173
+ }
174
+ }
175
+ walk(templateRoot);
176
+ }
177
+ /**
178
+ * Apply a file from patch to target, optionally merging with base
179
+ *
180
+ * @param patchFilePath - Full path to the patch file from the feature
181
+ * @param baseFilePath - Full path to the original base app file (used for merging)
182
+ * @param targetFilePath - Full path to where the result should be written
183
+ * @param relativeTargetPath - Relative path for logging (e.g. "src/routes.tsx")
184
+ * @param shouldMerge - If true, merges patch with base using route merge strategy
185
+ * @param appName - Application name for template processing (optional)
186
+ */
187
+ export async function applyFile(patchFilePath, baseFilePath, targetFilePath, relativeTargetPath, shouldMerge = false, appName) {
188
+ if (!existsSync(patchFilePath)) {
189
+ throw new FileOperationError(`Patch file not found: ${patchFilePath}`);
190
+ }
191
+ // Read the patch content
192
+ let patchContent = readFileSync(patchFilePath, "utf-8");
193
+ // Fix __inherit__ import paths for JS/TS files
194
+ if (isJavaScriptFile(patchFilePath)) {
195
+ patchContent = fixInheritImportPaths(patchContent);
196
+ }
197
+ // Replace site-container template params before merge/write so comparisons use final content
198
+ if (appName && isSiteContainerMetaFile(targetFilePath)) {
199
+ patchContent = replaceSiteContainerParams(patchContent, appName);
200
+ }
201
+ if (shouldMerge) {
202
+ // Merge strategy - merge patch with base, write to target
203
+ if (!existsSync(baseFilePath)) {
204
+ throw new FileOperationError(`Base file not found: ${baseFilePath}. Merge requires base file to exist.`);
205
+ }
206
+ // Merge patch with base (note: mergeRoutes reads files internally, so we write fixed content to temp)
207
+ let mergedContent = mergeRoutes(patchFilePath, baseFilePath);
208
+ // Fix imports in merged content
209
+ if (isJavaScriptFile(targetFilePath)) {
210
+ mergedContent = fixInheritImportPaths(mergedContent);
211
+ }
212
+ // Replace site-container template params in merged output when applicable
213
+ if (appName && isSiteContainerMetaFile(targetFilePath)) {
214
+ mergedContent = replaceSiteContainerParams(mergedContent, appName);
215
+ }
216
+ // Check if target already has this content
217
+ if (existsSync(targetFilePath)) {
218
+ const existingContent = readFileSync(targetFilePath, "utf-8");
219
+ if (existingContent === mergedContent) {
220
+ logger.info(`Skipped ${relativeTargetPath} (content unchanged after merge)`);
221
+ return;
222
+ }
223
+ }
224
+ // Ensure target directory exists
225
+ const targetDirPath = dirname(targetFilePath);
226
+ if (!existsSync(targetDirPath)) {
227
+ mkdirSync(targetDirPath, { recursive: true });
228
+ }
229
+ writeFileSync(targetFilePath, mergedContent, "utf-8");
230
+ logger.success(`Merged ${relativeTargetPath}`);
231
+ }
232
+ else {
233
+ // Add/Update strategy - copy patch to target
234
+ const targetExists = existsSync(targetFilePath);
235
+ if (targetExists) {
236
+ const existingContent = readFileSync(targetFilePath, "utf-8");
237
+ if (existingContent === patchContent) {
238
+ logger.info(`Skipped ${relativeTargetPath} (content unchanged)`);
239
+ return;
240
+ }
241
+ }
242
+ // Ensure target directory exists
243
+ const targetDirPath = dirname(targetFilePath);
244
+ if (!existsSync(targetDirPath)) {
245
+ mkdirSync(targetDirPath, { recursive: true });
246
+ }
247
+ // Write the file
248
+ writeFileSync(targetFilePath, patchContent, "utf-8");
249
+ // Process UI bundle meta.xml file if needed
250
+ if (appName && isUIBundleMetaFile(targetFilePath)) {
251
+ const newFilePath = processUIBundleMetaFile(targetFilePath, appName);
252
+ // Update relativeTargetPath for logging if file was renamed
253
+ if (newFilePath !== targetFilePath) {
254
+ const newRelativePath = relativeTargetPath.replace(/_uibundle\.uibundle-meta\.xml$/i, `${appName}.uibundle-meta.xml`);
255
+ logger.success(`Added ${newRelativePath}`);
256
+ return;
257
+ }
258
+ }
259
+ if (targetExists) {
260
+ logger.success(`Updated ${relativeTargetPath}`);
261
+ }
262
+ else {
263
+ logger.success(`Added ${relativeTargetPath}`);
264
+ }
265
+ }
266
+ }
267
+ /**
268
+ * Delete a file or directory from the target app
269
+ *
270
+ * @param targetFilePath - Full path to the file/directory to delete
271
+ * @param relativeTargetPath - Relative path for logging (e.g. "src/routes.tsx")
272
+ */
273
+ export async function deleteFile(targetFilePath, relativeTargetPath) {
274
+ if (!existsSync(targetFilePath)) {
275
+ logger.info(`Skipped deleting ${relativeTargetPath} (does not exist)`);
276
+ return;
277
+ }
278
+ const stat = statSync(targetFilePath);
279
+ if (stat.isDirectory()) {
280
+ rmSync(targetFilePath, { recursive: true, force: true });
281
+ logger.success(`Deleted directory ${relativeTargetPath}`);
282
+ }
283
+ else {
284
+ rmSync(targetFilePath, { force: true });
285
+ logger.success(`Deleted ${relativeTargetPath}`);
286
+ }
287
+ }
288
+ /**
289
+ * Prepend content from a feature file to the beginning of a target file
290
+ *
291
+ * @param featureFilePath - Full path to the feature file with content to prepend
292
+ * @param targetFilePath - Full path to the target file to prepend to
293
+ * @param relativeTargetPath - Relative path for logging (e.g. "src/styles/global.css")
294
+ */
295
+ export async function prependToFile(featureFilePath, targetFilePath, relativeTargetPath) {
296
+ if (!existsSync(featureFilePath)) {
297
+ throw new FileOperationError(`Patch file not found: ${featureFilePath}`);
298
+ }
299
+ if (!existsSync(targetFilePath)) {
300
+ throw new FileOperationError(`Target file not found: ${targetFilePath}`);
301
+ }
302
+ // Read both files
303
+ let featureContent = readFileSync(featureFilePath, "utf-8");
304
+ const targetContent = readFileSync(targetFilePath, "utf-8");
305
+ // Fix __inherit__ imports in feature content if it's a JS/TS file
306
+ if (isJavaScriptFile(featureFilePath)) {
307
+ featureContent = fixInheritImportPaths(featureContent);
308
+ }
309
+ // Prepend feature content to target content
310
+ const newContent = featureContent + "\n" + targetContent;
311
+ // Check if content would actually change
312
+ if (targetContent === newContent) {
313
+ logger.info(`Skipped ${relativeTargetPath} (content unchanged after prepend)`);
314
+ return;
315
+ }
316
+ writeFileSync(targetFilePath, newContent, "utf-8");
317
+ logger.success(`Prepended to ${relativeTargetPath}`);
318
+ }
319
+ /**
320
+ * Append content from a feature file to the end of a target file
321
+ *
322
+ * @param featureFilePath - Full path to the feature file with content to append
323
+ * @param targetFilePath - Full path to the target file to append to
324
+ * @param relativeTargetPath - Relative path for logging (e.g. "src/styles/global.css")
325
+ */
326
+ export async function appendToFile(featureFilePath, targetFilePath, relativeTargetPath) {
327
+ if (!existsSync(featureFilePath)) {
328
+ throw new FileOperationError(`Patch file not found: ${featureFilePath}`);
329
+ }
330
+ if (!existsSync(targetFilePath)) {
331
+ throw new FileOperationError(`Target file not found: ${targetFilePath}`);
332
+ }
333
+ // Read both files
334
+ const targetContent = readFileSync(targetFilePath, "utf-8");
335
+ let featureContent = readFileSync(featureFilePath, "utf-8");
336
+ // Fix __inherit__ imports in feature content if it's a JS/TS file
337
+ if (isJavaScriptFile(featureFilePath)) {
338
+ featureContent = fixInheritImportPaths(featureContent);
339
+ }
340
+ // Append feature content to target content
341
+ const newContent = targetContent + "\n" + featureContent;
342
+ // Check if content would actually change
343
+ if (targetContent === newContent) {
344
+ logger.info(`Skipped ${relativeTargetPath} (content unchanged after append)`);
345
+ return;
346
+ }
347
+ writeFileSync(targetFilePath, newContent, "utf-8");
348
+ logger.success(`Appended to ${relativeTargetPath}`);
349
+ }
350
+ //# sourceMappingURL=file-operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-operations.js","sourceRoot":"","sources":["../../src/core/file-operations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACN,YAAY,EACZ,WAAW,EACX,UAAU,EACV,SAAS,EACT,aAAa,EACb,MAAM,EACN,QAAQ,EACR,UAAU,GACV,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,eAAe,GAAG,aAAa,CAAC;AAEtC,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC5C,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IAClC,CAAC;CACD;AAED;;;;;;;;;;GAUG;AACH,SAAS,qBAAqB,CAAC,OAAe;IAC7C,8DAA8D;IAC9D,+CAA+C;IAC/C,+CAA+C;IAC/C,uCAAuC;IACvC,wCAAwC;IAExC,uBAAuB;IACvB,2EAA2E;IAC3E,mCAAmC;IACnC,+CAA+C;IAC/C,qCAAqC;IACrC,oCAAoC;IACpC,0CAA0C;IAE1C,OAAO,OAAO,CAAC,OAAO,CACrB,qEAAqE,EACrE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;QACvC,OAAO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AgB,CAAC,eAAe,CAAC,EAAE,CAAC;QACvC,cAAc,GAAG,qBAAqB,CAAC,cAAc,CAAC,CAAC;IACxD,CAAC;IAED,2CAA2C;IAC3C,MAAM,UAAU,GAAG,aAAa,GAAG,IAAI,GAAG,cAAc,CAAC;IAEzD,yCAAyC;IACzC,IAAI,aAAa,KAAK,UAAU,EAAE,CAAC;QAClC,MAAM,CAAC,IAAI,CAAC,WAAW,kBAAkB,mCAAmC,CAAC,CAAC;QAC9E,OAAO;IACR,CAAC;IAED,aAAa,CAAC,cAAc,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACnD,MAAM,CAAC,OAAO,CAAC,eAAe,kBAAkB,EAAE,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { PackageJsonDependencies } from "../types";
2
+ export declare class PackageJsonMergeError extends Error {
3
+ constructor(message: string);
4
+ }
5
+ /**
6
+ * Build package specs array from dependencies object
7
+ * @param dependencies - Object mapping package names to versions
8
+ * @returns Array of package specs in format "package@version"
9
+ */
10
+ export declare function buildPackageSpecs(dependencies: Record<string, string>): string[];
11
+ /**
12
+ * Merge patch dependencies into package.json without running npm install.
13
+ * The build-dist-app executor handles the actual npm install.
14
+ * @param targetDir - Base directory containing uiBundles/<app-name>, or direct path to UI bundle directory if uiBundleDirPath is provided
15
+ * @param patchDependencies - Dependencies to merge from feature patches
16
+ * @param uiBundleDirPath - Optional direct path to the UI bundle directory
17
+ */
18
+ export declare function mergePackageJson(targetDir: string, patchDependencies: PackageJsonDependencies, uiBundleDirPath?: string): Promise<string[]>;
19
+ //# sourceMappingURL=package-json-merger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-json-merger.d.ts","sourceRoot":"","sources":["../../src/core/package-json-merger.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAIxD,qBAAa,qBAAsB,SAAQ,KAAK;gBACnC,OAAO,EAAE,MAAM;CAI3B;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,EAAE,CAOhF;AAmCD;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACrC,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,uBAAuB,EAC1C,eAAe,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,MAAM,EAAE,CAAC,CAkDnB"}