Skip to content

Commit 5de2822

Browse files
committed
fix: resolve dependency conflicts and pin Node.js/Yarn versions
- Pin Node.js 20.11.0 and Yarn 1.22.22 using volta - Add resolutions to force single @salesforce/core version (^8.15.0) - Update all dependencies to latest compatible versions - Regenerate yarn.lock with resolved dependencies - Fix TypeScript compilation errors caused by version conflicts - All 56 tests passing - Build successful
2 parents bf820fd + 92a0c28 commit 5de2822

File tree

18 files changed

+2049
-1596
lines changed

18 files changed

+2049
-1596
lines changed

.husky/check-versions.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
import fs from 'node:fs';
2+
import semver from 'semver';
23

34
// Read package.json
45
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
56

67
// Extract versions
78
const devServerDependencyVersion = packageJson.dependencies['@lwc/lwc-dev-server'];
8-
const devServerTargetVersion = packageJson.apiVersionMetadata?.target?.matchingDevServerVersion;
9+
const devServerTargetVersionRange = packageJson.apiVersionMetadata?.target?.matchingDevServerVersion;
910

10-
if (!devServerDependencyVersion || !devServerTargetVersion) {
11+
if (!devServerDependencyVersion || !devServerTargetVersionRange) {
1112
console.error('Error: missing @lwc/lwc-dev-server or matchingDevServerVersion');
1213
process.exit(1); // Fail the check
1314
}
1415

1516
// Compare versions
16-
if (devServerDependencyVersion === devServerTargetVersion) {
17+
if (semver.intersects(devServerTargetVersionRange, devServerDependencyVersion)) {
1718
process.exit(0); // Pass the check
1819
} else {
1920
console.error(
20-
`Error: @lwc/lwc-dev-server versions do not match between 'dependencies' and 'apiVersionMetadata' in package.json. Expected ${devServerDependencyVersion} in apiVersionMetadata > target > matchingDevServerVersion. Got ${devServerTargetVersion} instead. When updating the @lwc/lwc-dev-server dependency, you must ensure that it is compatible with the supported API version in this branch, then update apiVersionMetadata > target > matchingDevServerVersion to match, in order to "sign off" on this dependency change.`
21+
`Error: @lwc/lwc-dev-server versions do not match between 'dependencies' and 'apiVersionMetadata' in package.json. Expected ${devServerDependencyVersion} in apiVersionMetadata > target > matchingDevServerVersion. Got ${devServerTargetVersionRange} instead. When updating the @lwc/lwc-dev-server dependency, you must ensure that it is compatible with the supported API version in this branch, then update apiVersionMetadata > target > matchingDevServerVersion to match, in order to "sign off" on this dependency change.`
2122
);
2223
process.exit(1); // Fail the check
2324
}

CHANGELOG.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,57 @@
1+
# [4.3.0](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.2.0...4.3.0) (2025-07-11)
2+
3+
### Features
4+
5+
- move component preview to org ([#447](https://github.com/salesforcecli/plugin-lightning-dev/issues/447)) ([2d9fb17](https://github.com/salesforcecli/plugin-lightning-dev/commit/2d9fb17e09a5fb68356e688335180e36d3a4f1dc))
6+
7+
# [4.2.0](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.1.7...4.2.0) (2025-07-11)
8+
9+
### Features
10+
11+
- launch site preview @W-18283821 ([#449](https://github.com/salesforcecli/plugin-lightning-dev/issues/449)) ([b8a8844](https://github.com/salesforcecli/plugin-lightning-dev/commit/b8a884405214e79d6d7186d89b658bee447a7cd7))
12+
13+
## [4.1.7](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.1.6...4.1.7) (2025-07-09)
14+
15+
### Bug Fixes
16+
17+
- bump LWC to 13.0.29 @W-18283826 ([#448](https://github.com/salesforcecli/plugin-lightning-dev/issues/448)) ([e40b7fc](https://github.com/salesforcecli/plugin-lightning-dev/commit/e40b7fcdf33ecd1e6f89240eb9e44f568afba6e9))
18+
19+
## [4.1.6](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.1.5...4.1.6) (2025-07-08)
20+
21+
### Bug Fixes
22+
23+
- bump LWC @W-18283826 ([#446](https://github.com/salesforcecli/plugin-lightning-dev/issues/446)) ([d161c35](https://github.com/salesforcecli/plugin-lightning-dev/commit/d161c351842926b12c472ab8d5e5c73219360958))
24+
25+
## [4.1.5](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.1.4...4.1.5) (2025-07-07)
26+
27+
### Bug Fixes
28+
29+
- eccn compliance ([#441](https://github.com/salesforcecli/plugin-lightning-dev/issues/441)) ([3c8dd4b](https://github.com/salesforcecli/plugin-lightning-dev/commit/3c8dd4b5baffaa5569d6fab6f98483842ddd0acc))
30+
31+
## [4.1.4](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.1.3...4.1.4) (2025-07-06)
32+
33+
### Bug Fixes
34+
35+
- **deps:** bump @oclif/core from 4.4.0 to 4.4.1 ([#442](https://github.com/salesforcecli/plugin-lightning-dev/issues/442)) ([08a1b88](https://github.com/salesforcecli/plugin-lightning-dev/commit/08a1b8892c0ca10e6e8c1bb0e32f28342ab72e9f))
36+
37+
## [4.1.3](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.1.2...4.1.3) (2025-07-06)
38+
39+
### Bug Fixes
40+
41+
- **deps:** bump lwc from 8.20.0 to 8.20.1 ([#444](https://github.com/salesforcecli/plugin-lightning-dev/issues/444)) ([4d9624f](https://github.com/salesforcecli/plugin-lightning-dev/commit/4d9624fb4a9b764cbb5a195c30c6ac2b6ec5f6df))
42+
43+
## [4.1.2](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.1.1...4.1.2) (2025-06-29)
44+
45+
### Bug Fixes
46+
47+
- **deps:** bump axios from 1.8.2 to 1.10.0 ([#437](https://github.com/salesforcecli/plugin-lightning-dev/issues/437)) ([571499d](https://github.com/salesforcecli/plugin-lightning-dev/commit/571499d0f9901049b045450d8003d3ec9bf58dd3))
48+
49+
## [4.1.1](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.1.0...4.1.1) (2025-06-29)
50+
51+
### Bug Fixes
52+
53+
- **deps:** bump @salesforce/core from 8.14.0 to 8.15.0 ([#438](https://github.com/salesforcecli/plugin-lightning-dev/issues/438)) ([ca23095](https://github.com/salesforcecli/plugin-lightning-dev/commit/ca23095e4214c29d12d4521433db16310050c41c))
54+
155
# [4.1.0](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.0.5...4.1.0) (2025-06-27)
256

357
### Features

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Comment line immediately above ownership line is reserved for related other information. Please be careful while editing.
22

3-
#GUSINFO: Web Application Runtime, Lightning Web Runtime (Container)
3+
#GUSINFO: Web Application Runtime, LWR CLI and Local Development
44
* @salesforcecli/lwr @salesforcecli/lex @salesforcecli/mobile-platform-experience

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,20 +201,21 @@ EXAMPLES
201201
$ sf lightning dev app --target-org myOrg --device-type ios --device-id "iPhone 15 Pro Max"
202202
```
203203

204-
_See code: [src/commands/lightning/dev/app.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/4.1.0/src/commands/lightning/dev/app.ts)_
204+
_See code: [src/commands/lightning/dev/app.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/4.3.0/src/commands/lightning/dev/app.ts)_
205205

206206
## `sf lightning dev component`
207207

208208
[Beta] Preview LWC components in isolation.
209209

210210
```
211211
USAGE
212-
$ sf lightning dev component [--json] [--flags-dir <value>] [-n <value>] [-c] [-o <value>]
212+
$ sf lightning dev component -o <value> [--json] [--flags-dir <value>] [-n <value>] [-c]
213213
214214
FLAGS
215215
-c, --client-select Launch component preview without selecting a component
216216
-n, --name=<value> Name of a component to preview.
217-
-o, --target-org=<value> Username or alias of the target org.
217+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
218+
configuration variable is already set.
218219
219220
GLOBAL FLAGS
220221
--flags-dir=<value> Import flag values from a directory.
@@ -247,15 +248,15 @@ EXAMPLES
247248
$ sf lightning dev component --name myComponent
248249
```
249250

250-
_See code: [src/commands/lightning/dev/component.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/4.1.0/src/commands/lightning/dev/component.ts)_
251+
_See code: [src/commands/lightning/dev/component.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/4.3.0/src/commands/lightning/dev/component.ts)_
251252

252253
## `sf lightning dev site`
253254

254255
[Beta] Preview an Experience Builder site locally and in real-time, without deploying it.
255256

256257
```
257258
USAGE
258-
$ sf lightning dev site -o <value> [--flags-dir <value>] [-n <value>] [-l] [--guest]
259+
$ sf lightning dev site -o <value> [--flags-dir <value>] [-n <value>] [-l] [--guest] [--ssr]
259260
260261
FLAGS
261262
-l, --get-latest Download the latest version of the specified site from your org, instead of using any local
@@ -265,6 +266,7 @@ FLAGS
265266
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
266267
configuration variable is already set.
267268
--guest Preview the site as a guest user (rather than an authenticated user).
269+
--ssr Preview the SSR bundle
268270
269271
GLOBAL FLAGS
270272
--flags-dir=<value> Import flag values from a directory.
@@ -302,7 +304,7 @@ EXAMPLES
302304
$ sf lightning dev site --name "Partner Central" --target-org myOrg --get-latest
303305
```
304306

305-
_See code: [src/commands/lightning/dev/site.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/4.1.0/src/commands/lightning/dev/site.ts)_
307+
_See code: [src/commands/lightning/dev/site.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/4.3.0/src/commands/lightning/dev/site.ts)_
306308

307309
## Integration Testing
308310

command-snapshot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"command": "lightning:dev:site",
2121
"flagAliases": [],
2222
"flagChars": ["l", "n", "o"],
23-
"flags": ["flags-dir", "get-latest", "guest", "name", "target-org"],
23+
"flags": ["flags-dir", "get-latest", "guest", "name", "target-org", "ssr"],
2424
"plugin": "@salesforce/plugin-lightning-dev"
2525
}
2626
]

messages/lightning.dev.app.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,6 @@ Type of device to display the app preview.
3131

3232
ID of the mobile device to display the preview if device type is set to `ios` or `android`. The default value is the ID of the first available mobile device.
3333

34-
# error.username
35-
36-
Org must have a valid user
37-
38-
# error.identitydata
39-
40-
Couldn't find identity data while generating preview arguments
41-
42-
# error.identitydata.entityid
43-
44-
Couldn't find entity ID while generating preview arguments
45-
46-
# error.no-project
47-
48-
This command is required to run from within a Salesforce project directory. %s
49-
5034
# error.fetching.app-id
5135

5236
Unable to determine App Id for %s

messages/lightning.dev.site.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ Download the latest version of the specified site from your org, instead of usin
2929

3030
Preview the site as a guest user (rather than an authenticated user).
3131

32+
# flags.ssr.summary
33+
34+
Preview the SSR bundle
35+
3236
# examples
3337

3438
- Select a site to preview from the org "myOrg":

messages/shared.utils.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,19 @@ Your org is on API version %s, but this version of the CLI plugin supports API v
3737
# error.org.api-mismatch.remediation
3838

3939
To use the plugin with this org, you can reinstall or update the plugin using the "%s" tag. For example: "sf plugins install %s".
40+
41+
# error.username
42+
43+
Org must have a valid user
44+
45+
# error.identitydata
46+
47+
Couldn't find identity data while generating preview arguments
48+
49+
# error.identitydata.entityid
50+
51+
Couldn't find entity ID while generating preview arguments
52+
53+
# error.no-project
54+
55+
This command is required to run from within a Salesforce project directory. %s

package.json

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
{
22
"name": "@salesforce/plugin-lightning-dev",
33
"description": "Lightning development tools for LEX, Mobile, and Experience Sites",
4-
"version": "4.1.0",
4+
"version": "4.3.0",
55
"author": "Salesforce",
66
"bugs": "https://github.com/forcedotcom/cli/issues",
77
"dependencies": {
88
"@inquirer/prompts": "^5.3.8",
99
"@inquirer/select": "^2.4.7",
10-
"@lwc/lwc-dev-server": "~12.3.4",
11-
"@lwc/sfdc-lwc-compiler": "~12.3.4",
10+
"@lwc/lwc-dev-server": "~13.0.29",
11+
"@lwc/sfdc-lwc-compiler": "~13.0.29",
1212
"@lwrjs/api": "0.18.3",
13-
"@oclif/core": "^4.4.0",
14-
"@salesforce/core": "^8.12.0",
13+
"@oclif/core": "^4.4.1",
14+
"@salesforce/core": "^8.15.0",
1515
"@salesforce/kit": "^3.1.6",
1616
"@salesforce/lwc-dev-mobile-core": "4.0.0-alpha.10",
1717
"@salesforce/sf-plugins-core": "^11.2.4",
18-
"axios": "^1.8.2",
18+
"axios": "^1.10.0",
1919
"glob": "^10.4.5",
2020
"lightning-base-components": "1.27.2-alpha",
21-
"lwc": "~8.20.0",
21+
"lwc": "~8.20.1",
2222
"node-fetch": "^3.3.2",
23+
"open": "^10.1.0",
2324
"xml2js": "^0.6.2"
2425
},
2526
"devDependencies": {
@@ -38,8 +39,8 @@
3839
"eslint-plugin-jsdoc": "^46.10.1",
3940
"eslint-plugin-sf-plugin": "^1.20.26",
4041
"eslint-plugin-unicorn": "^50.0.1",
41-
"esmock": "^2.7.0",
42-
"oclif": "^4.20.0",
42+
"esmock": "^2.7.1",
43+
"oclif": "^4.20.1",
4344
"ts-node": "^10.9.2",
4445
"typescript": "^5.5.4"
4546
},
@@ -236,7 +237,7 @@
236237
],
237238
"target": {
238239
"versionNumber": "65.0",
239-
"matchingDevServerVersion": "~12.3.4"
240+
"matchingDevServerVersion": "~13.0.27"
240241
},
241242
"versionToTagMappings": [
242243
{
@@ -262,5 +263,8 @@
262263
"volta": {
263264
"node": "20.11.0",
264265
"yarn": "1.22.22"
266+
},
267+
"resolutions": {
268+
"@salesforce/core": "^8.15.0"
265269
}
266270
}

src/commands/lightning/dev/app.ts

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
Platform,
1818
} from '@salesforce/lwc-dev-mobile-core';
1919
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
20-
import { OrgUtils } from '../../../shared/orgUtils.js';
2120
import { startLWCServer } from '../../../lwc-dev-server/index.js';
2221
import { PreviewUtils } from '../../../shared/previewUtils.js';
2322
import { PromptUtils } from '../../../shared/promptUtils.js';
@@ -74,32 +73,14 @@ export default class LightningDevApp extends SfCommand<void> {
7473
try {
7574
sfdxProjectRootPath = await SfProject.resolveProjectPath();
7675
} catch (error) {
77-
return Promise.reject(new Error(messages.getMessage('error.no-project', [(error as Error)?.message ?? ''])));
76+
throw new Error(sharedMessages.getMessage('error.no-project', [(error as Error)?.message ?? '']));
7877
}
7978

80-
const connection = targetOrg.getConnection(undefined);
81-
const username = connection.getUsername();
82-
if (!username) {
83-
return Promise.reject(new Error(messages.getMessage('error.username')));
84-
}
85-
86-
const localDevEnabled = await OrgUtils.isLocalDevEnabled(connection);
87-
if (!localDevEnabled) {
88-
return Promise.reject(new Error(sharedMessages.getMessage('error.localdev.not.enabled')));
89-
}
90-
91-
OrgUtils.ensureMatchingAPIVersion(connection);
79+
logger.debug('Initalizing preview connection and configuring local web server identity');
80+
const { connection, ldpServerId, ldpServerToken } = await PreviewUtils.initializePreviewConnection(targetOrg);
9281

9382
const platform = flags['device-type'] ?? (await PromptUtils.promptUserToSelectPlatform());
9483

95-
logger.debug('Configuring local web server identity');
96-
const appServerIdentity = await PreviewUtils.getOrCreateAppServerIdentity(connection);
97-
const ldpServerToken = appServerIdentity.identityToken;
98-
const ldpServerId = appServerIdentity.usernameToServerEntityIdMap[username];
99-
if (!ldpServerId) {
100-
return Promise.reject(new Error(messages.getMessage('error.identitydata.entityid')));
101-
}
102-
10384
const appId = await PreviewUtils.getLightningExperienceAppId(connection, appName, logger);
10485

10586
logger.debug('Determining the next available port for Local Dev Server');
@@ -149,25 +130,7 @@ export default class LightningDevApp extends SfCommand<void> {
149130
logger.debug('No Lightning Experience application name provided.... using the default app instead.');
150131
}
151132

152-
// There are various ways to pass in a target org (as an alias, as a username, etc).
153-
// We could have LightningPreviewApp parse its --target-org flag which will be resolved
154-
// to an Org object (see https://github.com/forcedotcom/sfdx-core/blob/main/src/org/org.ts)
155-
// then write a bunch of code to look at this Org object to try to determine whether
156-
// it was initialized using Alias, Username, etc. and get a string representation of the
157-
// org to be forwarded to OrgOpenCommand.
158-
//
159-
// Or we could simply look at the raw arguments passed to the LightningPreviewApp command,
160-
// find the raw value for --target-org flag and forward that raw value to OrgOpenCommand.
161-
// The OrgOpenCommand will then parse the raw value automatically. If the value is
162-
// valid then OrgOpenCommand will consume it and continue. And if the value is invalid then
163-
// OrgOpenCommand simply throws an error which will get bubbled up to LightningPreviewApp.
164-
//
165-
// Here we've chosen the second approach
166-
const idx = this.argv.findIndex((item) => item.toLowerCase() === '-o' || item.toLowerCase() === '--target-org');
167-
let targetOrg: string | undefined;
168-
if (idx >= 0 && idx < this.argv.length - 1) {
169-
targetOrg = this.argv[idx + 1];
170-
}
133+
const targetOrg = PreviewUtils.getTargetOrgFromArguments(this.argv);
171134

172135
if (ldpServerUrl.startsWith('wss')) {
173136
this.log(`\n${messages.getMessage('trust.local.dev.server')}`);

0 commit comments

Comments
 (0)