From 59dfb06371f7c7adabb318e2af2762321bbc6d93 Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Tue, 21 Jan 2025 14:01:08 -0500 Subject: [PATCH 01/12] fix: use a valid short flag for blobs:get output `-o` is already used in the base command for `--offline`, so this was being quietly ignored This can't be considered a breaking change as it has never worked. (I just tried it to be sure.) See https://github.com/tj/commander.js/pull/2055. --- src/commands/blobs/blobs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/blobs/blobs.ts b/src/commands/blobs/blobs.ts index f3a3a1ddeff..e596cbd43c5 100644 --- a/src/commands/blobs/blobs.ts +++ b/src/commands/blobs/blobs.ts @@ -33,7 +33,7 @@ export const createBlobsCommand = (program: BaseCommand) => { ) .argument('', 'Name of the store') .argument('', 'Object key') - .option('-o, --output ', 'Defines the filesystem path where the blob data should be persisted') + .option('-O, --output ', 'Defines the filesystem path where the blob data should be persisted') .alias('blob:get') .hook('preAction', requiresSiteInfo) .action(async (storeName: string, key: string, options: OptionValues, command: BaseCommand) => { From d8ab3fb833e0f6da847db1a1c4418992b65b1797 Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Tue, 21 Jan 2025 14:12:16 -0500 Subject: [PATCH 02/12] fix: avoid redefining `--json` option in commands See https://github.com/tj/commander.js/pull/2055. --- src/commands/base-command.ts | 2 +- src/commands/blobs/blobs.ts | 5 +++-- src/commands/build/index.ts | 3 ++- src/commands/dev/dev.ts | 2 +- src/commands/functions/functions.ts | 4 ++-- src/commands/serve/index.ts | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/commands/base-command.ts b/src/commands/base-command.ts index b0aa0b37a17..46c857b58a6 100644 --- a/src/commands/base-command.ts +++ b/src/commands/base-command.ts @@ -188,7 +188,7 @@ export default class BaseCommand extends Command { .addOption(new Option('--json', 'Output return values as JSON').hideHelp(true)) .addOption(new Option('--silent', 'Silence CLI output').hideHelp(true)) .addOption(new Option('--cwd ').hideHelp(true)) - .addOption(new Option('-o, --offline').hideHelp(true)) + .addOption(new Option('-o, --offline').default(false).hideHelp(true)) .addOption(new Option('--auth ', 'Netlify auth token').hideHelp(true)) .addOption( new Option('--http-proxy [address]', 'Proxy server address to route requests through.') diff --git a/src/commands/blobs/blobs.ts b/src/commands/blobs/blobs.ts index e596cbd43c5..90dda3a00a2 100644 --- a/src/commands/blobs/blobs.ts +++ b/src/commands/blobs/blobs.ts @@ -1,4 +1,4 @@ -import { OptionValues } from 'commander' +import { Option, OptionValues } from 'commander' import requiresSiteInfo from '../../utils/hooks/requires-site-info.js' import BaseCommand from '../base-command.js' @@ -53,7 +53,8 @@ export const createBlobsCommand = (program: BaseCommand) => { '-p, --prefix ', `A string for filtering down the entries; when specified, only the entries whose key starts with that prefix are returned`, ) - .option('--json', `Output list contents as JSON`) + // The BaseCommand defines a `--json` option which is hidden from the help by default + .addHelpOption(new Option('--json', 'Output list contents as JSON')) .alias('blob:list') .hook('preAction', requiresSiteInfo) .action(async (storeName: string, options: OptionValues, command: BaseCommand) => { diff --git a/src/commands/build/index.ts b/src/commands/build/index.ts index f17ace6a6ff..5ae0664d1d9 100644 --- a/src/commands/build/index.ts +++ b/src/commands/build/index.ts @@ -2,6 +2,7 @@ import process from 'process' import { normalizeContext } from '../../utils/env/index.js' import BaseCommand from '../base-command.js' +import { Option } from 'commander' export const createBuildCommand = (program: BaseCommand) => program @@ -14,7 +15,7 @@ export const createBuildCommand = (program: BaseCommand) => process.env.CONTEXT || 'production', ) .option('--dry', 'Dry run: show instructions without running them', false) - .option('-o, --offline', 'disables any features that require network access', false) + .addHelpOption(new Option('-o, --offline', 'Disables any features that require network access')) .addExamples(['netlify build']) .action(async (options, command) => { const { build } = await import('./build.js') diff --git a/src/commands/dev/dev.ts b/src/commands/dev/dev.ts index 6985e016fa2..dea5d2f0b00 100644 --- a/src/commands/dev/dev.ts +++ b/src/commands/dev/dev.ts @@ -272,7 +272,7 @@ export const createDevCommand = (program: BaseCommand) => { .option('--framework ', 'framework to use. Defaults to #auto which automatically detects a framework') .option('-d ,--dir ', 'dir with static files') .option('-f ,--functions ', 'specify a functions folder to serve') - .option('-o ,--offline', 'disables any features that require network access') + .addHelpOption(new Option('-o, --offline', 'Disables any features that require network access')) .addOption( new Option('--offline-env', 'disables fetching environment variables from the Netlify API').hideHelp(true), ) diff --git a/src/commands/functions/functions.ts b/src/commands/functions/functions.ts index e4a1698a27f..e7931e7811e 100644 --- a/src/commands/functions/functions.ts +++ b/src/commands/functions/functions.ts @@ -1,4 +1,4 @@ -import { OptionValues } from 'commander' +import { Option, OptionValues } from 'commander' import { chalk } from '../../utils/command-helpers.js' import requiresSiteInfo from '../../utils/hooks/requires-site-info.js' @@ -97,7 +97,7 @@ NOT the same as listing the functions that have been deployed. For that info you .description('Serve functions locally') .option('-f, --functions ', 'Specify a functions directory to serve') .option('-p, --port ', 'Specify a port for the functions server', (value) => Number.parseInt(value)) - .option('-o, --offline', 'disables any features that require network access') + .addHelpOption(new Option('-o, --offline', 'Disables any features that require network access')) .addHelpText('after', 'Helpful for debugging functions.') .action(async (options: OptionValues, command: BaseCommand) => { const { functionsServe } = await import('./functions-serve.js') diff --git a/src/commands/serve/index.ts b/src/commands/serve/index.ts index 0b42d23d749..68d25698596 100644 --- a/src/commands/serve/index.ts +++ b/src/commands/serve/index.ts @@ -18,7 +18,7 @@ export const createServeCommand = (program: BaseCommand) => .option('-p ,--port ', 'port of netlify dev', (value) => Number.parseInt(value)) .option('-d ,--dir ', 'dir with static files') .option('-f ,--functions ', 'specify a functions folder to serve') - .option('-o ,--offline', 'disables any features that require network access') + .addHelpOption(new Option('-o, --offline', 'Disables any features that require network access')) .addOption( new Option( '--internal-disable-edge-functions', From 3addebde4e406fd05154d1566a9bbae21fe09538 Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Tue, 21 Jan 2025 14:25:07 -0500 Subject: [PATCH 03/12] fix: fix duplicate `-o` option for deploy command It's already used in the BaseCommand for `--offline`. This is not a breaking change, because this never worked as is. Same issue as in 9280c558. --- src/commands/deploy/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/deploy/index.ts b/src/commands/deploy/index.ts index 5475ce9e53c..9cd23456d2a 100644 --- a/src/commands/deploy/index.ts +++ b/src/commands/deploy/index.ts @@ -97,7 +97,7 @@ Support for package.json's main field, and intrinsic index.js entrypoints are co '-b, --branch ', 'Serves the same functionality as --alias. Deprecated and will be removed in future versions', ) - .option('-o, --open', 'Open site after deploy', false) + .option('-O, --open', 'Open site after deploy', false) .option('-m, --message ', 'A short message to include in the deploy log') .option('-a, --auth ', 'Netlify auth token to deploy with', env.NETLIFY_AUTH_TOKEN) .option('-s, --site ', 'A site name or ID to deploy to', env.NETLIFY_SITE_ID) From 32c2984cb61c01cbbd5e1715b1cb0d553efd8c74 Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Tue, 21 Jan 2025 14:29:10 -0500 Subject: [PATCH 04/12] fix: fix duplicate `-a` option in deploy command It's already defined in the BaseCommand for `--offline`. --- src/commands/deploy/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/deploy/index.ts b/src/commands/deploy/index.ts index 9cd23456d2a..848b9d65615 100644 --- a/src/commands/deploy/index.ts +++ b/src/commands/deploy/index.ts @@ -99,7 +99,7 @@ Support for package.json's main field, and intrinsic index.js entrypoints are co ) .option('-O, --open', 'Open site after deploy', false) .option('-m, --message ', 'A short message to include in the deploy log') - .option('-a, --auth ', 'Netlify auth token to deploy with', env.NETLIFY_AUTH_TOKEN) + .addHelpOption(new Option('-a, --auth ', 'Netlify auth token to deploy with')) .option('-s, --site ', 'A site name or ID to deploy to', env.NETLIFY_SITE_ID) .option('--json', 'Output deployment data as JSON') .option('--timeout ', 'Timeout to wait for deployment to finish', (value) => Number.parseInt(value)) From cbd2f4e155cc5b4e8986156bb2c972ae9a177e87 Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Tue, 21 Jan 2025 15:51:43 -0500 Subject: [PATCH 05/12] fix: fix still more `--json` option overrides --- src/commands/deploy/index.ts | 4 +++- src/commands/env/env.ts | 3 ++- src/commands/functions/functions.ts | 3 ++- src/commands/sites/sites.ts | 5 +++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/commands/deploy/index.ts b/src/commands/deploy/index.ts index 848b9d65615..23ba2e927c8 100644 --- a/src/commands/deploy/index.ts +++ b/src/commands/deploy/index.ts @@ -99,9 +99,11 @@ Support for package.json's main field, and intrinsic index.js entrypoints are co ) .option('-O, --open', 'Open site after deploy', false) .option('-m, --message ', 'A short message to include in the deploy log') + // The BaseCommand defines an `--auth` option which is hidden from the help by default .addHelpOption(new Option('-a, --auth ', 'Netlify auth token to deploy with')) .option('-s, --site ', 'A site name or ID to deploy to', env.NETLIFY_SITE_ID) - .option('--json', 'Output deployment data as JSON') + // The BaseCommand defines a `--json` option which is hidden from the help by default + .addHelpOption(new Option('--json', 'Output deployment data as JSON')) .option('--timeout ', 'Timeout to wait for deployment to finish', (value) => Number.parseInt(value)) .addOption( new Option('--trigger', 'Trigger a new build of your site on Netlify without uploading local files').conflicts( diff --git a/src/commands/env/env.ts b/src/commands/env/env.ts index dc38a919e68..746a3935990 100644 --- a/src/commands/env/env.ts +++ b/src/commands/env/env.ts @@ -56,7 +56,8 @@ export const createEnvCommand = (program: BaseCommand) => { normalizeContext, 'dev', ) - .option('--json', 'Output environment variables as JSON') + // The BaseCommand defines a `--json` option which is hidden from the help by default + .addHelpOption(new Option('--json', 'Output environment variables as JSON')) .addOption(new Option('--plain', 'Output environment variables as plaintext').conflicts('json')) .addOption( new Option('-s, --scope ', 'Specify a scope') diff --git a/src/commands/functions/functions.ts b/src/commands/functions/functions.ts index e7931e7811e..48ba93d4338 100644 --- a/src/commands/functions/functions.ts +++ b/src/commands/functions/functions.ts @@ -84,7 +84,8 @@ Helpful for making sure that you have formatted your functions correctly NOT the same as listing the functions that have been deployed. For that info you need to go to your Netlify deploy log.`, ) .option('-f, --functions ', 'Specify a functions directory to list') - .option('--json', 'Output function data as JSON') + // The BaseCommand defines a `--json` option which is hidden from the help by default + .addHelpOption(new Option('--json', 'Output function data as JSON')) .hook('preAction', requiresSiteInfo) .action(async (options: OptionValues, command: BaseCommand) => { const { functionsList } = await import('./functions-list.js') diff --git a/src/commands/sites/sites.ts b/src/commands/sites/sites.ts index cd8d1652bd4..a7f3cb64bd5 100644 --- a/src/commands/sites/sites.ts +++ b/src/commands/sites/sites.ts @@ -1,4 +1,4 @@ -import { OptionValues, InvalidArgumentError } from 'commander' +import { OptionValues, InvalidArgumentError, Option } from 'commander' import BaseCommand from '../base-command.js' @@ -71,7 +71,8 @@ export const createSitesCommand = (program: BaseCommand) => { program .command('sites:list') .description('List all sites you have access to') - .option('--json', 'Output site data as JSON') + // The BaseCommand defines a `--json` option which is hidden from the help by default + .addHelpOption(new Option('--json', 'Output site data as JSON')) .action(async (options: OptionValues, command: BaseCommand) => { const { sitesList } = await import('./sites-list.js') await sitesList(options, command) From 250fa2ec6c0dd89bd9495f9d0a559b00f36e209e Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Thu, 23 Jan 2025 15:23:30 -0500 Subject: [PATCH 06/12] fix: fix env:import options `-r` was already used globally so this was being ignored --- src/commands/env/env.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/env/env.ts b/src/commands/env/env.ts index 746a3935990..9a16f28a924 100644 --- a/src/commands/env/env.ts +++ b/src/commands/env/env.ts @@ -38,7 +38,7 @@ export const createEnvCommand = (program: BaseCommand) => { .command('env:import') .argument('', '.env file to import') .option( - '-r, --replace-existing', + '-R, --replace-existing', 'Replace all existing variables instead of merging them with the current ones', false, ) From 1f9c4aa05a78b6043e23001a90772d213e0b3038 Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Thu, 23 Jan 2025 16:48:50 -0500 Subject: [PATCH 07/12] fix: don't mutate the commander singleton It was redefining the options over and over and over. The latest commander throws. --- .../runtimes/js/builders/netlify-lambda.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/lib/functions/runtimes/js/builders/netlify-lambda.ts b/src/lib/functions/runtimes/js/builders/netlify-lambda.ts index 536d7f15fd2..3fe15fbc6f3 100644 --- a/src/lib/functions/runtimes/js/builders/netlify-lambda.ts +++ b/src/lib/functions/runtimes/js/builders/netlify-lambda.ts @@ -1,7 +1,7 @@ import { readFile } from 'fs/promises' import { resolve } from 'path' -import { program } from 'commander' +import { Command } from 'commander' import execa from '../../../../../utils/execa.js' import { fileExistsAsync } from '../../../../fs.js' @@ -14,19 +14,21 @@ export const detectNetlifyLambda = async function ({ packageJson } = {}) { return false } + const program = new Command() + .option('-s, --static') + .option('-c, --config [file]') + .option('-p, --port [number]') + .option('-b, --babelrc [file]') + .option('-t, --timeout [delay]') + + program.allowExcessArguments() + // @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'. const matchingScripts = Object.entries(scripts).filter(([, script]) => script.match(/netlify-lambda\s+build/)) for (const [key, script] of matchingScripts) { // E.g. ["netlify-lambda", "build", "functions/folder"] // these are all valid options for netlify-lambda - program - .option('-s, --static') - .option('-c, --config [file]') - .option('-p, --port [number]') - .option('-b, --babelrc [file]') - .option('-t, --timeout [delay]') - program.parse((script as string).split(' ') ?? []) // We are not interested in 'netlify-lambda' and 'build' commands From f5b9a23674ff0c00ab6c51ec825cf01a0692ba0c Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Thu, 23 Jan 2025 15:38:00 -0500 Subject: [PATCH 08/12] chore(deps): bump astro in docs site --- site/package-lock.json | 216 ++++++++++++++++++++++++----------------- site/package.json | 4 +- 2 files changed, 129 insertions(+), 91 deletions(-) diff --git a/site/package-lock.json b/site/package-lock.json index affe1b55e65..b03baa46b53 100644 --- a/site/package-lock.json +++ b/site/package-lock.json @@ -9,8 +9,8 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@astrojs/starlight": "0.31.1", - "astro": "5.1.8", + "@astrojs/starlight": "^0.31.1", + "astro": "^5.1.9", "markdown-magic": "2.6.1", "sharp": "0.32.6", "strip-ansi": "7.1.0" @@ -22,9 +22,9 @@ "integrity": "sha512-bL/O7YBxsFt55YHU021oL+xz+B/9HvGNId3F9xURN16aeqDK9juHGktdkCSXz+U4nqFACq6ZFvWomOzhV+zfPw==" }, "node_modules/@astrojs/internal-helpers": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.4.2.tgz", - "integrity": "sha512-EdDWkC3JJVcpGpqJAU/5hSk2LKXyG3mNGkzGoAuyK+xoPHbaVdSuIWoN1QTnmK3N/gGfaaAfM8gO2KDCAW7S3w==" + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.5.1.tgz", + "integrity": "sha512-M7rAge1n2+aOSxNvKUFa0u/KFn0W+sZy7EW91KOSERotm2Ti8qs+1K0xx3zbOxtAVrmJb5/J98eohVvvEqtNkw==" }, "node_modules/@astrojs/markdown-remark": { "version": "6.0.2", @@ -1376,57 +1376,57 @@ ] }, "node_modules/@shikijs/core": { - "version": "1.29.1", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.29.1.tgz", - "integrity": "sha512-Mo1gGGkuOYjDu5H8YwzmOuly9vNr8KDVkqj9xiKhhhFS8jisAtDSEWB9hzqRHLVQgFdA310e8XRJcW4tYhRB2A==", + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.29.2.tgz", + "integrity": "sha512-vju0lY9r27jJfOY4Z7+Rt/nIOjzJpZ3y+nYpqtUZInVoXQ/TJZcfGnNOGnKjFdVZb8qexiCuSlZRKcGfhhTTZQ==", "dependencies": { - "@shikijs/engine-javascript": "1.29.1", - "@shikijs/engine-oniguruma": "1.29.1", - "@shikijs/types": "1.29.1", + "@shikijs/engine-javascript": "1.29.2", + "@shikijs/engine-oniguruma": "1.29.2", + "@shikijs/types": "1.29.2", "@shikijs/vscode-textmate": "^10.0.1", "@types/hast": "^3.0.4", "hast-util-to-html": "^9.0.4" } }, "node_modules/@shikijs/engine-javascript": { - "version": "1.29.1", - "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-1.29.1.tgz", - "integrity": "sha512-Hpi8k9x77rCQ7F/7zxIOUruNkNidMyBnP5qAGbLFqg4kRrg1HZhkB8btib5EXbQWTtLb5gBHOdBwshk20njD7Q==", + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-1.29.2.tgz", + "integrity": "sha512-iNEZv4IrLYPv64Q6k7EPpOCE/nuvGiKl7zxdq0WFuRPF5PAE9PRo2JGq/d8crLusM59BRemJ4eOqrFrC4wiQ+A==", "dependencies": { - "@shikijs/types": "1.29.1", + "@shikijs/types": "1.29.2", "@shikijs/vscode-textmate": "^10.0.1", "oniguruma-to-es": "^2.2.0" } }, "node_modules/@shikijs/engine-oniguruma": { - "version": "1.29.1", - "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.29.1.tgz", - "integrity": "sha512-gSt2WhLNgEeLstcweQOSp+C+MhOpTsgdNXRqr3zP6M+BUBZ8Md9OU2BYwUYsALBxHza7hwaIWtFHjQ/aOOychw==", + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.29.2.tgz", + "integrity": "sha512-7iiOx3SG8+g1MnlzZVDYiaeHe7Ez2Kf2HrJzdmGwkRisT7r4rak0e655AcM/tF9JG/kg5fMNYlLLKglbN7gBqA==", "dependencies": { - "@shikijs/types": "1.29.1", + "@shikijs/types": "1.29.2", "@shikijs/vscode-textmate": "^10.0.1" } }, "node_modules/@shikijs/langs": { - "version": "1.29.1", - "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-1.29.1.tgz", - "integrity": "sha512-iERn4HlyuT044/FgrvLOaZgKVKf3PozjKjyV/RZ5GnlyYEAZFcgwHGkYboeBv2IybQG1KVS/e7VGgiAU4JY2Gw==", + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-1.29.2.tgz", + "integrity": "sha512-FIBA7N3LZ+223U7cJDUYd5shmciFQlYkFXlkKVaHsCPgfVLiO+e12FmQE6Tf9vuyEsFe3dIl8qGWKXgEHL9wmQ==", "dependencies": { - "@shikijs/types": "1.29.1" + "@shikijs/types": "1.29.2" } }, "node_modules/@shikijs/themes": { - "version": "1.29.1", - "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-1.29.1.tgz", - "integrity": "sha512-lb11zf72Vc9uxkl+aec2oW1HVTHJ2LtgZgumb4Rr6By3y/96VmlU44bkxEb8WBWH3RUtbqAJEN0jljD9cF7H7g==", + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-1.29.2.tgz", + "integrity": "sha512-i9TNZlsq4uoyqSbluIcZkmPL9Bfi3djVxRnofUHwvx/h6SRW3cwgBC5SML7vsDcWyukY0eCzVN980rqP6qNl9g==", "dependencies": { - "@shikijs/types": "1.29.1" + "@shikijs/types": "1.29.2" } }, "node_modules/@shikijs/types": { - "version": "1.29.1", - "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.29.1.tgz", - "integrity": "sha512-aBqAuhYRp5vSir3Pc9+QPu9WESBOjUo03ao0IHLC4TyTioSsp/SkbAZSrIH4ghYYC1T1KTEpRSBa83bas4RnPA==", + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.29.2.tgz", + "integrity": "sha512-VJjK0eIijTZf0QSTODEXCqinjBn0joAHQ+aPSBzrv4O2d/QSbsMw+ZeSRx03kV34Hy7NzUvV/7NqfYGRLrASmw==", "dependencies": { "@shikijs/vscode-textmate": "^10.0.1", "@types/hast": "^3.0.4" @@ -2100,9 +2100,9 @@ "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==" }, "node_modules/@ungap/structured-clone": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.1.tgz", - "integrity": "sha512-fEzPV3hSkSMltkw152tJKNARhOupqbH96MZWyRjNaYZOMIzbrTeQDG+MTc6Mr2pgzFQzFxAfmhGDNP5QK++2ZA==" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==" }, "node_modules/acorn": { "version": "8.14.0", @@ -2297,14 +2297,13 @@ } }, "node_modules/astro": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/astro/-/astro-5.1.8.tgz", - "integrity": "sha512-7fNNceI/dXqGIkkZQjxhH31alAfgf33cDv34cPLCGFVSHHOpYG0NSrofnxdYf0BvWRlddqkq393UqDM5cJlv1w==", - "license": "MIT", + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/astro/-/astro-5.2.5.tgz", + "integrity": "sha512-AYXyYkc+c5xbKTm48FyQA91y81nXyNPAaoyafR0LUugE4lAwuvIUcXDBfMzmbuP1lGRvsE33G2oypv6gbGaPFg==", "dependencies": { "@astrojs/compiler": "^2.10.3", - "@astrojs/internal-helpers": "0.4.2", - "@astrojs/markdown-remark": "6.0.2", + "@astrojs/internal-helpers": "0.5.1", + "@astrojs/markdown-remark": "6.1.0", "@astrojs/telemetry": "3.2.0", "@oslojs/encoding": "^1.1.0", "@rollup/pluginutils": "^5.1.4", @@ -2330,7 +2329,7 @@ "fast-glob": "^3.3.3", "flattie": "^1.1.1", "github-slugger": "^2.0.0", - "html-escaper": "^3.0.3", + "html-escaper": "3.0.3", "http-cache-semantics": "^4.1.1", "js-yaml": "^4.1.0", "kleur": "^4.1.5", @@ -2340,24 +2339,24 @@ "mrmime": "^2.0.0", "neotraverse": "^0.6.18", "p-limit": "^6.2.0", - "p-queue": "^8.0.1", - "preferred-pm": "^4.0.0", + "p-queue": "^8.1.0", + "preferred-pm": "^4.1.1", "prompts": "^2.4.2", "rehype": "^13.0.2", - "semver": "^7.6.3", - "shiki": "^1.29.1", + "semver": "^7.7.1", + "shiki": "^1.29.2", "tinyexec": "^0.3.2", "tsconfck": "^3.1.4", "ultrahtml": "^1.5.3", "unist-util-visit": "^5.0.0", "unstorage": "^1.14.4", "vfile": "^6.0.3", - "vite": "^6.0.9", + "vite": "^6.0.11", "vitefu": "^1.0.5", - "which-pm": "^3.0.0", + "which-pm": "^3.0.1", "xxhash-wasm": "^1.1.0", "yargs-parser": "^21.1.1", - "yocto-spinner": "^0.1.2", + "yocto-spinner": "^0.2.0", "zod": "^3.24.1", "zod-to-json-schema": "^3.24.1", "zod-to-ts": "^1.2.0" @@ -2389,6 +2388,33 @@ "astro": "^4.0.0-beta || ^5.0.0-beta || ^3.3.0" } }, + "node_modules/astro/node_modules/@astrojs/markdown-remark": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-6.1.0.tgz", + "integrity": "sha512-emZNNSTPGgPc3V399Cazpp5+snogjaF04ocOSQn9vy3Kw/eIC4vTQjXOrWDEoSEy+AwPDZX9bQ4wd3bxhpmGgQ==", + "dependencies": { + "@astrojs/prism": "3.2.0", + "github-slugger": "^2.0.0", + "hast-util-from-html": "^2.0.3", + "hast-util-to-text": "^4.0.2", + "import-meta-resolve": "^4.1.0", + "js-yaml": "^4.1.0", + "mdast-util-definitions": "^6.0.0", + "rehype-raw": "^7.0.0", + "rehype-stringify": "^10.0.1", + "remark-gfm": "^4.0.0", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.1.1", + "remark-smartypants": "^3.0.2", + "shiki": "^1.29.1", + "smol-toml": "^1.3.1", + "unified": "^11.0.5", + "unist-util-remove-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "unist-util-visit-parents": "^6.0.1", + "vfile": "^6.0.3" + } + }, "node_modules/astro/node_modules/sharp": { "version": "0.33.5", "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.5.tgz", @@ -3010,9 +3036,9 @@ "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, "node_modules/crossws": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/crossws/-/crossws-0.3.1.tgz", - "integrity": "sha512-HsZgeVYaG+b5zA+9PbIPGq4+J/CJynJuearykPsXx4V/eMhyQ5EDVg3Ak2FBZtVXCiOLu/U7IiwDHTr9MA+IKw==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/crossws/-/crossws-0.3.2.tgz", + "integrity": "sha512-S2PpQHRcgYABOS2465b34wqTOn5dbLL+iSvyweJYGGFLDsKq88xrjDXUiEhfYkhWZq1HuS6of3okRHILbkrqxw==", "dependencies": { "uncrypto": "^0.1.3" } @@ -4059,12 +4085,12 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" }, "node_modules/h3": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/h3/-/h3-1.13.1.tgz", - "integrity": "sha512-u/z6Z4YY+ANZ05cRRfsFJadTBrNA6e3jxdU+AN5UCbZSZEUwgHiwjvUEe0k1NoQmAvQmETwr+xB5jd7mhCJuIQ==", + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/h3/-/h3-1.14.0.tgz", + "integrity": "sha512-ao22eiONdgelqcnknw0iD645qW0s9NnrJHr5OBz4WOMdBdycfSas1EQf1wXRsm+PcB2Yoj43pjBPwqIpJQTeWg==", "dependencies": { "cookie-es": "^1.2.2", - "crossws": "^0.3.1", + "crossws": "^0.3.2", "defu": "^6.1.4", "destr": "^2.0.3", "iron-webcrypto": "^1.2.1", @@ -5376,12 +5402,13 @@ } }, "node_modules/mdast-util-directive": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/mdast-util-directive/-/mdast-util-directive-3.0.0.tgz", - "integrity": "sha512-JUpYOqKI4mM3sZcNxmF/ox04XYFFkNwr0CFlrQIkCwbvH0xzMCqkMqAde9wRd80VAhaUrwFwKm2nxretdT1h7Q==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-directive/-/mdast-util-directive-3.1.0.tgz", + "integrity": "sha512-I3fNFt+DHmpWCYAT7quoM6lHf9wuqtI+oCOfvILnoicNIqjh5E3dEJWiXuYME2gNe8vl1iMQwyUHa7bgFmak6Q==", "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", + "ccount": "^2.0.0", "devlop": "^1.0.0", "mdast-util-from-markdown": "^2.0.0", "mdast-util-to-markdown": "^2.0.0", @@ -6629,9 +6656,9 @@ } }, "node_modules/micromark-util-subtokenize": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.0.3.tgz", - "integrity": "sha512-VXJJuNxYWSoYL6AJ6OQECCFGhIU2GGHMw8tahogePBrjkG8aCCas3ibkp7RnVOSTClg2is05/R7maAhF1XyQMg==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.0.4.tgz", + "integrity": "sha512-N6hXjrin2GTJDe3MVjf5FuXpm12PGm80BrUAeub9XFXca8JZbP+oIwY4LJSVwFUCL1IPm/WwSVUN7goFHmSGGQ==", "funding": [ { "type": "GitHub Sponsors", @@ -7000,9 +7027,9 @@ } }, "node_modules/p-queue": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-8.0.1.tgz", - "integrity": "sha512-NXzu9aQJTAzbBqOt2hwsR63ea7yvxJc0PwN/zobNAudYfb1B7R08SzB4TsLeSbUCuG467NhnoT0oO6w1qRO+BA==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-8.1.0.tgz", + "integrity": "sha512-mxLDbbGIBEXTJL0zEx8JIylaj3xQ7Z/7eEVjcF9fJX4DBiH9oqe+oahYnlKKxm0Ci9TlWTyhSHgygxMxjIB2jw==", "dependencies": { "eventemitter3": "^5.0.1", "p-timeout": "^6.1.2" @@ -7291,13 +7318,13 @@ } }, "node_modules/preferred-pm": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/preferred-pm/-/preferred-pm-4.0.0.tgz", - "integrity": "sha512-gYBeFTZLu055D8Vv3cSPox/0iTPtkzxpLroSYYA7WXgRi31WCJ51Uyl8ZiPeUUjyvs2MBzK+S8v9JVUgHU/Sqw==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/preferred-pm/-/preferred-pm-4.1.1.tgz", + "integrity": "sha512-rU+ZAv1Ur9jAUZtGPebQVQPzdGhNzaEiQ7VL9+cjsAWPHFYOccNXPNiev1CCDSOg/2j7UujM7ojNhpkuILEVNQ==", "dependencies": { "find-up-simple": "^1.0.0", "find-yarn-workspace-root2": "1.2.16", - "which-pm": "^3.0.0" + "which-pm": "^3.0.1" }, "engines": { "node": ">=18.12" @@ -7674,9 +7701,9 @@ } }, "node_modules/remark-directive": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remark-directive/-/remark-directive-3.0.0.tgz", - "integrity": "sha512-l1UyWJ6Eg1VPU7Hm/9tt0zKtReJQNOA4+iDMAxTyZNWnJnFlbS/7zhiel/rogTLQ2vMYwDzSJa4BiVNqGlqIMA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-directive/-/remark-directive-3.0.1.tgz", + "integrity": "sha512-gwglrEQEZcZYgVyG1tQuA+h58EZfq5CSULw7J90AFuCTyib1thgHPoqQ+h9iFvU6R+vnZ5oNFQR5QKgGpk741A==", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-directive": "^3.0.0", @@ -8010,9 +8037,9 @@ "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==" }, "node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "bin": { "semver": "bin/semver.js" }, @@ -8087,16 +8114,16 @@ } }, "node_modules/shiki": { - "version": "1.29.1", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.29.1.tgz", - "integrity": "sha512-TghWKV9pJTd/N+IgAIVJtr0qZkB7FfFCUrrEJc0aRmZupo3D1OCVRknQWVRVA7AX/M0Ld7QfoAruPzr3CnUJuw==", - "dependencies": { - "@shikijs/core": "1.29.1", - "@shikijs/engine-javascript": "1.29.1", - "@shikijs/engine-oniguruma": "1.29.1", - "@shikijs/langs": "1.29.1", - "@shikijs/themes": "1.29.1", - "@shikijs/types": "1.29.1", + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.29.2.tgz", + "integrity": "sha512-njXuliz/cP+67jU2hukkxCNuH1yUi4QfdZZY+sMr5PPrIyXSu5iTb/qYC4BiWWB0vZ+7TbdvYUCeL23zpwCfbg==", + "dependencies": { + "@shikijs/core": "1.29.2", + "@shikijs/engine-javascript": "1.29.2", + "@shikijs/engine-oniguruma": "1.29.2", + "@shikijs/langs": "1.29.2", + "@shikijs/themes": "1.29.2", + "@shikijs/types": "1.29.2", "@shikijs/vscode-textmate": "^10.0.1", "@types/hast": "^3.0.4" } @@ -8256,6 +8283,17 @@ "node": ">=8" } }, + "node_modules/smol-toml": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.3.1.tgz", + "integrity": "sha512-tEYNll18pPKHroYSmLLrksq233j021G0giwW7P3D24jC54pQ5W5BXMsQ/Mvw1OJCmEYDgY+lrzT+3nNUtoNfXQ==", + "engines": { + "node": ">= 18" + }, + "funding": { + "url": "https://github.com/sponsors/cyyynthia" + } + }, "node_modules/source-map": { "version": "0.7.4", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", @@ -9203,9 +9241,9 @@ } }, "node_modules/which-pm": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/which-pm/-/which-pm-3.0.0.tgz", - "integrity": "sha512-ysVYmw6+ZBhx3+ZkcPwRuJi38ZOTLJJ33PSHaitLxSKUMsh0LkKd0nC69zZCwt5D+AYUcMK2hhw4yWny20vSGg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/which-pm/-/which-pm-3.0.1.tgz", + "integrity": "sha512-v2JrMq0waAI4ju1xU5x3blsxBBMgdgZve580iYMN5frDaLGjbA24fok7wKCsya8KLVO19Ju4XDc5+zTZCJkQfg==", "dependencies": { "load-yaml-file": "^0.2.0" }, @@ -9300,9 +9338,9 @@ } }, "node_modules/yocto-spinner": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/yocto-spinner/-/yocto-spinner-0.1.2.tgz", - "integrity": "sha512-VfmLIh/ZSZOJnVRQZc/dvpPP90lWL4G0bmxQMP0+U/2vKBA8GSpcBuWv17y7F+CZItRuO97HN1wdbb4p10uhOg==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/yocto-spinner/-/yocto-spinner-0.2.0.tgz", + "integrity": "sha512-Qu6WAqNLGleB687CCGcmgHIo8l+J19MX/32UrSMfbf/4L8gLoxjpOYoiHT1asiWyqvjRZbgvOhLlvne6E5Tbdw==", "dependencies": { "yoctocolors": "^2.1.1" }, diff --git a/site/package.json b/site/package.json index 460f35dbaff..e4903c2d231 100644 --- a/site/package.json +++ b/site/package.json @@ -16,8 +16,8 @@ }, "license": "MIT", "dependencies": { - "@astrojs/starlight": "0.31.1", - "astro": "5.1.8", + "@astrojs/starlight": "^0.31.1", + "astro": "^5.1.9", "markdown-magic": "2.6.1", "sharp": "0.32.6", "strip-ansi": "7.1.0" From c9287c67a957bf656312d34b066e66353849027c Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Tue, 21 Jan 2025 12:36:53 -0500 Subject: [PATCH 09/12] fix(deps): upgrade to commander@12 --- package-lock.json | 46 ++++++++++++++++++++++++++++++++++++++-------- package.json | 2 +- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1263e23273f..ce3f7108d2e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,7 @@ "chokidar": "3.6.0", "ci-info": "4.1.0", "clean-deep": "3.4.0", - "commander": "10.0.1", + "commander": "12.1.0", "comment-json": "4.2.5", "configstore": "7.0.0", "content-type": "1.0.5", @@ -9768,11 +9768,11 @@ } }, "node_modules/commander": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", - "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", "engines": { - "node": ">=14" + "node": ">=18" } }, "node_modules/comment-json": { @@ -16298,6 +16298,14 @@ "node": ">=8" } }, + "node_modules/lambda-local/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "engines": { + "node": ">=14" + } + }, "node_modules/latest-version": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-9.0.0.tgz", @@ -19374,6 +19382,14 @@ "node": "^14.14.0 || >=16.0.0" } }, + "node_modules/precinct/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "engines": { + "node": ">=14" + } + }, "node_modules/precond": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/precond/-/precond-0.2.3.tgz", @@ -31046,9 +31062,9 @@ } }, "commander": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", - "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==" + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==" }, "comment-json": { "version": "4.2.5", @@ -35680,6 +35696,13 @@ "commander": "^10.0.1", "dotenv": "^16.3.1", "winston": "^3.10.0" + }, + "dependencies": { + "commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==" + } } }, "latest-version": { @@ -37904,6 +37927,13 @@ "detective-typescript": "^11.1.0", "module-definition": "^5.0.1", "node-source-walk": "^6.0.2" + }, + "dependencies": { + "commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==" + } } }, "precond": { diff --git a/package.json b/package.json index 8453c5bdd22..cffcb373f6a 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,7 @@ "chokidar": "3.6.0", "ci-info": "4.1.0", "clean-deep": "3.4.0", - "commander": "10.0.1", + "commander": "12.1.0", "comment-json": "4.2.5", "configstore": "7.0.0", "content-type": "1.0.5", From 01d3324fc0891c52200438b6e8855bf01130238d Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Tue, 4 Feb 2025 18:10:37 -0500 Subject: [PATCH 10/12] types(site): fix jsdoc types in docs script --- site/scripts/util/generate-command-data.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/scripts/util/generate-command-data.js b/site/scripts/util/generate-command-data.js index fd7bff867ba..f06e782e334 100644 --- a/site/scripts/util/generate-command-data.js +++ b/site/scripts/util/generate-command-data.js @@ -3,13 +3,13 @@ import { sortOptions } from '../../../dist/utils/command-helpers.js' const program = createMainCommand() -/** @type {Array} */ +/** @type {Array} */ // @ts-ignore typecast needed const commands = program.commands.sort((cmdA, cmdB) => cmdA.name().localeCompare(cmdB.name())) /** * - * @param {import('../../src/commands/base-command.js').default} command + * @param {import('../../../src/commands/base-command.js').default} command */ const parseCommand = function (command) { const args = command._args.map(({ _name: name, description }) => ({ From e68a091fb09de0ef48a1e59e981f21418c17b289 Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Fri, 21 Feb 2025 12:08:36 -0500 Subject: [PATCH 11/12] fix: remove `--json`, `--offline` from BaseCommand and centralize `--auth` only in `BaseCommand` commander@12 doesn't allow redefining the same option, so this pattern was no longer viable This was a pure refactor, but it uncovered some commands that weren't declaring options they were using, so I fixed those too. --- docs/commands/api.md | 1 + docs/commands/blobs.md | 5 +++++ docs/commands/build.md | 3 ++- docs/commands/completion.md | 2 ++ docs/commands/deploy.md | 6 +++--- docs/commands/dev.md | 6 ++++-- docs/commands/env.md | 17 ++++++++++++++--- docs/commands/functions.md | 12 ++++++++++-- docs/commands/init.md | 1 + docs/commands/link.md | 1 + docs/commands/login.md | 1 + docs/commands/logs.md | 3 +++ docs/commands/open.md | 3 +++ docs/commands/recipes.md | 2 ++ docs/commands/serve.md | 3 ++- docs/commands/sites.md | 9 +++++++-- docs/commands/status.md | 3 +++ docs/commands/switch.md | 1 + docs/commands/unlink.md | 1 + docs/commands/watch.md | 1 + src/commands/base-command.ts | 7 +++---- src/commands/blobs/blobs.ts | 5 ++--- src/commands/build/index.ts | 3 +-- src/commands/deploy/index.ts | 5 +---- src/commands/dev/dev.ts | 2 +- src/commands/env/env.ts | 9 ++++++--- src/commands/functions/functions.ts | 13 +++++++------ src/commands/serve/index.ts | 2 +- src/commands/sites/sites.ts | 5 ++--- src/commands/status/index.ts | 3 ++- .../help/__snapshots__/help.test.ts.snap | 2 ++ 31 files changed, 95 insertions(+), 42 deletions(-) diff --git a/docs/commands/api.md b/docs/commands/api.md index c7d96f01959..d55b2c558a5 100644 --- a/docs/commands/api.md +++ b/docs/commands/api.md @@ -27,6 +27,7 @@ netlify api - `data` (*string*) - Data to use - `list` (*boolean*) - List out available API methods - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/docs/commands/blobs.md b/docs/commands/blobs.md index 35d05b8263f..a0a6fb52b4f 100644 --- a/docs/commands/blobs.md +++ b/docs/commands/blobs.md @@ -20,6 +20,7 @@ netlify blobs - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in | Subcommand | description | |:--------------------------- |:-----| @@ -61,6 +62,7 @@ netlify blobs:delete - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `force` (*boolean*) - Bypasses prompts & Force the command to run. - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- ## `blobs:get` @@ -83,6 +85,7 @@ netlify blobs:get - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `output` (*string*) - Defines the filesystem path where the blob data should be persisted - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- ## `blobs:list` @@ -106,6 +109,7 @@ netlify blobs:list - `json` (*boolean*) - Output list contents as JSON - `prefix` (*string*) - A string for filtering down the entries; when specified, only the entries whose key starts with that prefix are returned - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- ## `blobs:set` @@ -130,6 +134,7 @@ netlify blobs:set - `force` (*boolean*) - Bypasses prompts & Force the command to run. - `input` (*string*) - Defines the filesystem path where the blob data should be read from - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- diff --git a/docs/commands/build.md b/docs/commands/build.md index 0ea8a5e1695..2863860f6c8 100644 --- a/docs/commands/build.md +++ b/docs/commands/build.md @@ -20,8 +20,9 @@ netlify build - `context` (*string*) - Specify a build context or branch (contexts: "production", "deploy-preview", "branch-deploy", "dev") - `dry` (*boolean*) - Dry run: show instructions without running them - `filter` (*string*) - For monorepos, specify the name of the application to run the command in -- `offline` (*boolean*) - disables any features that require network access - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `offline` (*boolean*) - Disables any features that require network access **Examples** diff --git a/docs/commands/completion.md b/docs/commands/completion.md index 5ea771346a1..71e9ee5d967 100644 --- a/docs/commands/completion.md +++ b/docs/commands/completion.md @@ -20,6 +20,7 @@ netlify completion **Flags** - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in | Subcommand | description | |:--------------------------- |:-----| @@ -47,6 +48,7 @@ netlify completion:install - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- diff --git a/docs/commands/deploy.md b/docs/commands/deploy.md index 38cfb7496d6..755fd1d62a8 100644 --- a/docs/commands/deploy.md +++ b/docs/commands/deploy.md @@ -85,7 +85,6 @@ netlify deploy **Flags** - `alias` (*string*) - Specifies the alias for deployment, the string at the beginning of the deploy subdomain. Useful for creating predictable deployment URLs. Avoid setting an alias string to the same value as a deployed branch. `alias` doesn’t create a branch deploy and can’t be used in conjunction with the branch subdomain feature. Maximum 37 characters. -- `auth` (*string*) - Netlify auth token to deploy with - `branch` (*string*) - Serves the same functionality as --alias. Deprecated and will be removed in future versions - `build` (*boolean*) - Run build command before deploying - `context` (*string*) - Context to use when resolving build configuration @@ -94,14 +93,15 @@ netlify deploy - `functions` (*string*) - Specify a functions folder to deploy - `json` (*boolean*) - Output deployment data as JSON - `message` (*string*) - A short message to include in the deploy log +- `prod-if-unlocked` (*boolean*) - Deploy to production if unlocked, create a draft otherwise +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `open` (*boolean*) - Open site after deploy - `prod` (*boolean*) - Deploy to production -- `prod-if-unlocked` (*boolean*) - Deploy to production if unlocked, create a draft otherwise - `site` (*string*) - A site name or ID to deploy to - `skip-functions-cache` (*boolean*) - Ignore any functions created as part of a previous `build` or `deploy` commands, forcing them to be bundled again as part of the deployment - `timeout` (*string*) - Timeout to wait for deployment to finish - `trigger` (*boolean*) - Trigger a new build of your site on Netlify without uploading local files -- `debug` (*boolean*) - Print debugging information **Examples** diff --git a/docs/commands/dev.md b/docs/commands/dev.md index fbd97898e1b..061f4f2fefb 100644 --- a/docs/commands/dev.md +++ b/docs/commands/dev.md @@ -32,10 +32,11 @@ netlify dev - `geo` (*cache | mock | update*) - force geolocation data to be updated, use cached data from the last 24h if found, or use a mock location - `live` (*string*) - start a public live session; optionally, supply a subdomain to generate a custom URL - `no-open` (*boolean*) - disables the automatic opening of a browser window -- `offline` (*boolean*) - disables any features that require network access +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `offline` (*boolean*) - Disables any features that require network access - `port` (*string*) - port of netlify dev - `target-port` (*string*) - port of target app server -- `debug` (*boolean*) - Print debugging information | Subcommand | description | |:--------------------------- |:-----| @@ -76,6 +77,7 @@ netlify dev:exec - `context` (*string*) - Specify a deploy context or branch for environment variables (contexts: "production", "deploy-preview", "branch-deploy", "dev") - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/docs/commands/env.md b/docs/commands/env.md index 2bb7047a4cf..c71b0491332 100644 --- a/docs/commands/env.md +++ b/docs/commands/env.md @@ -20,6 +20,7 @@ netlify env - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in | Subcommand | description | |:--------------------------- |:-----| @@ -60,6 +61,7 @@ netlify env:clone - `from` (*string*) - Site ID (From) - `to` (*string*) - Site ID (To) - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** @@ -87,8 +89,10 @@ netlify env:get - `context` (*string*) - Specify a deploy context or branch (contexts: "production", "deploy-preview", "branch-deploy", "dev") - `filter` (*string*) - For monorepos, specify the name of the application to run the command in -- `scope` (*builds | functions | post-processing | runtime | any*) - Specify a scope +- `json` (*boolean*) - Output environment variables as JSON - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `scope` (*builds | functions | post-processing | runtime | any*) - Specify a scope **Examples** @@ -117,8 +121,10 @@ netlify env:import **Flags** - `filter` (*string*) - For monorepos, specify the name of the application to run the command in +- `json` (*boolean*) - Output environment variables as JSON - `replace-existing` (*boolean*) - Replace all existing variables instead of merging them with the current ones - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- ## `env:list` @@ -136,9 +142,10 @@ netlify env:list - `context` (*string*) - Specify a deploy context or branch (contexts: "production", "deploy-preview", "branch-deploy", "dev") - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `json` (*boolean*) - Output environment variables as JSON -- `plain` (*boolean*) - Output environment variables as plaintext - `scope` (*builds | functions | post-processing | runtime | any*) - Specify a scope - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `plain` (*boolean*) - Output environment variables as plaintext **Examples** @@ -171,9 +178,11 @@ netlify env:set - `context` (*string*) - Specify a deploy context or branch (contexts: "production", "deploy-preview", "branch-deploy", "dev") (default: all contexts) - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `force` (*boolean*) - Bypasses prompts & Force the command to run. -- `scope` (*builds | functions | post-processing | runtime*) - Specify a scope (default: all scopes) +- `json` (*boolean*) - Output environment variables as JSON - `secret` (*boolean*) - Indicate whether the environment variable value can be read again. - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `scope` (*builds | functions | post-processing | runtime*) - Specify a scope (default: all scopes) **Examples** @@ -207,7 +216,9 @@ netlify env:unset - `context` (*string*) - Specify a deploy context or branch (contexts: "production", "deploy-preview", "branch-deploy", "dev") (default: all contexts) - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `force` (*boolean*) - Bypasses prompts & Force the command to run. +- `json` (*boolean*) - Output environment variables as JSON - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/docs/commands/functions.md b/docs/commands/functions.md index 84866a5a175..b416babf722 100644 --- a/docs/commands/functions.md +++ b/docs/commands/functions.md @@ -21,6 +21,7 @@ netlify functions - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in | Subcommand | description | |:--------------------------- |:-----| @@ -55,6 +56,7 @@ netlify functions:build - `functions` (*string*) - Specify a functions directory to build to - `src` (*string*) - Specify the source directory for the functions - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- ## `functions:create` @@ -76,8 +78,10 @@ netlify functions:create - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `language` (*string*) - function language - `name` (*string*) - function name +- `offline` (*boolean*) - Disables any features that require network access - `url` (*string*) - pull template from URL - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** @@ -109,10 +113,12 @@ netlify functions:invoke - `identity` (*boolean*) - simulate Netlify Identity authentication JWT. pass --identity to affirm unauthenticated request - `name` (*string*) - function name to invoke - `no-identity` (*boolean*) - simulate Netlify Identity authentication JWT. pass --no-identity to affirm unauthenticated request +- `offline` (*boolean*) - Disables any features that require network access - `payload` (*string*) - Supply POST payload in stringified json, or a path to a json file +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `port` (*string*) - Port where netlify dev is accessible. e.g. 8888 - `querystring` (*string*) - Querystring to add to your function invocation -- `debug` (*boolean*) - Print debugging information **Examples** @@ -147,6 +153,7 @@ netlify functions:list - `functions` (*string*) - Specify a functions directory to list - `json` (*boolean*) - Output function data as JSON - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- ## `functions:serve` @@ -163,9 +170,10 @@ netlify functions:serve - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `functions` (*string*) - Specify a functions directory to serve -- `offline` (*boolean*) - disables any features that require network access +- `offline` (*boolean*) - Disables any features that require network access - `port` (*string*) - Specify a port for the functions server - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- diff --git a/docs/commands/init.md b/docs/commands/init.md index fa354daf6f5..ac94e91c924 100644 --- a/docs/commands/init.md +++ b/docs/commands/init.md @@ -23,6 +23,7 @@ netlify init - `git-remote-name` (*string*) - Name of Git remote to use. e.g. "origin" - `manual` (*boolean*) - Manually configure a git remote for CI - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in diff --git a/docs/commands/link.md b/docs/commands/link.md index fc5e94fe17b..cd64f5ba93a 100644 --- a/docs/commands/link.md +++ b/docs/commands/link.md @@ -23,6 +23,7 @@ netlify link - `id` (*string*) - ID of site to link to - `name` (*string*) - Name of site to link to - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/docs/commands/login.md b/docs/commands/login.md index 03fa7fa6338..2fdd7b4865b 100644 --- a/docs/commands/login.md +++ b/docs/commands/login.md @@ -21,6 +21,7 @@ netlify login - `new` (*boolean*) - Login to new Netlify account - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in diff --git a/docs/commands/logs.md b/docs/commands/logs.md index 850437f1241..27aabad4e60 100644 --- a/docs/commands/logs.md +++ b/docs/commands/logs.md @@ -19,6 +19,7 @@ netlify logs - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in | Subcommand | description | |:--------------------------- |:-----| @@ -49,6 +50,7 @@ netlify logs:deploy - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- ## `logs:function` @@ -70,6 +72,7 @@ netlify logs:function - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `level` (*string*) - Log levels to stream. Choices are: trace, debug, info, warn, error, fatal - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/docs/commands/open.md b/docs/commands/open.md index 8e14f1dad95..cebe66693f7 100644 --- a/docs/commands/open.md +++ b/docs/commands/open.md @@ -21,6 +21,7 @@ netlify open - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `site` (*boolean*) - Open site - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in | Subcommand | description | |:--------------------------- |:-----| @@ -52,6 +53,7 @@ netlify open:admin - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** @@ -74,6 +76,7 @@ netlify open:site - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/docs/commands/recipes.md b/docs/commands/recipes.md index 18ba43a4784..dcd1ed9ced1 100644 --- a/docs/commands/recipes.md +++ b/docs/commands/recipes.md @@ -23,6 +23,7 @@ netlify recipes - `name` (*string*) - recipe name to use - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in | Subcommand | description | |:--------------------------- |:-----| @@ -51,6 +52,7 @@ netlify recipes:list - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/docs/commands/serve.md b/docs/commands/serve.md index e068864daa1..8306dda56b4 100644 --- a/docs/commands/serve.md +++ b/docs/commands/serve.md @@ -25,9 +25,10 @@ netlify serve - `functions` (*string*) - specify a functions folder to serve - `functions-port` (*string*) - port of functions server - `geo` (*cache | mock | update*) - force geolocation data to be updated, use cached data from the last 24h if found, or use a mock location -- `offline` (*boolean*) - disables any features that require network access +- `offline` (*boolean*) - Disables any features that require network access - `port` (*string*) - port of netlify dev - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/docs/commands/sites.md b/docs/commands/sites.md index cdaa4637316..4b4de740219 100644 --- a/docs/commands/sites.md +++ b/docs/commands/sites.md @@ -21,6 +21,7 @@ netlify sites - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in | Subcommand | description | |:--------------------------- |:-----| @@ -56,8 +57,9 @@ netlify sites:create - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `manual` (*boolean*) - force manual CI setup. Used --with-ci flag - `name` (*string*) - name of site -- `with-ci` (*boolean*) - initialize CI hooks during site creation - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `with-ci` (*boolean*) - initialize CI hooks during site creation --- ## `sites:create-template` @@ -81,8 +83,9 @@ netlify sites:create-template - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `name` (*string*) - name of site - `url` (*string*) - template url -- `with-ci` (*boolean*) - initialize CI hooks during site creation - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `with-ci` (*boolean*) - initialize CI hooks during site creation **Examples** @@ -113,6 +116,7 @@ netlify sites:delete - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `force` (*boolean*) - Delete without prompting (useful for CI). - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** @@ -136,6 +140,7 @@ netlify sites:list - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `json` (*boolean*) - Output site data as JSON - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- diff --git a/docs/commands/status.md b/docs/commands/status.md index 9dadcc59518..2a2d63014c7 100644 --- a/docs/commands/status.md +++ b/docs/commands/status.md @@ -18,8 +18,10 @@ netlify status **Flags** +- `json` (*boolean*) - Output status information as JSON - `verbose` (*boolean*) - Output system info - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in | Subcommand | description | |:--------------------------- |:-----| @@ -41,6 +43,7 @@ netlify status:hooks - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- diff --git a/docs/commands/switch.md b/docs/commands/switch.md index 3de2680cf34..97f8c1bf0f4 100644 --- a/docs/commands/switch.md +++ b/docs/commands/switch.md @@ -19,6 +19,7 @@ netlify switch **Flags** - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in diff --git a/docs/commands/unlink.md b/docs/commands/unlink.md index 9d8eeeb51f5..99ffea48d16 100644 --- a/docs/commands/unlink.md +++ b/docs/commands/unlink.md @@ -20,6 +20,7 @@ netlify unlink - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in diff --git a/docs/commands/watch.md b/docs/commands/watch.md index 24de1a78c00..ab13707eb23 100644 --- a/docs/commands/watch.md +++ b/docs/commands/watch.md @@ -20,6 +20,7 @@ netlify watch - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/src/commands/base-command.ts b/src/commands/base-command.ts index 46c857b58a6..4ec2c680369 100644 --- a/src/commands/base-command.ts +++ b/src/commands/base-command.ts @@ -183,13 +183,12 @@ export default class BaseCommand extends Command { */ createCommand(name: string): BaseCommand { const base = new BaseCommand(name) - // If --silent or --json flag passed disable logger // .addOption(new Option('--force', 'Force command to run. Bypasses prompts for certain destructive commands.')) - .addOption(new Option('--json', 'Output return values as JSON').hideHelp(true)) .addOption(new Option('--silent', 'Silence CLI output').hideHelp(true)) .addOption(new Option('--cwd ').hideHelp(true)) - .addOption(new Option('-o, --offline').default(false).hideHelp(true)) - .addOption(new Option('--auth ', 'Netlify auth token').hideHelp(true)) + .addOption( + new Option('--auth ', 'Netlify auth token - can be used to run this command without logging in'), + ) .addOption( new Option('--http-proxy [address]', 'Proxy server address to route requests through.') .default(process.env.HTTP_PROXY || process.env.HTTPS_PROXY) diff --git a/src/commands/blobs/blobs.ts b/src/commands/blobs/blobs.ts index 90dda3a00a2..5ffae120422 100644 --- a/src/commands/blobs/blobs.ts +++ b/src/commands/blobs/blobs.ts @@ -1,4 +1,4 @@ -import { Option, OptionValues } from 'commander' +import { OptionValues } from 'commander' import requiresSiteInfo from '../../utils/hooks/requires-site-info.js' import BaseCommand from '../base-command.js' @@ -53,8 +53,7 @@ export const createBlobsCommand = (program: BaseCommand) => { '-p, --prefix ', `A string for filtering down the entries; when specified, only the entries whose key starts with that prefix are returned`, ) - // The BaseCommand defines a `--json` option which is hidden from the help by default - .addHelpOption(new Option('--json', 'Output list contents as JSON')) + .option('--json', 'Output list contents as JSON') .alias('blob:list') .hook('preAction', requiresSiteInfo) .action(async (storeName: string, options: OptionValues, command: BaseCommand) => { diff --git a/src/commands/build/index.ts b/src/commands/build/index.ts index 5ae0664d1d9..35b11ef104c 100644 --- a/src/commands/build/index.ts +++ b/src/commands/build/index.ts @@ -2,7 +2,6 @@ import process from 'process' import { normalizeContext } from '../../utils/env/index.js' import BaseCommand from '../base-command.js' -import { Option } from 'commander' export const createBuildCommand = (program: BaseCommand) => program @@ -15,7 +14,7 @@ export const createBuildCommand = (program: BaseCommand) => process.env.CONTEXT || 'production', ) .option('--dry', 'Dry run: show instructions without running them', false) - .addHelpOption(new Option('-o, --offline', 'Disables any features that require network access')) + .option('-o, --offline', 'Disables any features that require network access') .addExamples(['netlify build']) .action(async (options, command) => { const { build } = await import('./build.js') diff --git a/src/commands/deploy/index.ts b/src/commands/deploy/index.ts index 23ba2e927c8..6c30d1f1d39 100644 --- a/src/commands/deploy/index.ts +++ b/src/commands/deploy/index.ts @@ -99,11 +99,8 @@ Support for package.json's main field, and intrinsic index.js entrypoints are co ) .option('-O, --open', 'Open site after deploy', false) .option('-m, --message ', 'A short message to include in the deploy log') - // The BaseCommand defines an `--auth` option which is hidden from the help by default - .addHelpOption(new Option('-a, --auth ', 'Netlify auth token to deploy with')) .option('-s, --site ', 'A site name or ID to deploy to', env.NETLIFY_SITE_ID) - // The BaseCommand defines a `--json` option which is hidden from the help by default - .addHelpOption(new Option('--json', 'Output deployment data as JSON')) + .option('--json', 'Output deployment data as JSON') .option('--timeout ', 'Timeout to wait for deployment to finish', (value) => Number.parseInt(value)) .addOption( new Option('--trigger', 'Trigger a new build of your site on Netlify without uploading local files').conflicts( diff --git a/src/commands/dev/dev.ts b/src/commands/dev/dev.ts index dea5d2f0b00..c37d4686727 100644 --- a/src/commands/dev/dev.ts +++ b/src/commands/dev/dev.ts @@ -272,7 +272,7 @@ export const createDevCommand = (program: BaseCommand) => { .option('--framework ', 'framework to use. Defaults to #auto which automatically detects a framework') .option('-d ,--dir ', 'dir with static files') .option('-f ,--functions ', 'specify a functions folder to serve') - .addHelpOption(new Option('-o, --offline', 'Disables any features that require network access')) + .option('-o, --offline', 'Disables any features that require network access') .addOption( new Option('--offline-env', 'disables fetching environment variables from the Netlify API').hideHelp(true), ) diff --git a/src/commands/env/env.ts b/src/commands/env/env.ts index 9a16f28a924..8f031aa2947 100644 --- a/src/commands/env/env.ts +++ b/src/commands/env/env.ts @@ -3,7 +3,7 @@ import { OptionValues, Option } from 'commander' import { normalizeContext } from '../../utils/env/index.js' import BaseCommand from '../base-command.js' -const env = (options: OptionValues, command: BaseCommand) => { +const env = (_options: OptionValues, command: BaseCommand) => { command.help() } @@ -17,6 +17,7 @@ export const createEnvCommand = (program: BaseCommand) => { normalizeContext, 'dev', ) + .option('--json', 'Output environment variables as JSON') .addOption( new Option('-s, --scope ', 'Specify a scope') .choices(['builds', 'functions', 'post-processing', 'runtime', 'any']) @@ -42,6 +43,7 @@ export const createEnvCommand = (program: BaseCommand) => { 'Replace all existing variables instead of merging them with the current ones', false, ) + .option('--json', 'Output environment variables as JSON') .description('Import and set environment variables from .env file') .action(async (fileName: string, options: OptionValues, command: BaseCommand) => { const { envImport } = await import('./env-import.js') @@ -56,8 +58,7 @@ export const createEnvCommand = (program: BaseCommand) => { normalizeContext, 'dev', ) - // The BaseCommand defines a `--json` option which is hidden from the help by default - .addHelpOption(new Option('--json', 'Output environment variables as JSON')) + .option('--json', 'Output environment variables as JSON') .addOption(new Option('--plain', 'Output environment variables as plaintext').conflicts('json')) .addOption( new Option('-s, --scope ', 'Specify a scope') @@ -88,6 +89,7 @@ export const createEnvCommand = (program: BaseCommand) => { // @ts-expect-error TS(7006) FIXME: Parameter 'context' implicitly has an 'any' type. (context, previous = []) => [...previous, normalizeContext(context)], ) + .option('--json', 'Output environment variables as JSON') .addOption( new Option('-s, --scope ', 'Specify a scope (default: all scopes)').choices([ 'builds', @@ -123,6 +125,7 @@ export const createEnvCommand = (program: BaseCommand) => { // @ts-expect-error TS(7006) FIXME: Parameter 'context' implicitly has an 'any' type. (context, previous = []) => [...previous, normalizeContext(context)], ) + .option('--json', 'Output environment variables as JSON') .addExamples([ 'netlify env:unset VAR_NAME # unset in all contexts', 'netlify env:unset VAR_NAME --context production', diff --git a/src/commands/functions/functions.ts b/src/commands/functions/functions.ts index 48ba93d4338..95ac5094c96 100644 --- a/src/commands/functions/functions.ts +++ b/src/commands/functions/functions.ts @@ -1,10 +1,10 @@ -import { Option, OptionValues } from 'commander' +import type { OptionValues } from 'commander' import { chalk } from '../../utils/command-helpers.js' import requiresSiteInfo from '../../utils/hooks/requires-site-info.js' -import BaseCommand from '../base-command.js' +import type BaseCommand from '../base-command.js' -const functions = (options: OptionValues, command: BaseCommand) => { +const functions = (_options: OptionValues, command: BaseCommand) => { command.help() } @@ -28,6 +28,7 @@ export const createFunctionsCommand = (program: BaseCommand) => { .option('-n, --name ', 'function name') .option('-u, --url ', 'pull template from URL') .option('-l, --language ', 'function language') + .option('-o, --offline', 'Disables any features that require network access') .addExamples([ 'netlify functions:create', 'netlify functions:create hello-world', @@ -59,6 +60,7 @@ export const createFunctionsCommand = (program: BaseCommand) => { 'simulate Netlify Identity authentication JWT. pass --no-identity to affirm unauthenticated request', ) .option('--port ', 'Port where netlify dev is accessible. e.g. 8888', (value) => Number.parseInt(value)) + .option('-o, --offline', 'Disables any features that require network access') .addExamples([ 'netlify functions:invoke', 'netlify functions:invoke myfunction', @@ -84,8 +86,7 @@ Helpful for making sure that you have formatted your functions correctly NOT the same as listing the functions that have been deployed. For that info you need to go to your Netlify deploy log.`, ) .option('-f, --functions ', 'Specify a functions directory to list') - // The BaseCommand defines a `--json` option which is hidden from the help by default - .addHelpOption(new Option('--json', 'Output function data as JSON')) + .option('--json', 'Output function data as JSON') .hook('preAction', requiresSiteInfo) .action(async (options: OptionValues, command: BaseCommand) => { const { functionsList } = await import('./functions-list.js') @@ -98,7 +99,7 @@ NOT the same as listing the functions that have been deployed. For that info you .description('Serve functions locally') .option('-f, --functions ', 'Specify a functions directory to serve') .option('-p, --port ', 'Specify a port for the functions server', (value) => Number.parseInt(value)) - .addHelpOption(new Option('-o, --offline', 'Disables any features that require network access')) + .option('-o, --offline', 'Disables any features that require network access') .addHelpText('after', 'Helpful for debugging functions.') .action(async (options: OptionValues, command: BaseCommand) => { const { functionsServe } = await import('./functions-serve.js') diff --git a/src/commands/serve/index.ts b/src/commands/serve/index.ts index 68d25698596..67c27023349 100644 --- a/src/commands/serve/index.ts +++ b/src/commands/serve/index.ts @@ -18,7 +18,7 @@ export const createServeCommand = (program: BaseCommand) => .option('-p ,--port ', 'port of netlify dev', (value) => Number.parseInt(value)) .option('-d ,--dir ', 'dir with static files') .option('-f ,--functions ', 'specify a functions folder to serve') - .addHelpOption(new Option('-o, --offline', 'Disables any features that require network access')) + .option('-o, --offline', 'Disables any features that require network access') .addOption( new Option( '--internal-disable-edge-functions', diff --git a/src/commands/sites/sites.ts b/src/commands/sites/sites.ts index a7f3cb64bd5..cd8d1652bd4 100644 --- a/src/commands/sites/sites.ts +++ b/src/commands/sites/sites.ts @@ -1,4 +1,4 @@ -import { OptionValues, InvalidArgumentError, Option } from 'commander' +import { OptionValues, InvalidArgumentError } from 'commander' import BaseCommand from '../base-command.js' @@ -71,8 +71,7 @@ export const createSitesCommand = (program: BaseCommand) => { program .command('sites:list') .description('List all sites you have access to') - // The BaseCommand defines a `--json` option which is hidden from the help by default - .addHelpOption(new Option('--json', 'Output site data as JSON')) + .option('--json', 'Output site data as JSON') .action(async (options: OptionValues, command: BaseCommand) => { const { sitesList } = await import('./sites-list.js') await sitesList(options, command) diff --git a/src/commands/status/index.ts b/src/commands/status/index.ts index 0804f9d4823..f35d6f16abb 100644 --- a/src/commands/status/index.ts +++ b/src/commands/status/index.ts @@ -13,10 +13,11 @@ export const createStatusCommand = (program: BaseCommand) => { await statusHooks(options, command) }) - return program + program .command('status') .description('Print status information') .option('--verbose', 'Output system info') + .option('--json', 'Output status information as JSON') .action(async (options: OptionValues, command: BaseCommand) => { const { status } = await import('./status.js') await status(options, command) diff --git a/tests/integration/commands/help/__snapshots__/help.test.ts.snap b/tests/integration/commands/help/__snapshots__/help.test.ts.snap index 46cecc63aab..7d80da7b26f 100644 --- a/tests/integration/commands/help/__snapshots__/help.test.ts.snap +++ b/tests/integration/commands/help/__snapshots__/help.test.ts.snap @@ -44,6 +44,8 @@ USAGE OPTIONS -h, --help display help for command --debug Print debugging information + --auth Netlify auth token - can be used to run this command + without logging in DESCRIPTION Run this command to see instructions for your shell. From 2decd3fcb2704963c4abf360f59574ee96539fc6 Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Fri, 21 Feb 2025 15:17:17 -0500 Subject: [PATCH 12/12] fix: undo unnecessary short flag change --- src/commands/env/env.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/env/env.ts b/src/commands/env/env.ts index 8f031aa2947..a0a8ca25ce3 100644 --- a/src/commands/env/env.ts +++ b/src/commands/env/env.ts @@ -39,7 +39,7 @@ export const createEnvCommand = (program: BaseCommand) => { .command('env:import') .argument('', '.env file to import') .option( - '-R, --replace-existing', + '-r, --replace-existing', 'Replace all existing variables instead of merging them with the current ones', false, )