From fc3221886ed47d83999de102e7d76e82a29c0c0c Mon Sep 17 00:00:00 2001 From: Cristian Dominguez Date: Wed, 17 Jan 2024 19:27:04 -0300 Subject: [PATCH] fix: emit warning if config var is unset --- messages/config.md | 4 ++++ src/org/orgConfigProperties.ts | 2 +- src/org/scratchOrgCreate.ts | 20 +++++++++++++++----- src/org/scratchOrgSettingsGenerator.ts | 10 +++++++++- 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/messages/config.md b/messages/config.md index 1fe9b6a29f..76dceab95f 100644 --- a/messages/config.md +++ b/messages/config.md @@ -151,6 +151,10 @@ A valid repository URL or directory for the custom org metadata templates. A valid repository URL or directory for the custom org metadata templates. +# org-capitalize-record-types + +Whether record types are capitalized on scrach org creation. + # invalidId The given id %s is not a valid 15 or 18 character Salesforce ID. diff --git a/src/org/orgConfigProperties.ts b/src/org/orgConfigProperties.ts index 2b3c9c94fa..2c2a50f672 100644 --- a/src/org/orgConfigProperties.ts +++ b/src/org/orgConfigProperties.ts @@ -57,7 +57,7 @@ export enum OrgConfigProperties { export const ORG_CONFIG_ALLOWED_PROPERTIES = [ { key: OrgConfigProperties.ORG_CAPITALIZE_RECORD_TYPES, - description: messages.getMessage(OrgConfigProperties.ORG_CUSTOM_METADATA_TEMPLATES), + description: messages.getMessage(OrgConfigProperties.ORG_CAPITALIZE_RECORD_TYPES), }, { key: OrgConfigProperties.ORG_CUSTOM_METADATA_TEMPLATES, diff --git a/src/org/scratchOrgCreate.ts b/src/org/scratchOrgCreate.ts index 7e048d3037..05dd52a1ec 100644 --- a/src/org/scratchOrgCreate.ts +++ b/src/org/scratchOrgCreate.ts @@ -4,7 +4,7 @@ * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Duration, toBoolean } from '@salesforce/kit'; +import { Duration } from '@salesforce/kit'; import { ensureString } from '@salesforce/ts-types'; import { Messages } from '../messages'; import { Logger } from '../logger/logger'; @@ -150,7 +150,12 @@ export const scratchOrgResume = async (jobId: string): Promise => { // a project isn't required for org:create } }; + +async function getCapitalizeRecordTypesConfig(): Promise { + const configAgg = await ConfigAggregator.create(); + return configAgg.getInfo('org-capitalize-record-types').value as boolean | undefined; +} diff --git a/src/org/scratchOrgSettingsGenerator.ts b/src/org/scratchOrgSettingsGenerator.ts index 960c1fc045..6b6c012ec4 100644 --- a/src/org/scratchOrgSettingsGenerator.ts +++ b/src/org/scratchOrgSettingsGenerator.ts @@ -16,6 +16,7 @@ import { StatusResult } from '../status/types'; import { PollingClient } from '../status/pollingClient'; import { ZipWriter } from '../util/zipWriter'; import { DirectoryWriter } from '../util/directoryWriter'; +import { Lifecycle } from '../lifecycleEvents'; import { ScratchOrgInfo, ObjectSetting } from './scratchOrgTypes'; import { Org } from './org'; @@ -210,7 +211,14 @@ export default class SettingsGenerator { capitalizeRecordTypes?: boolean; }) { this.logger = Logger.childFromRoot('SettingsGenerator'); - this.capitalizeRecordTypes = options?.capitalizeRecordTypes ?? false; + if (options?.capitalizeRecordTypes === undefined) { + void Lifecycle.getInstance().emitWarning( + 'record types will stop being capitalized by default in a future release.' + ); + this.capitalizeRecordTypes = true; + } else { + this.capitalizeRecordTypes = options.capitalizeRecordTypes; + } // If SFDX_MDAPI_TEMP_DIR is set, copy settings to that dir for people to inspect. const mdApiTmpDir = options?.mdApiTmpDir ?? env.getString('SFDX_MDAPI_TEMP_DIR'); this.shapeDirName = options?.shapeDirName ?? `shape_${Date.now()}`;