Skip to content

Commit

Permalink
fix: add verify flag (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
peternhale authored Jun 29, 2021
1 parent 8efbe84 commit 30b3b6e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions command-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
{
"command": "npm:lerna:release",
"plugin": "@salesforce/plugin-release-management",
"flags": ["dryrun", "githubrelease", "install", "json", "loglevel", "npmaccess", "npmtag", "sign"]
"flags": ["dryrun", "githubrelease", "install", "json", "loglevel", "npmaccess", "npmtag", "sign", "verify"]
},
{
"command": "npm:package:promote",
Expand All @@ -53,7 +53,7 @@
{
"command": "npm:package:release",
"plugin": "@salesforce/plugin-release-management",
"flags": ["dryrun", "install", "json", "loglevel", "npmaccess", "npmtag", "prerelease", "sign"]
"flags": ["dryrun", "install", "json", "loglevel", "npmaccess", "npmtag", "prerelease", "sign", "verify"]
},
{
"command": "npm:release:validate",
Expand Down
1 change: 1 addition & 0 deletions messages/npm.lerna.release.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"npmAccess": "access level to use when publishing to npm",
"install": "run yarn install and build on repository",
"githubRelease": "create release in github based on the package changes",
"verify": "verify npm registry has new version after publish and digital signature",
"InvalidNextVersion": "%s already exists in the public npm registry",
"MissingDependencies": "Missing requred environment variables or utilites",
"InvalidRepoType": "Cannot run this command on a non-monorepo. Use sfdx npm:package:release instead.",
Expand Down
1 change: 1 addition & 0 deletions messages/npm.package.release.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"npmAccess": "access level to use when publishing to npm",
"install": "run yarn install and build on repository",
"prerelease": "determine the next version as <version>-<prerelease>.0 if version is not manually set",
"verify": "verify npm registry has new version after publish and digital signature",
"InvalidNextVersion": "%s already exists in the public npm registry",
"MissingDependencies": "Missing requred environment variables or utilites",
"InvalidRepoType": "Cannot run this command on a monorepo. Use sfdx npm:monorepo:release instead."
Expand Down
9 changes: 7 additions & 2 deletions src/commands/npm/lerna/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ export default class Release extends SfdxCommand {
default: false,
description: messages.getMessage('githubRelease'),
}),
verify: flags.boolean({
description: messages.getMessage('verify'),
default: true,
allowNo: true,
}),
};

public async run(): Promise<ReleaseResult[]> {
Expand Down Expand Up @@ -126,15 +131,15 @@ export default class Release extends SfdxCommand {
dryrun: this.flags.dryrun as boolean,
});

if (!this.flags.dryrun) {
if (!this.flags.dryrun && this.flags.verify) {
lernaRepo.printStage('Waiting For Availablity');
const found = await lernaRepo.waitForAvailability();
if (!found) {
this.ux.warn('Exceeded timeout waiting for packages to become available');
}
}

if (this.flags.sign && !this.flags.dryrun) {
if (this.flags.sign && this.flags.verify && !this.flags.dryrun) {
lernaRepo.printStage('Verify Signed Packaged');
lernaRepo.verifySignature(this.flags.sign);
}
Expand Down
9 changes: 7 additions & 2 deletions src/commands/npm/package/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ export default class Release extends SfdxCommand {
prerelease: flags.string({
description: messages.getMessage('prerelease'),
}),
verify: flags.boolean({
description: messages.getMessage('verify'),
default: true,
allowNo: true,
}),
};

public async run(): Promise<ReleaseResult> {
Expand Down Expand Up @@ -115,15 +120,15 @@ export default class Release extends SfdxCommand {
dryrun: this.flags.dryrun as boolean,
});

if (!this.flags.dryrun) {
if (!this.flags.dryrun && this.flags.verify) {
pkg.printStage('Waiting For Availability');
const found = await pkg.waitForAvailability();
if (!found) {
this.ux.warn(`Exceeded timeout waiting for ${pkg.name}@${pkg.nextVersion} to become available`);
}
}

if (this.flags.sign && !this.flags.dryrun) {
if (this.flags.sign && this.flags.verify && !this.flags.dryrun) {
pkg.printStage('Verify Signed Packaged');
pkg.verifySignature();
}
Expand Down

0 comments on commit 30b3b6e

Please sign in to comment.