@salesforce/core
Advanced tools
Comparing version 7.3.11 to 7.3.12-qa.0
@@ -56,2 +56,3 @@ "use strict"; | ||
const packagesWithAncestors = (await projectJson.getPackageDirectories()) | ||
.filter(sfProject_1.isPackagingDirectory) | ||
// check that the package has any ancestor types (id or version) | ||
@@ -58,0 +59,0 @@ .filter((packageDir) => packageDir.ancestorId ?? packageDir.ancestorVersion); |
import { Dictionary, JsonMap, Nullable, Optional } from '@salesforce/ts-types'; | ||
import { PackageDir as PackageDirSchema, PackageDirDependency as PackageDirDependencySchema, ProjectJson as ProjectJsonSchema, PackagePackageDir } from '@salesforce/schemas'; | ||
import { ConfigFile } from './config/configFile'; | ||
import { ConfigContents } from './config/configStackTypes'; | ||
export type PackageDirDependency = { | ||
[k: string]: unknown; | ||
package: string; | ||
versionNumber?: string; | ||
}; | ||
export type PackageDir = { | ||
ancestorId?: string; | ||
ancestorVersion?: string; | ||
default?: boolean; | ||
definitionFile?: string; | ||
dependencies?: PackageDirDependency[]; | ||
includeProfileUserLicenses?: boolean; | ||
package?: string; | ||
packageMetadataAccess?: { | ||
permissionSets: string | string[]; | ||
permissionSetLicenses: string | string[]; | ||
}; | ||
path: string; | ||
postInstallScript?: string; | ||
postInstallUrl?: string; | ||
releaseNotesUrl?: string; | ||
scopeProfiles?: boolean; | ||
uninstallScript?: string; | ||
versionDescription?: string; | ||
versionName?: string; | ||
versionNumber?: string; | ||
unpackagedMetadata?: { | ||
path: string; | ||
}; | ||
seedMetadata?: { | ||
path: string; | ||
}; | ||
}; | ||
export type NamedPackageDir = PackageDir & { | ||
export type PackageDirDependency = PackageDirDependencySchema; | ||
type NamedDirAdditions = { | ||
/** | ||
@@ -47,16 +16,6 @@ * The [normalized](https://nodejs.org/api/path.html#path_path_normalize_path) path used as the package name. | ||
}; | ||
export type ProjectJson = ConfigContents & { | ||
packageDirectories: PackageDir[]; | ||
namespace?: string; | ||
sourceApiVersion?: string; | ||
sfdcLoginUrl?: string; | ||
signupTargetLoginUrl?: string; | ||
oauthLocalPort?: number; | ||
plugins?: { | ||
[k: string]: unknown; | ||
}; | ||
packageAliases?: { | ||
[k: string]: string; | ||
}; | ||
}; | ||
export type PackageDir = PackageDirSchema; | ||
export type NamedPackagingDir = PackagePackageDir & NamedDirAdditions; | ||
export type NamedPackageDir = PackageDir & NamedDirAdditions; | ||
export type ProjectJson = ConfigContents & ProjectJsonSchema; | ||
/** | ||
@@ -362,1 +321,5 @@ * The sfdx-project.json config object. This file determines if a folder is a valid sfdx project. | ||
} | ||
/** differentiate between the Base PackageDir (path, maybe default) and the Packaging version (package and maybe a LOT of other fields) by whether is has the `package` property */ | ||
export declare const isPackagingDirectory: (packageDir: PackageDir) => packageDir is PackagePackageDir; | ||
export declare const isNamedPackagingDirectory: (packageDir: NamedPackageDir) => packageDir is NamedPackagingDir; | ||
export {}; |
@@ -26,3 +26,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SfProject = exports.SfProjectJson = void 0; | ||
exports.isNamedPackagingDirectory = exports.isPackagingDirectory = exports.SfProject = exports.SfProjectJson = void 0; | ||
/* | ||
@@ -286,12 +286,3 @@ * Copyright (c) 2020, salesforce.com, inc. | ||
addPackageDirectory(packageDir) { | ||
// there is no notion of uniqueness in package directory entries | ||
// so an attempt of matching an existing entry is a bit convoluted | ||
// an entry w/o a package or id is considered a directory entry for which a package has yet to be created | ||
// so first attempt is to find a matching dir entry that where path is the same and id and package are not present | ||
// if that fails, then find a matching dir entry package is present and is same as the new entry | ||
const dirIndex = this.getContents().packageDirectories.findIndex((pd) => { | ||
const withId = pd; | ||
return ((withId.path === packageDir.path && !withId.id && !withId.package) || | ||
(!!packageDir.package && packageDir.package === withId.package)); | ||
}); | ||
const dirIndex = this.getContents().packageDirectories.findIndex(findPackageDir(packageDir)); | ||
// merge new package dir with existing entry, if present | ||
@@ -306,2 +297,3 @@ const packageDirEntry = Object.assign({}, dirIndex > -1 ? this.getContents().packageDirectories[dirIndex] : packageDir, packageDir); | ||
} | ||
// keep it because testSetup stubs it! | ||
// eslint-disable-next-line class-methods-use-this | ||
@@ -526,3 +518,5 @@ doesPackageExist(packagePath) { | ||
const packageDir = this.getPackageFromPath(path); | ||
return packageDir ? packageDir.package ?? packageDir.path : undefined; | ||
if (!packageDir) | ||
return undefined; | ||
return (0, exports.isNamedPackagingDirectory)(packageDir) ? packageDir.package : packageDir.path; | ||
} | ||
@@ -671,2 +665,17 @@ /** | ||
exports.SfProject = SfProject; | ||
/** differentiate between the Base PackageDir (path, maybe default) and the Packaging version (package and maybe a LOT of other fields) by whether is has the `package` property */ | ||
const isPackagingDirectory = (packageDir) => 'package' in packageDir && typeof packageDir.package === 'string'; | ||
exports.isPackagingDirectory = isPackagingDirectory; | ||
const isNamedPackagingDirectory = (packageDir) => 'package' in packageDir && typeof packageDir.package === 'string'; | ||
exports.isNamedPackagingDirectory = isNamedPackagingDirectory; | ||
/** | ||
* there is no notion of uniqueness in package directory entries | ||
* so an attempt of matching an existing entry is a bit convoluted | ||
*/ | ||
const findPackageDir = (target) => (potentialMatch) => | ||
// an entry w/o a package or id is considered a directory entry for which a package has yet to be created | ||
// find a matching dir entry that where path is the same and id and package are not present | ||
(potentialMatch.path === target.path && !('id' in potentialMatch) && !(0, exports.isPackagingDirectory)(potentialMatch)) || | ||
// if that fails, then find a matching dir entry package is present and is same as the new entry | ||
((0, exports.isPackagingDirectory)(target) && (0, exports.isPackagingDirectory)(potentialMatch) && target.package === potentialMatch.package); | ||
//# sourceMappingURL=sfProject.js.map |
{ | ||
"name": "@salesforce/core", | ||
"version": "7.3.11", | ||
"version": "7.3.12-qa.0", | ||
"description": "Core libraries to interact with SFDX projects, orgs, and APIs.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1035683
22037
2