@salesforce/plugin-release-management
Version:
A plugin for preparing and publishing npm packages
41 lines • 1.9 kB
JavaScript
;
/*
* Copyright (c) 2020, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
Object.defineProperty(exports, "__esModule", { value: true });
const command_1 = require("@salesforce/command");
const core_1 = require("@salesforce/core");
const package_1 = require("../../../package");
const inspectCommits_1 = require("../../../inspectCommits");
class Validate extends command_1.SfdxCommand {
async run() {
const packages = [await package_1.Package.create()];
const responses = [];
for (const pkg of packages) {
const commitInspection = await (0, inspectCommits_1.inspectCommits)(pkg);
const response = Object.assign(commitInspection, {
name: pkg.name,
currentVersion: pkg.packageJson.version,
});
responses.push(response);
}
const majorBump = responses.some((resp) => !!resp.isMajorBump);
if (majorBump) {
throw new core_1.SfError('Major version bump detected. You must manually update the version in the package.json to release a new major version.', 'MajorBumpDetected');
}
const shouldRelease = responses.some((resp) => !!resp.shouldRelease) && !majorBump;
this.ux.log(shouldRelease.toString());
return this.flags.verbose ? { shouldRelease, majorBump, packages: responses } : { shouldRelease, majorBump };
}
}
exports.default = Validate;
Validate.description = 'inspects the git commits to see if there are any commits that will warrant a new release';
Validate.flagsConfig = {
verbose: command_1.flags.builtin({
description: 'show all commits for all packages (only works with --json flag)',
}),
};
//# sourceMappingURL=validate.js.map