Skip to content

Commit

Permalink
fix(scratch): respect apiVersion config value (#656)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristiand391 authored Sep 23, 2022
1 parent f60b43e commit 1a29482
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/org/scratchOrgCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ensureString } from '@salesforce/ts-types';
import { Messages } from '../messages';
import { Logger } from '../logger';
import { ConfigAggregator } from '../config/configAggregator';
import { OrgConfigProperties } from '../org/orgConfigProperties';
import { SfProject } from '../sfProject';
import { StateAggregator } from '../stateAggregator';
import { Org } from './org';
Expand Down Expand Up @@ -152,6 +153,8 @@ export const scratchOrgResume = async (jobId: string): Promise<ScratchOrgCreateR

const scratchOrg = await Org.create({ aliasOrUsername: username });

const configAggregator = await ConfigAggregator.create();

await emit({ stage: 'deploy settings', scratchOrgInfo: soi });
const settingsGenerator = new SettingsGenerator();
settingsGenerator.extract({ ...soi, ...definitionjson });
Expand All @@ -161,7 +164,7 @@ export const scratchOrgResume = async (jobId: string): Promise<ScratchOrgCreateR
scratchOrg,
settingsGenerator,
apiVersion ??
(new ConfigAggregator().getPropertyValue('apiVersion') as string) ??
configAggregator.getPropertyValue(OrgConfigProperties.ORG_API_VERSION) ??
(await scratchOrg.retrieveMaxApiVersion())
),
]);
Expand Down Expand Up @@ -283,13 +286,15 @@ export const scratchOrgCreate = async (options: ScratchOrgCreateOptions): Promis

await emit({ stage: 'deploy settings', scratchOrgInfo: soi });

const configAggregator = await ConfigAggregator.create();

const [authInfo] = await Promise.all([
resolveUrl(scratchOrgAuthInfo),
deploySettings(
scratchOrg,
settingsGenerator,
apiversion ??
(new ConfigAggregator().getPropertyValue('org-api-version') as string) ??
configAggregator.getPropertyValue(OrgConfigProperties.ORG_API_VERSION) ??
(await scratchOrg.retrieveMaxApiVersion())
),
]);
Expand Down

0 comments on commit 1a29482

Please sign in to comment.