Skip to content

Commit

Permalink
fix: rename base-cmd to match other commands
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Apr 24, 2024
1 parent 08e0c0e commit 7e04417
Show file tree
Hide file tree
Showing 47 changed files with 48 additions and 51 deletions.
3 changes: 1 addition & 2 deletions lib/arborist-cmd.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
const { log } = require('proc-log')
const BaseCommand = require('./base-cmd.js')

// This is the base for all commands whose execWorkspaces just gets
// a list of workspace names and passes it on to new Arborist() to
// be able to run a filtered Arborist.reify() at some point.

const BaseCommand = require('./base-command.js')
class ArboristCmd extends BaseCommand {
get isArboristCmd () {
return true
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/commands/access.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const pkgJson = require('@npmcli/package-json')
const localeCompare = require('@isaacs/string-locale-compare')('en')
const otplease = require('../utils/otplease.js')
const getIdentity = require('../utils/get-identity.js')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

const commands = [
'get',
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/adduser.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { log, output } = require('proc-log')
const { redactLog: replaceInfo } = require('@npmcli/redact')
const auth = require('../utils/auth.js')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class AddUser extends BaseCommand {
static description = 'Add a registry user account'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const pacote = require('pacote')
const fs = require('fs/promises')
const { join } = require('path')
const semver = require('semver')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')
const npa = require('npm-package-arg')
const jsonParse = require('json-parse-even-better-errors')
const localeCompare = require('@isaacs/string-locale-compare')('en')
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/completion.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const Npm = require('../npm.js')
const { definitions, shorthands } = require('@npmcli/config/lib/definitions')
const { commands, aliases, deref } = require('../utils/cmd-list.js')
const { isWindowsShell } = require('../utils/is-windows.js')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

const fileExists = (file) => fs.stat(file).then(s => s.isFile()).catch(() => false)

Expand Down
2 changes: 1 addition & 1 deletion lib/commands/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const localeCompare = require('@isaacs/string-locale-compare')('en')
const pkgJson = require('@npmcli/package-json')
const { defaults, definitions } = require('@npmcli/config/lib/definitions')
const { log, output } = require('proc-log')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

// These are the configs that we can nerf-dart. Not all of them currently even
// *have* config definitions so we have to explicitly validate them here
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/deprecate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const npa = require('npm-package-arg')
const semver = require('semver')
const getIdentity = require('../utils/get-identity.js')
const libaccess = require('libnpmaccess')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class Deprecate extends BaseCommand {
static description = 'Deprecate a version of a package'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const pacote = require('pacote')
const pickManifest = require('npm-pick-manifest')
const { log, output } = require('proc-log')
const pkgJson = require('@npmcli/package-json')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class Diff extends BaseCommand {
static description = 'The registry diff command'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/dist-tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const semver = require('semver')
const { log, output } = require('proc-log')
const otplease = require('../utils/otplease.js')
const pkgJson = require('@npmcli/package-json')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class DistTag extends BaseCommand {
static description = 'Modify package distribution tags'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/doctor.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const semver = require('semver')
const { log, output } = require('proc-log')
const ping = require('../utils/ping.js')
const { defaults } = require('@npmcli/config/lib/definitions')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

const maskLabel = mask => {
const label = []
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { resolve } = require('path')
const { lstat } = require('fs/promises')
const cp = require('child_process')
const completion = require('../utils/installed-shallow.js')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

const splitPackageNames = (path) => path.split('/')
// combine scoped parts
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/exec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { resolve } = require('path')
const libexec = require('libnpmexec')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class Exec extends BaseCommand {
static description = 'Run a command from a local or remote npm package'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const runScript = require('@npmcli/run-script')
const { join, relative } = require('path')
const { log, output } = require('proc-log')
const completion = require('../utils/installed-shallow.js')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

// npm explore <pkg>[@<version>]
// open a subshell to the package folder.
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/get.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Npm = require('../npm.js')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class Get extends BaseCommand {
static description = 'Get a value from the npm configuration'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/help-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { readFile } = require('node:fs/promises')
const path = require('node:path')
const { glob } = require('glob')
const { output } = require('proc-log')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

const globify = pattern => pattern.split('\\').join('/')

Expand Down
2 changes: 1 addition & 1 deletion lib/commands/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { glob } = require('glob')
const { output } = require('proc-log')
const localeCompare = require('@isaacs/string-locale-compare')('en')
const { deref } = require('../utils/cmd-list.js')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

const globify = pattern => pattern.split('\\').join('/')

Expand Down
2 changes: 1 addition & 1 deletion lib/commands/hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const hookApi = require('libnpmhook')
const otplease = require('../utils/otplease.js')
const relativeDate = require('tiny-relative-date')
const { output } = require('proc-log')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class Hook extends BaseCommand {
static description = 'Manage registry hooks'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const mapWorkspaces = require('@npmcli/map-workspaces')
const PackageJson = require('@npmcli/package-json')
const { log, output } = require('proc-log')
const updateWorkspaces = require('../utils/update-workspaces.js')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

const posixPath = p => p.split('\\').join('/')

Expand Down
2 changes: 1 addition & 1 deletion lib/commands/login.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { log, output } = require('proc-log')
const { redactLog: replaceInfo } = require('@npmcli/redact')
const auth = require('../utils/auth.js')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class Login extends BaseCommand {
static description = 'Login to a registry user account'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/logout.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const npmFetch = require('npm-registry-fetch')
const { getAuth } = npmFetch
const { log } = require('proc-log')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class Logout extends BaseCommand {
static description = 'Log out of the registry'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/org.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const liborg = require('libnpmorg')
const otplease = require('../utils/otplease.js')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')
const { output } = require('proc-log')

class Org extends BaseCommand {
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/owner.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const pacote = require('pacote')
const { log, output } = require('proc-log')
const otplease = require('../utils/otplease.js')
const pkgJson = require('@npmcli/package-json')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')
const { redact } = require('@npmcli/redact')

const readJson = async (path) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const libpack = require('libnpmpack')
const npa = require('npm-package-arg')
const { log, output } = require('proc-log')
const { getContents, logTar } = require('../utils/tar.js')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class Pack extends BaseCommand {
static description = 'Create a tarball from a package'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/ping.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { redact } = require('@npmcli/redact')
const { log, output } = require('proc-log')
const pingUtil = require('../utils/ping.js')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class Ping extends BaseCommand {
static description = 'Ping npm registry'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/pkg.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { output } = require('proc-log')
const PackageJson = require('@npmcli/package-json')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')
const Queryable = require('../utils/queryable.js')

class Pkg extends BaseCommand {
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/prefix.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { output } = require('proc-log')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class Prefix extends BaseCommand {
static description = 'Display prefix'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const npmProfile = require('npm-profile')
const qrcodeTerminal = require('qrcode-terminal')
const otplease = require('../utils/otplease.js')
const readUserInfo = require('../utils/read-user-info.js')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

const qrcode = url =>
new Promise((resolve) => qrcodeTerminal.generate(url, resolve))
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const { getContents, logTar } = require('../utils/tar.js')
// change that ought to get a RFC written on it.
const { flatten } = require('@npmcli/config/lib/definitions')
const pkgJson = require('@npmcli/package-json')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class Publish extends BaseCommand {
static description = 'Publish a package'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/query.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { resolve } = require('node:path')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')
const { log, output } = require('proc-log')

class QuerySelectorItem {
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/root.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { output } = require('proc-log')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class Root extends BaseCommand {
static description = 'Display npm root'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/run-script.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { log, output } = require('proc-log')
const pkgJson = require('@npmcli/package-json')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class RunScript extends BaseCommand {
static description = 'Run arbitrary package scripts'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/sbom.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const localeCompare = require('@isaacs/string-locale-compare')('en')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')
const { log, output } = require('proc-log')
const { cyclonedxOutput } = require('../utils/sbom-cyclonedx.js')
const { spdxOutput } = require('../utils/sbom-spdx.js')
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const Pipeline = require('minipass-pipeline')
const libSearch = require('libnpmsearch')
const { log, output } = require('proc-log')
const formatSearchStream = require('../utils/format-search-stream.js')
const BaseCommand = require('../base-cmd.js')

const BaseCommand = require('../base-command.js')
class Search extends BaseCommand {
static description = 'Search for packages'
static name = 'search'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/set.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Npm = require('../npm.js')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class Set extends BaseCommand {
static description = 'Set a value in the npm configuration'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/shrinkwrap.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { resolve, basename } = require('path')
const { unlink } = require('fs/promises')
const { log } = require('proc-log')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class Shrinkwrap extends BaseCommand {
static description = 'Lock down dependency versions for publication'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/star.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const fetch = require('npm-registry-fetch')
const npa = require('npm-package-arg')
const { log, output } = require('proc-log')
const getIdentity = require('../utils/get-identity')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class Star extends BaseCommand {
static description = 'Mark your favorite packages'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/stars.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fetch = require('npm-registry-fetch')
const { log, output } = require('proc-log')
const getIdentity = require('../utils/get-identity.js')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class Stars extends BaseCommand {
static description = 'View packages marked as favorites'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/team.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const libteam = require('libnpmteam')
const { output } = require('proc-log')
const otplease = require('../utils/otplease.js')

const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')
class Team extends BaseCommand {
static description = 'Manage organization teams and team memberships'
static name = 'team'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { log, output } = require('proc-log')
const profile = require('npm-profile')
const otplease = require('../utils/otplease.js')
const readUserInfo = require('../utils/read-user-info.js')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class Token extends BaseCommand {
static description = 'Manage your authentication tokens'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/unpublish.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const pkgJson = require('@npmcli/package-json')
const { flatten } = require('@npmcli/config/lib/definitions')
const getIdentity = require('../utils/get-identity.js')
const otplease = require('../utils/otplease.js')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

const LAST_REMAINING_VERSION_ERROR = 'Refusing to delete the last version of the package. ' +
'It will block from republishing a new version for 24 hours.\n' +
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/version.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { resolve } = require('node:path')
const { readFile } = require('node:fs/promises')
const { output } = require('proc-log')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class Version extends BaseCommand {
static description = 'Bump a package version'
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const semver = require('semver')
const { inspect } = require('util')
const { packument } = require('pacote')
const Queryable = require('../utils/queryable.js')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

const readJson = async file => jsonParse(await readFile(file, 'utf8'))

Expand Down
2 changes: 1 addition & 1 deletion lib/commands/whoami.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { output } = require('proc-log')
const getIdentity = require('../utils/get-identity.js')
const BaseCommand = require('../base-command.js')
const BaseCommand = require('../base-cmd.js')

class Whoami extends BaseCommand {
static description = 'Display npm username'
Expand Down
4 changes: 2 additions & 2 deletions lib/lifecycle-cmd.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const BaseCommand = require('./base-cmd.js')

// The implementation of commands that are just "run a script"
// restart, start, stop, test

const BaseCommand = require('./base-command.js')
class LifecycleCmd extends BaseCommand {
static usage = ['[-- <args>]']
static isShellout = true
Expand Down
6 changes: 2 additions & 4 deletions lib/package-url-cmd.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
// Base command for opening urls from a package manifest (bugs, docs, repo)

const pacote = require('pacote')

const openUrl = require('./utils/open-url.js')
const { log } = require('proc-log')
const BaseCommand = require('./base-cmd.js')

const BaseCommand = require('./base-command.js')
// Base command for opening urls from a package manifest (bugs, docs, repo)
class PackageUrlCommand extends BaseCommand {
static params = [
'browser',
Expand Down
Loading

0 comments on commit 7e04417

Please sign in to comment.