Skip to content

Commit 1ebfe92

Browse files
committed
Merge remote-tracking branch 'origin/main' into abdulsattar/dual-version
2 parents c58238c + 7783c3d commit 1ebfe92

18 files changed

Lines changed: 3967 additions & 2906 deletions

File tree

CHANGELOG.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,57 @@
1+
# [6.1.0](https://github.com/salesforcecli/plugin-lightning-dev/compare/6.0.9...6.1.0) (2026-01-28)
2+
3+
### Features
4+
5+
- prompt to enable local dev @W-20406426 [#595](https://github.com/salesforcecli/plugin-lightning-dev/issues/595) ([#597](https://github.com/salesforcecli/plugin-lightning-dev/issues/597)) ([a653742](https://github.com/salesforcecli/plugin-lightning-dev/commit/a653742c8864fa3cfe73dff1cdc39de594163684))
6+
7+
## [6.0.9](https://github.com/salesforcecli/plugin-lightning-dev/compare/6.0.8...6.0.9) (2026-01-25)
8+
9+
### Bug Fixes
10+
11+
- **deps:** bump the lwc-packages group with 3 updates ([#604](https://github.com/salesforcecli/plugin-lightning-dev/issues/604)) ([00ec369](https://github.com/salesforcecli/plugin-lightning-dev/commit/00ec369fb1cf4fa9f73637e28dc44e3584b12c15))
12+
13+
## [6.0.8](https://github.com/salesforcecli/plugin-lightning-dev/compare/6.0.7...6.0.8) (2026-01-25)
14+
15+
### Bug Fixes
16+
17+
- **deps:** bump @salesforce/core from 8.24.3 to 8.25.0 ([#605](https://github.com/salesforcecli/plugin-lightning-dev/issues/605)) ([d02eaeb](https://github.com/salesforcecli/plugin-lightning-dev/commit/d02eaebc189366302a78dc36d06ddf78d3efa1fd))
18+
19+
## [6.0.7](https://github.com/salesforcecli/plugin-lightning-dev/compare/6.0.6...6.0.7) (2026-01-25)
20+
21+
### Bug Fixes
22+
23+
- **deps:** bump @lwrjs/api from 0.21.4 to 0.21.5 ([#606](https://github.com/salesforcecli/plugin-lightning-dev/issues/606)) ([02237da](https://github.com/salesforcecli/plugin-lightning-dev/commit/02237da03567c9ebc59517d8bdcf4d822fafd207))
24+
25+
## [6.0.6](https://github.com/salesforcecli/plugin-lightning-dev/compare/6.0.5...6.0.6) (2026-01-23)
26+
27+
### Bug Fixes
28+
29+
- **deps:** bump lodash from 4.17.21 to 4.17.23 ([#603](https://github.com/salesforcecli/plugin-lightning-dev/issues/603)) ([8c249f3](https://github.com/salesforcecli/plugin-lightning-dev/commit/8c249f3cb0de287b7d87d330e60441cf8089be5c))
30+
31+
## [6.0.5](https://github.com/salesforcecli/plugin-lightning-dev/compare/6.0.4...6.0.5) (2026-01-18)
32+
33+
### Bug Fixes
34+
35+
- **deps:** bump the lwc-packages group with 3 updates ([#599](https://github.com/salesforcecli/plugin-lightning-dev/issues/599)) ([93715b9](https://github.com/salesforcecli/plugin-lightning-dev/commit/93715b9b927f7cec07094e725bd1f75c5421a9a4))
36+
37+
## [6.0.4](https://github.com/salesforcecli/plugin-lightning-dev/compare/6.0.3...6.0.4) (2026-01-18)
38+
39+
### Bug Fixes
40+
41+
- **deps:** bump @lwrjs/api from 0.18.3 to 0.21.4 ([#600](https://github.com/salesforcecli/plugin-lightning-dev/issues/600)) ([e355c75](https://github.com/salesforcecli/plugin-lightning-dev/commit/e355c751681f35f2d1e9ecae8c555ed0d61d5f63))
42+
43+
## [6.0.3](https://github.com/salesforcecli/plugin-lightning-dev/compare/6.0.2...6.0.3) (2026-01-18)
44+
45+
### Bug Fixes
46+
47+
- **deps:** bump @salesforce/core from 8.24.0 to 8.24.3 ([#601](https://github.com/salesforcecli/plugin-lightning-dev/issues/601)) ([ee11b80](https://github.com/salesforcecli/plugin-lightning-dev/commit/ee11b8060e760850be260e829825664373bd08ae))
48+
49+
## [6.0.2](https://github.com/salesforcecli/plugin-lightning-dev/compare/6.0.1...6.0.2) (2026-01-15)
50+
51+
### Bug Fixes
52+
53+
- **deps:** bump undici from 6.21.2 to 6.23.0 ([#598](https://github.com/salesforcecli/plugin-lightning-dev/issues/598)) ([d08a87d](https://github.com/salesforcecli/plugin-lightning-dev/commit/d08a87daad7f516c70398fdb50a8fb27b34aa75c))
54+
155
## [6.0.1](https://github.com/salesforcecli/plugin-lightning-dev/compare/6.0.0...6.0.1) (2026-01-10)
256

357
### Bug Fixes

README.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ Preview a Lightning Experience app locally and in real-time, without deploying i
150150
```
151151
USAGE
152152
$ sf lightning dev app -o <value> [--flags-dir <value>] [-n <value>] [-t desktop|ios|android] [-i <value>]
153+
[--api-version <value>]
153154
154155
FLAGS
155156
-i, --device-id=<value> ID of the mobile device to display the preview if device type is set to `ios` or
@@ -159,6 +160,7 @@ FLAGS
159160
configuration variable is already set.
160161
-t, --device-type=<option> Type of device to display the app preview.
161162
<options: desktop|ios|android>
163+
--api-version=<value> Override the api version used for api requests made by this command
162164
163165
GLOBAL FLAGS
164166
--flags-dir=<value> Import flag values from a directory.
@@ -201,7 +203,7 @@ EXAMPLES
201203
$ sf lightning dev app --target-org myOrg --device-type ios --device-id "iPhone 15 Pro Max"
202204
```
203205

204-
_See code: [src/commands/lightning/dev/app.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/6.0.2-canary.1/src/commands/lightning/dev/app.ts)_
206+
_See code: [src/commands/lightning/dev/app.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/6.1.0/src/commands/lightning/dev/app.ts)_
205207

206208
## `sf lightning dev component`
207209

@@ -249,25 +251,26 @@ EXAMPLES
249251
$ sf lightning dev component --name myComponent
250252
```
251253

252-
_See code: [src/commands/lightning/dev/component.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/6.0.2-canary.1/src/commands/lightning/dev/component.ts)_
254+
_See code: [src/commands/lightning/dev/component.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/6.1.0/src/commands/lightning/dev/component.ts)_
253255

254256
## `sf lightning dev site`
255257

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

258260
```
259261
USAGE
260-
$ sf lightning dev site -o <value> [--flags-dir <value>] [-n <value>] [-l] [--guest] [--ssr]
262+
$ sf lightning dev site -o <value> [--flags-dir <value>] [-n <value>] [-l] [--guest] [--ssr] [--api-version <value>]
261263
262264
FLAGS
263-
-l, --get-latest Download the latest version of the specified site from your org, instead of using any local
264-
cache.
265-
-n, --name=<value> Name of the Experience Builder site to preview. It has to match a site name from the current
266-
org.
267-
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
268-
configuration variable is already set.
269-
--guest Preview the site as a guest user (rather than an authenticated user).
270-
--ssr Preview the SSR bundle
265+
-l, --get-latest Download the latest version of the specified site from your org, instead of using any local
266+
cache.
267+
-n, --name=<value> Name of the Experience Builder site to preview. It has to match a site name from the
268+
current org.
269+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
270+
configuration variable is already set.
271+
--api-version=<value> Override the api version used for api requests made by this command
272+
--guest Preview the site as a guest user (rather than an authenticated user).
273+
--ssr Preview the SSR bundle
271274
272275
GLOBAL FLAGS
273276
--flags-dir=<value> Import flag values from a directory.
@@ -305,6 +308,6 @@ EXAMPLES
305308
$ sf lightning dev site --name "Partner Central" --target-org myOrg --get-latest
306309
```
307310

308-
_See code: [src/commands/lightning/dev/site.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/6.0.2-canary.1/src/commands/lightning/dev/site.ts)_
311+
_See code: [src/commands/lightning/dev/site.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/6.1.0/src/commands/lightning/dev/site.ts)_
309312

310313
<!-- commandsstop -->

command-snapshot.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"command": "lightning:dev:app",
55
"flagAliases": [],
66
"flagChars": ["i", "n", "o", "t"],
7-
"flags": ["device-id", "device-type", "flags-dir", "name", "target-org"],
7+
"flags": ["api-version", "device-id", "device-type", "flags-dir", "name", "target-org"],
88
"plugin": "@salesforce/plugin-lightning-dev"
99
},
1010
{
@@ -20,7 +20,7 @@
2020
"command": "lightning:dev:site",
2121
"flagAliases": [],
2222
"flagChars": ["l", "n", "o"],
23-
"flags": ["flags-dir", "get-latest", "guest", "name", "ssr", "target-org"],
23+
"flags": ["api-version", "flags-dir", "get-latest", "guest", "name", "ssr", "target-org"],
2424
"plugin": "@salesforce/plugin-lightning-dev"
2525
}
2626
]

messages/prompts.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,7 @@ Unable to enumerate a list of available devices.
3737
# component.select
3838

3939
Which Lightning Web Component would you like to preview (Use arrow keys)
40+
41+
# component.enable-local-dev
42+
43+
Local Dev isn't enabled for this org. Enable it?

messages/shared.utils.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ The SSL certificate data to be used by the local dev server for secure connectio
2626

2727
You must provide valid SSL certificate data
2828

29+
# localdev.enabled
30+
31+
Local dev has been enabled for this org.
32+
2933
# error.localdev.not.enabled
3034

3135
Local Dev is not enabled for your org. See https://developer.salesforce.com/docs/platform/lwc/guide/get-started-test-components.html for more information on enabling and using Local Dev.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111
"@lwc/sfdx-local-dev-dist-65.0": "npm:@lwc/sfdx-local-dev-dist@~13.1.7",
1212
"@lwc/sfdx-local-dev-dist-66.0": "npm:@lwc/sfdx-local-dev-dist@~13.2.22",
1313
"@lwc/sfdx-local-dev-dist-67.0": "npm:@lwc/sfdx-local-dev-dist@~13.3.18",
14-
"@lwrjs/api": "0.18.3",
14+
"@lwrjs/api": "0.21.5",
1515
"@oclif/core": "^4.5.6",
16-
"@salesforce/core": "^8.24.0",
16+
"@salesforce/core": "^8.25.0",
1717
"@salesforce/kit": "^3.2.4",
1818
"@salesforce/lwc-dev-mobile-core": "4.0.0-alpha.14",
1919
"@salesforce/sf-plugins-core": "^11.2.4",
2020
"axios": "^1.13.2",
2121
"glob": "^13.0.0",
22+
"lwc": "~8.28.2",
2223
"node-fetch": "^3.3.2",
2324
"open": "^10.2.0",
2425
"xml2js": "^0.6.2"
@@ -39,7 +40,7 @@
3940
"eslint-plugin-sf-plugin": "^1.20.33",
4041
"eslint-plugin-unicorn": "^50.0.1",
4142
"esmock": "^2.7.3",
42-
"oclif": "^4.22.63",
43+
"oclif": "^4.22.68",
4344
"ts-node": "^10.9.2",
4445
"typescript": "^5.5.4"
4546
},

src/commands/lightning/dev/app.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export default class LightningDevApp extends SfCommand<void> {
6969
summary: messages.getMessage('flags.device-id.summary'),
7070
char: 'i',
7171
}),
72+
'api-version': Flags.orgApiVersion(),
7273
};
7374

7475
public async run(): Promise<void> {
@@ -78,16 +79,7 @@ export default class LightningDevApp extends SfCommand<void> {
7879
const targetOrg = flags['target-org'];
7980
const appName = flags['name'];
8081
const deviceId = flags['device-id'];
81-
82-
// Auto enable local dev
83-
if (process.env.AUTO_ENABLE_LOCAL_DEV === 'true') {
84-
try {
85-
await MetaUtils.ensureLightningPreviewEnabled(targetOrg.getConnection(undefined));
86-
await MetaUtils.ensureFirstPartyCookiesNotRequired(targetOrg.getConnection(undefined));
87-
} catch (error) {
88-
this.log('Error autoenabling local dev', error);
89-
}
90-
}
82+
const apiVersion = flags['api-version'];
9183

9284
let sfdxProjectRootPath = '';
9385
try {
@@ -97,7 +89,14 @@ export default class LightningDevApp extends SfCommand<void> {
9789
}
9890

9991
logger.debug('Initalizing preview connection and configuring local web server identity');
100-
const { connection, ldpServerId, ldpServerToken } = await PreviewUtils.initializePreviewConnection(targetOrg);
92+
93+
const connection = targetOrg.getConnection(apiVersion);
94+
95+
if (await MetaUtils.handleLocalDevEnablement(connection)) {
96+
this.log(sharedMessages.getMessage('localdev.enabled'));
97+
}
98+
99+
const { ldpServerId, ldpServerToken } = await PreviewUtils.initializePreviewConnection(connection);
101100

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

src/commands/lightning/dev/component.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,13 @@ export default class LightningDevComponent extends SfCommand<ComponentPreviewRes
7575
const targetOrg = flags['target-org'];
7676
const apiVersion = flags['api-version'];
7777

78-
// Auto enable local dev
79-
if (process.env.AUTO_ENABLE_LOCAL_DEV === 'true') {
80-
try {
81-
await MetaUtils.ensureLightningPreviewEnabled(targetOrg.getConnection(undefined));
82-
await MetaUtils.ensureFirstPartyCookiesNotRequired(targetOrg.getConnection(undefined));
83-
} catch (error) {
84-
this.log('Error autoenabling local dev', error);
85-
}
78+
const connection = targetOrg.getConnection(apiVersion);
79+
80+
if (await MetaUtils.handleLocalDevEnablement(connection)) {
81+
this.log(sharedMessages.getMessage('localdev.enabled'));
8682
}
8783

88-
const { ldpServerId, ldpServerToken } = await PreviewUtils.initializePreviewConnection(targetOrg);
84+
const { ldpServerId, ldpServerToken } = await PreviewUtils.initializePreviewConnection(connection);
8985

9086
logger.debug('Determining the next available port for Local Dev Server');
9187
const serverPorts = await PreviewUtils.getNextAvailablePorts();
@@ -182,9 +178,6 @@ export default class LightningDevComponent extends SfCommand<ComponentPreviewRes
182178
targetOrgArg,
183179
);
184180

185-
// Construct and log the full URL that will be opened
186-
const connection = targetOrg.getConnection(apiVersion);
187-
188181
// strip trailing slashes
189182
const instanceUrl = connection.instanceUrl.replace(/\/$/, '');
190183

src/commands/lightning/dev/site.ts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { Connection, Logger, Messages, SfProject } from '@salesforce/core';
1919
import { Platform } from '@salesforce/lwc-dev-mobile-core';
2020
import { expDev, SitesLocalDevOptions, setupDev } from '@lwrjs/api';
2121
import open from 'open';
22-
import { OrgUtils } from '../../../shared/orgUtils.js';
2322
import { PromptUtils } from '../../../shared/promptUtils.js';
2423
import { ExperienceSite } from '../../../shared/experience/expSite.js';
2524
import { PreviewUtils } from '../../../shared/previewUtils.js';
@@ -54,6 +53,7 @@ export default class LightningDevSite extends SfCommand<void> {
5453
summary: messages.getMessage('flags.ssr.summary'),
5554
default: false,
5655
}),
56+
'api-version': Flags.orgApiVersion(),
5757
};
5858

5959
public async run(): Promise<void> {
@@ -62,25 +62,15 @@ export default class LightningDevSite extends SfCommand<void> {
6262
try {
6363
const org = flags['target-org'];
6464
const getLatest = flags['get-latest'];
65+
const apiVersion = flags['api-version'];
6566
const guest = flags.guest;
6667
const ssr = flags.ssr;
6768
let siteName = flags.name;
6869

69-
const connection = org.getConnection(undefined);
70+
const connection = org.getConnection(apiVersion);
7071

71-
// Auto enable local dev
72-
if (process.env.AUTO_ENABLE_LOCAL_DEV === 'true') {
73-
try {
74-
await MetaUtils.ensureLightningPreviewEnabled(connection);
75-
await MetaUtils.ensureFirstPartyCookiesNotRequired(connection);
76-
} catch (error) {
77-
this.log('Error autoenabling local dev', error);
78-
}
79-
}
80-
81-
const localDevEnabled = await OrgUtils.isLocalDevEnabled(connection);
82-
if (!localDevEnabled) {
83-
throw new Error(sharedMessages.getMessage('error.localdev.not.enabled'));
72+
if (await MetaUtils.handleLocalDevEnablement(connection)) {
73+
this.log(sharedMessages.getMessage('localdev.enabled'));
8474
}
8575

8676
// If user doesn't specify a site, prompt the user for one

0 commit comments

Comments
 (0)