feat: use the right LWC/Dev server version for the org @W-20405334@#596
Conversation
|
@abdulsattar I setup a quick call for us to review this PR today - I just want to ensure things are working as expected. Let me know if that time works |
abdulsattar
left a comment
There was a problem hiding this comment.
Nick and Brian review.
| "dependencies": { | ||
| "@lwc/lwc-dev-server": "~13.2.x", | ||
| "@lwc/sfdc-lwc-compiler": "~13.2.x", | ||
| "lwc": "~8.23.x" |
There was a problem hiding this comment.
Do we need 'lwc'?
There was a problem hiding this comment.
Check the bundle size.
|
|
||
| # flags.version-channel.summary | ||
|
|
||
| Manually specify which version channel to use (latest, prerelease, or next). |
There was a problem hiding this comment.
Nick: SFDX already has the api version command. Use that instead of version-channel.
There was a problem hiding this comment.
Verify how @lwc/compiler in peerDependencies in lwc-dev-server work.
There was a problem hiding this comment.
Nick: Create a new package that imports lwc-dev-server and @lwc/compiler to fix the peerDependencies.
| #!/bin/sh | ||
| . "$(dirname "$0")/_/husky.sh" | ||
|
|
||
| # Run the custom version check script |
There was a problem hiding this comment.
We need a test to prevent dependabot from updating dependencies beyond the approved range of each version.
There was a problem hiding this comment.
Verify if dependabot acutaly updates aliases.
There was a problem hiding this comment.
Document api versioning with wlc-dev-server. if (version === "262") { }
There was a problem hiding this comment.
The CLI updates to the latest plugin always. Change teh frequency if it's too often and the bundle size too big.
There was a problem hiding this comment.
Nick: reduce the bundle size instead.
| // | ||
| // Your org is on API version 63.0, but this version of the CLI plugin supports API version 62.0. To use the plugin with this org, you can reinstall or update the plugin using the "latest" tag. For example: "sf plugins install @salesforce/plugin-lightning-dev@latest". | ||
| // Priority 3: Skip check for testing (legacy compatibility) | ||
| if (process.env.SKIP_API_VERSION_CHECK === 'true') { |
…ding - Added aliased dependencies for @lwc/lwc-dev-server, @lwc/sfdc-lwc-compiler, and lwc - Implemented DependencyLoader for dynamic runtime branching based on org API version - Removed 'version channel' concept in favor of direct API version mapping - Updated CLI commands to pass org connection for version detection - Added .husky/check-versions.js to ensure dependency/metadata alignment - Cleaned up unused VersionResolver and type utilities
| "extends": "@salesforce/dev-config/tsconfig-strict-esm", | ||
| "compilerOptions": { | ||
| "module": "nodenext", | ||
| "moduleResolution": "nodenext", |
There was a problem hiding this comment.
what did you need this for?
There was a problem hiding this comment.
Because we're reading package.json like so:
import packageJsonImport from '../../package.json' with { type: 'json' };
Without that we get this error in typescript:
src/shared/dependencyLoader.ts:18:52 - error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'.
| @@ -0,0 +1,1103 @@ | |||
| # Design Proposal: Dual Version Support via NPM Aliasing | |||
There was a problem hiding this comment.
Not sure we need to include this file.
| "@lwc/sfdc-lwc-compiler": "~13.3.8", | ||
| "@lwc/sfdx-local-dev-dist": "~13.3.16-alpha.0", | ||
| "@lwc/sfdx-local-dev-dist-66.0": "npm:@lwc/sfdx-local-dev-dist@~13.2.22", | ||
| "@lwc/sfdx-local-dev-dist-67.0": "npm:@lwc/sfdx-local-dev-dist@~13.3.16-alpha.0", |
There was a problem hiding this comment.
| "@lwc/sfdx-local-dev-dist-67.0": "npm:@lwc/sfdx-local-dev-dist@~13.3.16-alpha.0", | |
| "@lwc/sfdx-local-dev-dist-67.0": "npm:@lwc/sfdx-local-dev-dist@~13.3.16", |
| "target": { | ||
| "versionNumber": "67.0", | ||
| "matchingDevServerVersion": "~13.3.8" | ||
| "66.0": { |
There was a problem hiding this comment.
Can we include 258 "v65" also?
| "@inquirer/select": "^2.4.7", | ||
| "@lwc/lwc-dev-server": "~13.3.8", | ||
| "@lwc/sfdc-lwc-compiler": "~13.3.8", | ||
| "@lwc/sfdx-local-dev-dist": "~13.3.16-alpha.0", |
There was a problem hiding this comment.
Is this needed? I assume we'd just want @lwc/sfdx-local-dev-dist-65 here
| "skipLibCheck": true, | ||
| "resolveJsonModule": true, | ||
| "module": "nodenext", | ||
| "moduleResolution": "nodenext" |
There was a problem hiding this comment.
again just curious about nodenext here
|
|
||
| // Type declarations for @lwc/sfdx-local-dev-dist aliases | ||
| // The main package @lwc/sfdx-local-dev-dist provides its own type definitions | ||
| declare module '@lwc/sfdx-local-dev-dist-65.0' { |
There was a problem hiding this comment.
we didn't include this yet in current pr?
|
|
||
| import { expect } from 'chai'; | ||
| import { Workspace } from '@lwc/lwc-dev-server'; | ||
| import { Workspace } from '@lwc/sfdx-local-dev-dist'; |
There was a problem hiding this comment.
is this package just for test? If so it should be a dev dependency
| testIdentityData.usernameToServerEntityIdMap[testUsername] = testLdpServerId; | ||
|
|
||
| beforeEach(async () => { | ||
| process.env.SKIP_API_VERSION_CHECK = 'true'; |
There was a problem hiding this comment.
Do we need this in tests anymore?
| uses: salesforcecli/github-workflows/.github/workflows/unitTestsLinux.yml@main | ||
| with: | ||
| skipTsDepCheck: true | ||
| skipTsDepCheck: false |
There was a problem hiding this comment.
re-enables typescript check in CI. Latest changes have made this work: https://github.com/salesforcecli/plugin-lightning-dev/actions/runs/21450379396/job/61777346502 🥳
| @@ -1,24 +1,66 @@ | |||
| import fs from 'node:fs'; | |||
| import semver from 'semver'; | |||
|
|
|||
There was a problem hiding this comment.
Lets make sure this runs as part of a git workflow that blocks PR delivery
nrkruk
left a comment
There was a problem hiding this comment.
🥇 Amazing. Great job - thank you!
| } | ||
|
|
||
| private async mobilePreview( | ||
| org: Org, |
There was a problem hiding this comment.
pass the connection here instead of the org
| await startLWCServer(logger, sfdxProjectRootPath, ldpServerToken, Platform.desktop, serverPorts); | ||
| await startLWCServer( | ||
| logger, | ||
| org.getConnection(undefined), |
There was a problem hiding this comment.
we don't want to do this. We should be using const connection = targetOrg.getConnection(apiVersion);
You can always pass the connection from run() -> (line 93)
What does this PR do?
Implements Phase 1 of https://github.com/salesforcecli/plugin-lightning-dev/blob/nkruk/single-install-design/DUAL_VERSION_DESIGN.md
What issues does this PR fix or reference?
@W-20405334@