@salesforce/plugin-release-management
Version:
A plugin for preparing and publishing npm packages
45 lines • 1.67 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
*/
/* eslint-disable sf-plugin/command-example */
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
import { Messages } from '@salesforce/core';
import { Package } from '../../../package.js';
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('@salesforce/plugin-release-management', 'npm.dependencies.pin');
export default class Pin extends SfCommand {
static summary = messages.getMessage('description');
static description = messages.getMessage('description');
static flags = {
dryrun: Flags.boolean({
char: 'd',
default: false,
summary: messages.getMessage('flags.dryrun.summary'),
}),
tag: Flags.string({
char: 't',
summary: messages.getMessage('flags.tag.summary'),
default: 'latest',
}),
};
async run() {
const { flags } = await this.parse(Pin);
const packageJson = await Package.create();
const pkg = packageJson.pinDependencyVersions(flags.tag);
if (flags.dryrun) {
this.warn('Running in --dryrun mode. No changes will be written to the package.json.');
}
else {
packageJson.writePackageJson();
}
this.table({
data: pkg,
columns: ['name', 'version', 'tag'],
});
return pkg;
}
}
//# sourceMappingURL=pin.js.map