From 3bcb57b11b95bf35a073afa3e372976d553cefb8 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sun, 21 Dec 2025 12:37:10 +0100 Subject: [PATCH 1/2] chore: remove `nopt` from dependencies --- bin/cmd.js | 55 +++++++++++++++++++++++++++++++--------------------- package.json | 3 +-- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/bin/cmd.js b/bin/cmd.js index bb0d394..a2a6032 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -5,7 +5,7 @@ import fs from 'node:fs' import http from 'node:http' import https from 'node:https' import path from 'node:path' -import nopt from 'nopt' +import { parseArgs } from 'node:util' import pretty from '../lib/format-pretty.js' import formatTap from '../lib/format-tap.js' import Validator from '../lib/validator.js' @@ -13,26 +13,38 @@ import Tap from '../lib/tap.js' import * as utils from '../lib/utils.js' import subsystem from '../lib/rules/subsystem.js' -const knownOpts = { - help: Boolean, - version: Boolean, - 'validate-metadata': Boolean, - tap: Boolean, - out: path, - list: Boolean, - 'list-subsystems': Boolean -} -const shortHand = { - h: ['--help'], - v: ['--version'], - V: ['--validate-metadata'], - t: ['--tap'], - o: ['--out'], - l: ['--list'], - ls: ['--list-subsystems'] -} - -const parsed = nopt(knownOpts, shortHand) +const { values: parsed, positionals: args } = parseArgs({ + options: { + help: { + type: 'boolean', + short: 'h' + }, + version: { + type: 'boolean', + short: 'v' + }, + 'validate-metadata': { + type: 'boolean', + short: 'V' + }, + tap: { + type: 'boolean', + short: 't' + }, + out: { + type: 'string', + short: 'o' + }, + list: { + type: 'boolean', + short: 'l' + }, + 'list-subsystems': { + type: 'boolean' + } + }, + allowPositionals: true +}) if (parsed.help) { const usagePath = path.join(new URL(import.meta.url).pathname, '../usage.txt') @@ -49,7 +61,6 @@ if (parsed.version) { process.exit(0) } -const args = parsed.argv.remain if (!parsed.help && !args.length) { args.push('HEAD') } function load (sha, cb) { diff --git a/package.json b/package.json index f61c78b..c992888 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,7 @@ }, "dependencies": { "chalk": "^5.2.0", - "gitlint-parser-node": "^1.1.0", - "nopt": "^7.0.0" + "gitlint-parser-node": "^1.1.0" }, "devDependencies": { "c8": "^7.13.0", From 4c0a18c18f2b6b7f90db3f29e263f3c36488a1be Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sun, 21 Dec 2025 13:38:44 +0100 Subject: [PATCH 2/2] fixup! chore: remove `nopt` from dependencies --- bin/cmd.js | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/cmd.js b/bin/cmd.js index a2a6032..01e361a 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -43,6 +43,7 @@ const { values: parsed, positionals: args } = parseArgs({ type: 'boolean' } }, + allowNegative: true, allowPositionals: true })