From 9fe0df5b5d7606e5841288d9931be6c04767c9ca Mon Sep 17 00:00:00 2001 From: Gar Date: Wed, 3 Mar 2021 20:26:33 -0800 Subject: fix(usage): clean up usage declarations Small refactor of commands to allow usage to be more programmatically generated, leading us in the direction of more tighly coupling each command to the params it accepts. PR-URL: https://github.com/npm/cli/pull/2821 Credit: @wraithgar Close: #2821 Reviewed-by: @isaacs --- lib/rebuild.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/rebuild.js') diff --git a/lib/rebuild.js b/lib/rebuild.js index ffbdebc21..74f5ae5f6 100644 --- a/lib/rebuild.js +++ b/lib/rebuild.js @@ -2,17 +2,18 @@ const { resolve } = require('path') const Arborist = require('@npmcli/arborist') const npa = require('npm-package-arg') const semver = require('semver') -const usageUtil = require('./utils/usage.js') const completion = require('./utils/completion/installed-deep.js') -class Rebuild { - constructor (npm) { - this.npm = npm +const BaseCommand = require('./base-command.js') +class Rebuild extends BaseCommand { + /* istanbul ignore next - see test/lib/load-all-commands.js */ + static get name () { + return 'rebuild' } /* istanbul ignore next - see test/lib/load-all-commands.js */ - get usage () { - return usageUtil('rebuild', 'npm rebuild [[<@scope>/][@] ...]') + static get usage () { + return ['[[<@scope>/][@] ...]'] } /* istanbul ignore next - see test/lib/load-all-commands.js */ -- cgit v1.2.3