@salesforce/webapps-features-experimental 1.68.0

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 (52) hide show
  1. package/LICENSE.txt +82 -0
  2. package/README.md +154 -0
  3. package/dist/conflict-detector.d.ts +31 -0
  4. package/dist/conflict-detector.d.ts.map +1 -0
  5. package/dist/conflict-detector.js +153 -0
  6. package/dist/conflict-detector.js.map +1 -0
  7. package/dist/dependency-resolver.d.ts +18 -0
  8. package/dist/dependency-resolver.d.ts.map +1 -0
  9. package/dist/dependency-resolver.js +90 -0
  10. package/dist/dependency-resolver.js.map +1 -0
  11. package/dist/feature-metadata.d.ts +35 -0
  12. package/dist/feature-metadata.d.ts.map +1 -0
  13. package/dist/feature-metadata.js +140 -0
  14. package/dist/feature-metadata.js.map +1 -0
  15. package/dist/feature-search.d.ts +11 -0
  16. package/dist/feature-search.d.ts.map +1 -0
  17. package/dist/feature-search.js +121 -0
  18. package/dist/feature-search.js.map +1 -0
  19. package/dist/features.json +336 -0
  20. package/dist/file-copier.d.ts +15 -0
  21. package/dist/file-copier.d.ts.map +1 -0
  22. package/dist/file-copier.js +105 -0
  23. package/dist/file-copier.js.map +1 -0
  24. package/dist/install-feature.d.ts +8 -0
  25. package/dist/install-feature.d.ts.map +1 -0
  26. package/dist/install-feature.js +563 -0
  27. package/dist/install-feature.js.map +1 -0
  28. package/dist/logger.d.ts +48 -0
  29. package/dist/logger.d.ts.map +1 -0
  30. package/dist/logger.js +82 -0
  31. package/dist/logger.js.map +1 -0
  32. package/dist/package-manager.d.ts +22 -0
  33. package/dist/package-manager.d.ts.map +1 -0
  34. package/dist/package-manager.js +172 -0
  35. package/dist/package-manager.js.map +1 -0
  36. package/dist/placeholder-resolver.d.ts +25 -0
  37. package/dist/placeholder-resolver.d.ts.map +1 -0
  38. package/dist/placeholder-resolver.js +78 -0
  39. package/dist/placeholder-resolver.js.map +1 -0
  40. package/dist/schema-loader.d.ts +17 -0
  41. package/dist/schema-loader.d.ts.map +1 -0
  42. package/dist/schema-loader.js +82 -0
  43. package/dist/schema-loader.js.map +1 -0
  44. package/dist/types.d.ts +146 -0
  45. package/dist/types.d.ts.map +1 -0
  46. package/dist/types.js +7 -0
  47. package/dist/types.js.map +1 -0
  48. package/dist/utils.d.ts +30 -0
  49. package/dist/utils.d.ts.map +1 -0
  50. package/dist/utils.js +58 -0
  51. package/dist/utils.js.map +1 -0
  52. package/package.json +53 -0
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+ import type { Logger } from "./logger.js";
7
+ /**
8
+ * Schema structure from features.json files
9
+ */
10
+ export interface FileCopySchema {
11
+ /** Other features that must be installed first */
12
+ featureDependencies?: string[];
13
+ /** npm packages to add to dependencies */
14
+ packageDependencies?: Record<string, string>;
15
+ /** npm packages to add to devDependencies */
16
+ packageDevDependencies?: Record<string, string>;
17
+ /** File/directory copy operations */
18
+ copy?: CopyOperation[];
19
+ }
20
+ /**
21
+ * A single copy operation
22
+ */
23
+ export interface CopyOperation {
24
+ /** Source path relative to package's dist/ directory */
25
+ from: string;
26
+ /** Destination path (may contain <webapp> placeholder) */
27
+ to: string;
28
+ /** Optional description of what this copies */
29
+ description?: string;
30
+ /** For __example__ files: the target file where patterns should be integrated */
31
+ integrationTarget?: string;
32
+ }
33
+ /**
34
+ * Conflict handling mode
35
+ */
36
+ export type ConflictMode = "prompt" | "error" | "skip" | "overwrite";
37
+ /**
38
+ * User's choice for handling a specific conflict
39
+ */
40
+ export type ConflictResolution = "skip" | "overwrite" | "cancel";
41
+ /**
42
+ * Map of file paths to conflict resolutions
43
+ */
44
+ export type ConflictResolutionMap = Record<string, ConflictResolution>;
45
+ /**
46
+ * Shared context for installation operations
47
+ */
48
+ export interface InstallationContext {
49
+ /** SFDX metadata root directory (e.g., force-app/main/default) */
50
+ sfdxRoot: string;
51
+ /** Specific webapp directory (e.g., force-app/main/default/webapplications/mywebapp) */
52
+ webappDir: string;
53
+ /** Webapp name extracted from webappDir (e.g., "mywebapp") */
54
+ webappName: string;
55
+ /** Enable verbose logging */
56
+ verbose: boolean;
57
+ /** Dry run mode - show what would be done without changes */
58
+ dryRun: boolean;
59
+ /** Conflict handling mode */
60
+ conflictMode: ConflictMode;
61
+ /** Conflict resolution map (from file or interactive prompts) */
62
+ conflictResolutions: ConflictResolutionMap;
63
+ /** Track installed features to prevent duplicates */
64
+ installedFeatures: Set<string>;
65
+ /** Track all copied example files with their integration targets */
66
+ copiedExampleFiles: {
67
+ file: string;
68
+ integrationTarget?: string;
69
+ }[];
70
+ /** Logger instance (verbose-aware) */
71
+ logger: Logger;
72
+ }
73
+ /**
74
+ * Feature registry entry
75
+ */
76
+ export interface FeatureDefinition {
77
+ /** Display name for the feature */
78
+ name: string;
79
+ /** npm package name */
80
+ package: string;
81
+ /** Optional description */
82
+ description?: string;
83
+ }
84
+ /**
85
+ * Feature registry mapping feature names to packages
86
+ */
87
+ export type FeatureRegistry = Record<string, string>;
88
+ /**
89
+ * Detailed feature metadata
90
+ */
91
+ export interface FeatureMetadata {
92
+ /** Display name */
93
+ name: string;
94
+ /** npm package name */
95
+ package: string;
96
+ /** Short description (1-2 sentences) */
97
+ shortDescription: string;
98
+ /** Long description (detailed explanation) */
99
+ longDescription: string;
100
+ /** Search keywords */
101
+ keywords: string[];
102
+ /** Feature dependencies */
103
+ featureDependencies?: string[];
104
+ /** Package dependencies */
105
+ packageDependencies?: Record<string, string>;
106
+ /** Package dev dependencies */
107
+ packageDevDependencies?: Record<string, string>;
108
+ /** Copy operations (includes __example__ files with integrationTarget) */
109
+ copy?: CopyOperation[];
110
+ /** List of feature capabilities */
111
+ features?: string[];
112
+ /** List of included components */
113
+ components?: string[];
114
+ /** Status (for features pending schema implementation) */
115
+ status?: "schema-pending" | "ready";
116
+ }
117
+ /**
118
+ * Features metadata collection
119
+ */
120
+ export interface FeaturesMetadata {
121
+ features: Record<string, FeatureMetadata>;
122
+ }
123
+ /**
124
+ * Search result with scoring information
125
+ */
126
+ export interface SearchResult {
127
+ /** The feature that matched the search */
128
+ feature: FeatureMetadata;
129
+ /** Relevance score (higher = more relevant) */
130
+ score: number;
131
+ /** Fields that matched the search terms (for debugging) */
132
+ matchedFields: string[];
133
+ }
134
+ /**
135
+ * CLI options
136
+ */
137
+ export interface CliOptions {
138
+ sfdxRoot?: string;
139
+ webappDir?: string;
140
+ verbose?: boolean;
141
+ dryRun?: boolean;
142
+ yes?: boolean;
143
+ onConflict?: ConflictMode;
144
+ conflictResolution?: string;
145
+ }
146
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,kDAAkD;IAClD,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE/B,0CAA0C;IAC1C,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE7C,6CAA6C;IAC7C,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhD,qCAAqC;IACrC,IAAI,CAAC,EAAE,aAAa,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IAEb,0DAA0D;IAC1D,EAAE,EAAE,MAAM,CAAC;IAEX,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,iFAAiF;IACjF,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,WAAW,CAAC;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ce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+ /**
7
+ * Check if a path exists
8
+ */
9
+ export declare function pathExists(path: string): boolean;
10
+ /**
11
+ * Resolve an absolute path from a potentially relative path
12
+ */
13
+ export declare function resolvePath(path: string, base?: string): string;
14
+ /**
15
+ * Extract webapp name from webapp directory path
16
+ */
17
+ export declare function extractWebappName(webappDir: string): string;
18
+ /**
19
+ * Check if a path points to SFDX metadata (Apex classes, objects, etc.)
20
+ */
21
+ export declare function isSfdxMetadataPath(path: string): boolean;
22
+ /**
23
+ * Check if a path contains the webapp placeholder
24
+ */
25
+ export declare function hasWebappPlaceholder(path: string): boolean;
26
+ /**
27
+ * Normalize path separators to forward slashes
28
+ */
29
+ export declare function normalizePath(path: string): string;
30
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAK/D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAcxD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD"}
package/dist/utils.js ADDED
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+ import { existsSync } from "fs";
7
+ import { basename, resolve } from "path";
8
+ /**
9
+ * Check if a path exists
10
+ */
11
+ export function pathExists(path) {
12
+ return existsSync(path);
13
+ }
14
+ /**
15
+ * Resolve an absolute path from a potentially relative path
16
+ */
17
+ export function resolvePath(path, base) {
18
+ if (base) {
19
+ return resolve(base, path);
20
+ }
21
+ return resolve(path);
22
+ }
23
+ /**
24
+ * Extract webapp name from webapp directory path
25
+ */
26
+ export function extractWebappName(webappDir) {
27
+ return basename(webappDir);
28
+ }
29
+ /**
30
+ * Check if a path points to SFDX metadata (Apex classes, objects, etc.)
31
+ */
32
+ export function isSfdxMetadataPath(path) {
33
+ const sfdxPatterns = [
34
+ "force-app/main/default/classes",
35
+ "force-app/main/default/objects",
36
+ "force-app/main/default/triggers",
37
+ "force-app/main/default/lwc",
38
+ "force-app/main/default/aura",
39
+ "force-app/main/default/staticresources",
40
+ "force-app/main/default/layouts",
41
+ "force-app/main/default/permissionsets",
42
+ "force-app/main/default/profiles",
43
+ ];
44
+ return sfdxPatterns.some((pattern) => path.startsWith(pattern));
45
+ }
46
+ /**
47
+ * Check if a path contains the webapp placeholder
48
+ */
49
+ export function hasWebappPlaceholder(path) {
50
+ return path.includes("<webapp>");
51
+ }
52
+ /**
53
+ * Normalize path separators to forward slashes
54
+ */
55
+ export function normalizePath(path) {
56
+ return path.replace(/\\/g, "/");
57
+ }
58
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEzC;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACtC,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,IAAa;IACtD,IAAI,IAAI,EAAE,CAAC;QACV,OAAO,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAiB;IAClD,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC;AAC5B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC9C,MAAM,YAAY,GAAG;QACpB,gCAAgC;QAChC,gCAAgC;QAChC,iCAAiC;QACjC,4BAA4B;QAC5B,6BAA6B;QAC7B,wCAAwC;QACxC,gCAAgC;QAChC,uCAAuC;QACvC,iCAAiC;KACjC,CAAC;IAEF,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAChD,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY;IACzC,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@salesforce/webapps-features-experimental",
3
+ "version": "1.68.0",
4
+ "description": "CLI tool for searching and installing UI features into Salesforce webapps",
5
+ "license": "SEE LICENSE IN LICENSE.txt",
6
+ "type": "module",
7
+ "main": "./dist/install-feature.js",
8
+ "bin": {
9
+ "webapps-features-experimental": "./dist/install-feature.js"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "README.md"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc --build && cp src/features.json dist/features.json",
17
+ "clean": "rm -rf dist tsconfig.tsbuildinfo",
18
+ "dev": "tsx src/install-feature.ts",
19
+ "prepublishOnly": "npm run build",
20
+ "test": "vitest run",
21
+ "test:watch": "vitest",
22
+ "test:unit": "vitest run unit",
23
+ "test:e2e": "vitest run e2e",
24
+ "test:coverage": "vitest run --coverage"
25
+ },
26
+ "keywords": [
27
+ "salesforce",
28
+ "ui",
29
+ "features",
30
+ "cli",
31
+ "installer"
32
+ ],
33
+ "dependencies": {
34
+ "commander": "^13.0.0",
35
+ "inquirer": "^12.0.0",
36
+ "ora": "^9.3.0",
37
+ "zod": "^3.24.1"
38
+ },
39
+ "devDependencies": {
40
+ "@types/inquirer": "^9.0.9",
41
+ "@types/node": "^22.0.0",
42
+ "@vitest/coverage-v8": "^4.0.17",
43
+ "tsx": "^4.19.2",
44
+ "typescript": "~5.9.3",
45
+ "vitest": "^4.0.17"
46
+ },
47
+ "engines": {
48
+ "node": ">=20.0.0"
49
+ },
50
+ "publishConfig": {
51
+ "access": "public"
52
+ }
53
+ }