Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: devScripts update #441

Merged
merged 2 commits into from
Nov 7, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: linter changes for enums
  • Loading branch information
mshanemc committed Nov 6, 2023
commit b4b6b1511d0950fbffea6c0ce05dd36605c7f97b
4 changes: 2 additions & 2 deletions src/package/packageVersionCreate.ts
Original file line number Diff line number Diff line change
@@ -715,12 +715,12 @@ export class PackageVersionCreate {
private async validateOptionsForPackageType(): Promise<void> {
if ((await this.getPackageType()) === 'Unlocked') {
// Don't allow scripts in unlocked packages
if (this.options.postinstallscript || this.options.uninstallscript) {
if (Boolean(this.options.postinstallscript) || this.options.uninstallscript) {
throw messages.createError('errorScriptsNotApplicableToUnlockedPackage');
}

// Don't allow ancestor in unlocked packages
if (this.packageObject.ancestorId || this.packageObject.ancestorVersion) {
if (Boolean(this.packageObject.ancestorId) || this.packageObject.ancestorVersion) {
throw messages.createError('errorAncestorNotApplicableToUnlockedPackage');
}
}
3 changes: 1 addition & 2 deletions src/package/packageVersionCreateRequest.ts
Original file line number Diff line number Diff line change
@@ -19,7 +19,6 @@ import Package2VersionCreateRequestError = PackagingSObjects.Package2VersionCrea
Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/packaging', 'package_version_create');

const STATUS_ERROR = 'Error';
const QUERY =
'SELECT Id, Status, Package2Id, Package2VersionId, Package2Version.SubscriberPackageVersionId, Tag, Branch, ' +
'CreatedDate, Package2Version.HasMetadataRemoved, CreatedById, IsConversionRequest, Package2Version.ConvertedFromVersionId ' +
@@ -54,7 +53,7 @@ export async function byId(
connection: Connection
): Promise<PackageVersionCreateRequestResult[]> {
const results = await query(util.format(QUERY, `WHERE Id = '${packageVersionCreateRequestId}' `), connection);
if (results && results.length === 1 && results[0].Status === STATUS_ERROR) {
if (results && results.length === 1 && results[0].Status === PackagingSObjects.Package2VersionStatus.error) {
results[0].Error = await queryForErrors(packageVersionCreateRequestId, connection);
}

2 changes: 1 addition & 1 deletion src/package/subscriberPackageVersion.ts
Original file line number Diff line number Diff line change
@@ -351,7 +351,7 @@ export class SubscriberPackageVersion {
public async getData(
options: { force?: boolean; includeHighCostFields?: boolean } = { force: false, includeHighCostFields: false }
): Promise<PackagingSObjects.SubscriberPackageVersion | undefined> {
if (!this.data || options.force || options.includeHighCostFields) {
if (!this.data || Boolean(options.force) || options.includeHighCostFields) {
const queryFields = this.getFieldsForQuery(options);
if (queryFields.length === 0) {
return this.data;
4 changes: 2 additions & 2 deletions test/package/packageTest.nut.ts
Original file line number Diff line number Diff line change
@@ -201,7 +201,7 @@ describe('Integration tests for @salesforce/packaging library', () => {
const result = await PackageVersion.getCreateStatus(pkgCreateVersionRequestId, devHubOrg.getConnection());
expect(result).to.include.keys(VERSION_CREATE_RESPONSE_KEYS);

if (result.Status === 'Error') {
if (result.Status === PackagingSObjects.Package2VersionStatus.error) {
throw new Error(`pv.getCreateVersionReport failed with status Error: ${result.Error.join(';')}`);
}
});
@@ -236,7 +236,7 @@ describe('Integration tests for @salesforce/packaging library', () => {

subscriberPkgVersionId = result.SubscriberPackageVersionId ?? '';

if (result.Status === 'Error') {
if (result.Status === PackagingSObjects.Package2VersionStatus.error) {
throw new Error(`pv.waitForCreateVersion failed with status Error: ${result.Error.join(';')}`);
}
});