From 66083f7154a4b9da8f351375150e2c2c5b494bdc Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 18 Jun 2024 09:40:56 -0500 Subject: [PATCH] feat!: remove exports, major version migration doc BREAKING CHANGES: remove re-export of PackageDir/PackageDirDependency --- MIGRATING_V7-V8.md | 15 +++++++++++++++ src/index.ts | 2 +- src/sfProject.ts | 12 +----------- 3 files changed, 17 insertions(+), 12 deletions(-) create mode 100644 MIGRATING_V7-V8.md diff --git a/MIGRATING_V7-V8.md b/MIGRATING_V7-V8.md new file mode 100644 index 000000000..a8bcf8f6e --- /dev/null +++ b/MIGRATING_V7-V8.md @@ -0,0 +1,15 @@ +# Migrating `@salesforce/core` from v7 to v8 + +v8 uses the types from `@salesforce/schemas`, for SfProject/SfProjectJson. + +The schemas types are more accurate about the PackageDir type (what `sfdx-project.json` packageDirectories is an array of). It is a union type of + +1. simply `path`, with an optional default property +1. 1, along with the `package` property and lots of optional properties used for packaging. + +To support differentiating between the two structures, 2 type guards are now importable: + +1. isPackagingDirectory +1. isNamedPackagingDirectory + +`PackageDir` and `PackageDirDependency` are no longer re-exported. If you need them, import them from `@salesforce/schemas` diff --git a/src/index.ts b/src/index.ts index 894339693..8fe85ebd6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -75,7 +75,7 @@ export { export { OrgConfigProperties, ORG_CONFIG_ALLOWED_PROPERTIES } from './org/orgConfigProperties'; -export { PackageDir, NamedPackageDir, PackageDirDependency, SfProject, SfProjectJson } from './sfProject'; +export { NamedPackageDir, SfProject, SfProjectJson } from './sfProject'; export { SchemaValidator } from './schema/validator'; diff --git a/src/sfProject.ts b/src/sfProject.ts index afc5a604d..0c1631a14 100644 --- a/src/sfProject.ts +++ b/src/sfProject.ts @@ -8,12 +8,7 @@ import { basename, dirname, isAbsolute, normalize, resolve, sep } from 'node:pat import * as fs from 'node:fs'; import { defaults, env } from '@salesforce/kit'; import { Dictionary, ensure, JsonMap, Nullable, Optional } from '@salesforce/ts-types'; -import { - PackageDir as PackageDirSchema, - PackageDirDependency as PackageDirDependencySchema, - ProjectJson as ProjectJsonSchema, - PackagePackageDir, -} from '@salesforce/schemas'; +import { PackageDir, ProjectJson as ProjectJsonSchema, PackagePackageDir } from '@salesforce/schemas'; import { SfdcUrl } from './util/sfdcUrl'; import { ConfigAggregator } from './config/configAggregator'; import { ConfigFile } from './config/configFile'; @@ -29,9 +24,6 @@ import { ensureNoUppercaseKeys } from './util/findUppercaseKeys'; Messages.importMessagesDirectory(__dirname); const messages = Messages.loadMessages('@salesforce/core', 'config'); -/** @deprecated. Use PackageDirDependency from @salesforce/schemas */ -export type PackageDirDependency = PackageDirDependencySchema; - type NamedDirAdditions = { /** * The [normalized](https://nodejs.org/api/path.html#path_path_normalize_path) path used as the package name. @@ -43,8 +35,6 @@ type NamedDirAdditions = { fullPath: string; }; -/** @deprecated. Use PackageDir from @salesforce/schemas */ -export type PackageDir = PackageDirSchema; export type NamedPackagingDir = PackagePackageDir & NamedDirAdditions; export type NamedPackageDir = PackageDir & NamedDirAdditions;