|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
17 | | -import { Connection, Messages } from '@salesforce/core'; |
18 | | -import packageJsonImport from '../../package.json' with { type: 'json' }; |
19 | | - |
20 | | -Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); |
21 | | -const messages = Messages.loadMessages('@salesforce/plugin-lightning-dev', 'shared.utils'); |
22 | | - |
23 | | -type PackageJsonWithApiVersionMetadata = { |
24 | | - apiVersionMetadata?: Record<string, unknown>; |
25 | | -}; |
| 17 | +import { Connection } from '@salesforce/core'; |
26 | 18 |
|
27 | 19 | type LightningPreviewMetadataResponse = { |
28 | 20 | enableLightningPreviewPref?: string; |
@@ -133,27 +125,4 @@ export class OrgUtils { |
133 | 125 | } |
134 | 126 | throw new Error('Could not save the app server identity token to the org.'); |
135 | 127 | } |
136 | | - |
137 | | - /** |
138 | | - * Ensures the org's API version is supported by this plugin (per apiVersionMetadata in package.json). |
139 | | - * |
140 | | - * @param connection the connection to the org |
141 | | - */ |
142 | | - public static ensureMatchingAPIVersion(connection: Connection): void { |
143 | | - if (process.env.SKIP_API_VERSION_CHECK === 'true') { |
144 | | - return; |
145 | | - } |
146 | | - const pkg = packageJsonImport as unknown as PackageJsonWithApiVersionMetadata; |
147 | | - const metadata = pkg.apiVersionMetadata; |
148 | | - if (!metadata) { |
149 | | - return; |
150 | | - } |
151 | | - const supportedVersions = Object.keys(metadata).sort(); |
152 | | - const orgVersion = String(connection.version ?? ''); |
153 | | - if (!orgVersion || supportedVersions.includes(orgVersion)) { |
154 | | - return; |
155 | | - } |
156 | | - const supportedList = supportedVersions.join(', '); |
157 | | - throw new Error(messages.getMessage('error.org.api-unsupported', [orgVersion, supportedList])); |
158 | | - } |
159 | 128 | } |
0 commit comments