@rushstack/lockfile-explorer
Version:
Rush Lockfile Explorer: The UI for solving version conflicts quickly in a large monorepo
31 lines • 1.65 kB
JavaScript
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import { ConsoleTerminalProvider, Terminal, Colorize } from '@rushstack/terminal';
import { CommandLineParser } from '@rushstack/ts-command-line';
import { JsonFile, PackageJsonLookup } from '@rushstack/node-core-library';
import { InitAction } from './actions/InitAction';
import { CheckAction } from './actions/CheckAction';
const LINT_TOOL_FILENAME = 'lockfile-lint';
export class LintCommandLineParser extends CommandLineParser {
constructor() {
super({
toolFilename: LINT_TOOL_FILENAME,
toolDescription: 'Lockfile Lint applies configured policies to find and report dependency issues in your PNPM workspace.'
});
this._terminalProvider = new ConsoleTerminalProvider();
this.globalTerminal = new Terminal(this._terminalProvider);
this._populateActions();
}
async onExecuteAsync() {
const lockfileExplorerProjectRoot = PackageJsonLookup.instance.tryGetPackageFolderFor(__dirname);
const lockfileExplorerPackageJson = JsonFile.load(`${lockfileExplorerProjectRoot}/package.json`);
const appVersion = lockfileExplorerPackageJson.version;
this.globalTerminal.writeLine(Colorize.bold(`\nRush Lockfile Lint ${appVersion}`) + Colorize.cyan(' - https://lfx.rushstack.io/\n'));
await super.onExecuteAsync();
}
_populateActions() {
this.addAction(new InitAction(this));
this.addAction(new CheckAction(this));
}
}
//# sourceMappingURL=LintCommandLineParser.js.map