Skip to content

Commit

Permalink
fix: fix mpd paths packages (#605)
Browse files Browse the repository at this point in the history
  • Loading branch information
WillieRuemmele committed Jun 20, 2024
1 parent ab32cbf commit 5da4c9f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/package/packageCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { Connection, SfError, SfProject } from '@salesforce/core';
import { env } from '@salesforce/kit';
import { PackagePackageDir, PackageDir } from '@salesforce/schemas';
import { isPackagingDirectory } from '@salesforce/core/project';
import * as pkgUtils from '../utils/packageUtils';
import { applyErrorAction, massageErrorMessage } from '../utils/packageUtils';
import { PackageCreateOptions, PackagingSObjects } from '../interfaces';
Expand Down Expand Up @@ -40,14 +41,16 @@ export function createPackageRequestFromContext(project: SfProject, options: Pac
export function createPackageDirEntry(project: SfProject, options: PackageCreateOptions): PackagePackageDir {
const packageDirs: PackageDir[] = project.getSfProjectJson().getContents().packageDirectories ?? [];
return {
package: options.name,
versionName: 'ver 0.1',
versionNumber: '0.1.0.NEXT',
...(packageDirs.filter((pd: PackageDir) => pd.path === options.path).find((pd) => !('id' in pd)) ?? {
...(packageDirs
.filter((pd: PackageDir) => pd.path === options.path && !isPackagingDirectory(pd))
.find((pd) => !('id' in pd)) ?? {
// no match - create a new one
path: options.path,
default: packageDirs.length === 0 ? true : !packageDirs.some((pd) => pd.default === true),
}),
package: options.name,
versionDescription: options.description,
};
}
Expand Down

0 comments on commit 5da4c9f

Please sign in to comment.