Skip to content

Commit

Permalink
Merge pull request #441 from forcedotcom/devScripts2023-11-05
Browse files Browse the repository at this point in the history
refactor: devScripts update
  • Loading branch information
svc-cli-bot authored Nov 7, 2023
2 parents 46bd0c4 + b4b6b15 commit 76b670e
Show file tree
Hide file tree
Showing 6 changed files with 175 additions and 312 deletions.
24 changes: 2 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,34 +57,14 @@
},
"devDependencies": {
"@salesforce/cli-plugins-testkit": "^4.4.12",
"@salesforce/dev-config": "^4.1.0",
"@salesforce/dev-scripts": "^5.12.2",
"@salesforce/prettier-config": "^0.0.3",
"@salesforce/dev-scripts": "^6.0.3",
"@salesforce/ts-sinon": "^1.4.19",
"@types/globby": "^9.1.0",
"@types/jszip": "^3.4.1",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"chai": "^4.3.10",
"eslint": "^8.53.0",
"eslint-config-prettier": "^8.10.0",
"eslint-config-salesforce": "^2.0.2",
"eslint-config-salesforce-license": "^0.2.0",
"eslint-config-salesforce-typescript": "^2.0.0",
"eslint-plugin-header": "3.1.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsdoc": "^46.8.2",
"eslint-plugin-sf-plugin": "^1.16.13",
"husky": "^8.0.3",
"mocha": "^10.2.0",
"nyc": "^15.1.0",
"prettier": "^2.8.8",
"pretty-quick": "^3.1.3",
"shelljs": "0.8.5",
"sinon": "14.0.2",
"ts-node": "^10.9.1",
"typescript": "^5.2.2",
"wireit": "^0.14.1"
"typescript": "^5.2.2"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions src/package/packageVersionCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/package/packageVersionCreateRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ' +
Expand Down Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/package/subscriberPackageVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions test/package/packageTest.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(';')}`);
}
});
Expand Down Expand Up @@ -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(';')}`);
}
});
Expand Down
Loading

0 comments on commit 76b670e

Please sign in to comment.