Skip to content

Commit 4b5df0f

Browse files
committed
fix: stuff
1 parent 4a4346d commit 4b5df0f

5 files changed

Lines changed: 23 additions & 7 deletions

File tree

messages/shared.utils.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ Couldn't find identity data while generating preview arguments
5454

5555
Couldn't find entity ID while generating preview arguments
5656

57+
# error.org.api-unsupported
58+
59+
Your org is on API Version %s. This version of the plugin supports only versions %s. Please update your plugin.
60+
5761
# error.no-project
5862

5963
This command is required to run from within a Salesforce project directory. %s

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@salesforce/plugin-lightning-dev",
33
"description": "Lightning development tools for LEX, Mobile, and Experience Sites",
4-
"version": "6.0.2-canary.1",
4+
"version": "6.1.0",
55
"author": "Salesforce",
66
"bugs": "https://github.com/forcedotcom/cli/issues",
77
"dependencies": {

src/shared/dependencyLoader.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@
1515
*/
1616

1717
import type { Logger } from '@salesforce/core';
18+
import { Messages } from '@salesforce/core';
1819
import packageJsonImport from '../../package.json' with { type: 'json' };
1920

21+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
22+
const sharedMessages = Messages.loadMessages('@salesforce/plugin-lightning-dev', 'shared.utils');
23+
2024
type PackageJson = {
2125
apiVersionMetadata: Record<string, unknown>;
2226
};
@@ -55,7 +59,7 @@ function resolveApiVersion(orgApiVersion: string): string {
5559
return orgApiVersion;
5660
}
5761

58-
throw new Error(`Unsupported org API version: ${orgApiVersion}. This plugin supports: ${getSupportedVersionsList()}`);
62+
throw new Error(sharedMessages.getMessage('error.org.api-unsupported', [orgApiVersion, getSupportedVersionsList()]));
5963
}
6064

6165
/**

test/shared/dependencyLoader.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ describe('DependencyLoader', () => {
2222
expect(typeof loadLwcModule).to.equal('function');
2323
});
2424

25+
it('throws when loading aliased package for unsupported API version (alias does not exist)', async () => {
26+
const unsupportedVersion = '99.0';
27+
try {
28+
await loadLwcModule(unsupportedVersion);
29+
expect.fail('Should have thrown for unsupported API version');
30+
} catch (error) {
31+
const err = error as Error;
32+
expect(err).to.be.an('Error');
33+
expect(err.message).to.include(unsupportedVersion);
34+
expect(err.message).to.include('supports only');
35+
}
36+
});
37+
2538
it('loads the aliased package (real import call)', async () => {
2639
// This will actually try to call import() which should work since we ran yarn install.
2740
// However, loading LWC modules in Node might still trigger ReferenceErrors if browser globals are missing.

test/shared/previewUtils.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,7 @@ describe('previewUtils', () => {
7373
};
7474
testIdentityData.usernameToServerEntityIdMap[testUsername] = testLdpServerId;
7575

76-
beforeEach(() => {
77-
process.env.SKIP_API_VERSION_CHECK = 'true';
78-
});
79-
8076
afterEach(() => {
81-
delete process.env.SKIP_API_VERSION_CHECK;
8277
$$.restore();
8378
});
8479

0 commit comments

Comments
 (0)