diff --git a/src/commands/blobs/blobs-set.ts b/src/commands/blobs/blobs-set.ts index 017b1040a29..e4e76bdf53b 100644 --- a/src/commands/blobs/blobs-set.ts +++ b/src/commands/blobs/blobs-set.ts @@ -11,7 +11,6 @@ interface Options extends OptionValues { input?: string } - export const blobsSet = async ( storeName: string, key: string, diff --git a/src/commands/dev/dev.ts b/src/commands/dev/dev.ts index 016e4a7f8a9..62eda3e7a43 100644 --- a/src/commands/dev/dev.ts +++ b/src/commands/dev/dev.ts @@ -230,110 +230,107 @@ export const dev = async (options: OptionValues, command: BaseCommand) => { printBanner({ url }) } - export const createDevCommand = (program: BaseCommand) => { createDevExecCommand(program) - return ( - program - .command('dev') - .alias('develop') - .description( - `Local dev server\nThe dev command will run a local dev server with Netlify's proxy and redirect rules`, - ) - .option('-c ,--command ', 'command to run') - .option( - '--context ', - 'Specify a deploy context or branch for environment variables (contexts: "production", "deploy-preview", "branch-deploy", "dev")', - normalizeContext, - ) - .option('-p ,--port ', 'port of netlify dev', (value) => Number.parseInt(value)) - .addOption( - new Option('--targetPort ', 'Old, prefer --target-port. Port of target app server') - .argParser((value) => Number.parseInt(value)) - .hideHelp(true), - ) - .addOption(new Option('--no-open', 'disables the automatic opening of a browser window')) - .option('--target-port ', 'port of target app server', (value) => Number.parseInt(value)) - .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') - .option( - '-l, --live [subdomain]', - 'start a public live session; optionally, supply a subdomain to generate a custom URL', - false, - ) - .addOption( - new Option('--functionsPort ', 'Old, prefer --functions-port. Port of functions server') - .argParser((value) => Number.parseInt(value)) - .hideHelp(true), - ) - .option('--functions-port ', 'port of functions server', (value) => Number.parseInt(value)) - .addOption( - new Option( - '--geo ', - 'force geolocation data to be updated, use cached data from the last 24h if found, or use a mock location', - ) - .choices(['cache', 'mock', 'update']) - .default('cache'), - ) - .addOption( - new Option( - '--country ', - 'Two-letter country code (https://ntl.fyi/country-codes) to use as mock geolocation (enables --geo=mock automatically)', - ).argParser(getGeoCountryArgParser('netlify dev --geo=mock --country=FR')), - ) - .addOption( - new Option('--staticServerPort ', 'port of the static app server used when no framework is detected') - .argParser((value) => Number.parseInt(value)) - .hideHelp(), + return program + .command('dev') + .alias('develop') + .description( + `Local dev server\nThe dev command will run a local dev server with Netlify's proxy and redirect rules`, + ) + .option('-c ,--command ', 'command to run') + .option( + '--context ', + 'Specify a deploy context or branch for environment variables (contexts: "production", "deploy-preview", "branch-deploy", "dev")', + normalizeContext, + ) + .option('-p ,--port ', 'port of netlify dev', (value) => Number.parseInt(value)) + .addOption( + new Option('--targetPort ', 'Old, prefer --target-port. Port of target app server') + .argParser((value) => Number.parseInt(value)) + .hideHelp(true), + ) + .addOption(new Option('--no-open', 'disables the automatic opening of a browser window')) + .option('--target-port ', 'port of target app server', (value) => Number.parseInt(value)) + .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') + .option( + '-l, --live [subdomain]', + 'start a public live session; optionally, supply a subdomain to generate a custom URL', + false, + ) + .addOption( + new Option('--functionsPort ', 'Old, prefer --functions-port. Port of functions server') + .argParser((value) => Number.parseInt(value)) + .hideHelp(true), + ) + .option('--functions-port ', 'port of functions server', (value) => Number.parseInt(value)) + .addOption( + new Option( + '--geo ', + 'force geolocation data to be updated, use cached data from the last 24h if found, or use a mock location', ) - .addOption( - new Option( - '-e, --edgeInspect [address]', - 'Old, prefer --edge-inspect. Enable the V8 Inspector Protocol for Edge Functions, with an optional address in the host:port format', - ) - .conflicts('edgeInspectBrk') - .argParser(validateShortFlagArgs) - .hideHelp(true), + .choices(['cache', 'mock', 'update']) + .default('cache'), + ) + .addOption( + new Option( + '--country ', + 'Two-letter country code (https://ntl.fyi/country-codes) to use as mock geolocation (enables --geo=mock automatically)', + ).argParser(getGeoCountryArgParser('netlify dev --geo=mock --country=FR')), + ) + .addOption( + new Option('--staticServerPort ', 'port of the static app server used when no framework is detected') + .argParser((value) => Number.parseInt(value)) + .hideHelp(), + ) + .addOption( + new Option( + '-e, --edgeInspect [address]', + 'Old, prefer --edge-inspect. Enable the V8 Inspector Protocol for Edge Functions, with an optional address in the host:port format', ) - .addOption( - new Option( - '-e, --edge-inspect [address]', - 'enable the V8 Inspector Protocol for Edge Functions, with an optional address in the host:port format', - ) - .conflicts('edgeInspectBrk') - .argParser(validateShortFlagArgs), + .conflicts('edgeInspectBrk') + .argParser(validateShortFlagArgs) + .hideHelp(true), + ) + .addOption( + new Option( + '-e, --edge-inspect [address]', + 'enable the V8 Inspector Protocol for Edge Functions, with an optional address in the host:port format', ) - .addOption( - new Option( - '-E, --edgeInspectBrk [address]', - 'Old, prefer --edge-inspect-brk. Enable the V8 Inspector Protocol for Edge Functions and pause execution on the first line of code, with an optional address in the host:port format', - ) - .conflicts('edgeInspect') - .hideHelp(true) - .argParser(validateShortFlagArgs), + .conflicts('edgeInspectBrk') + .argParser(validateShortFlagArgs), + ) + .addOption( + new Option( + '-E, --edgeInspectBrk [address]', + 'Old, prefer --edge-inspect-brk. Enable the V8 Inspector Protocol for Edge Functions and pause execution on the first line of code, with an optional address in the host:port format', ) - .addOption( - new Option( - '-E, --edge-inspect-brk [address]', - 'enable the V8 Inspector Protocol for Edge Functions and pause execution on the first line of code, with an optional address in the host:port format', - ) - .conflicts('edgeInspect') - .argParser(validateShortFlagArgs), + .conflicts('edgeInspect') + .hideHelp(true) + .argParser(validateShortFlagArgs), + ) + .addOption( + new Option( + '-E, --edge-inspect-brk [address]', + 'enable the V8 Inspector Protocol for Edge Functions and pause execution on the first line of code, with an optional address in the host:port format', ) - .addExamples([ - 'netlify dev', - 'netlify dev -d public', - 'netlify dev -c "hugo server -w" --target-port 1313', - 'netlify dev --context production', - 'netlify dev --edge-inspect', - 'netlify dev --edge-inspect=127.0.0.1:9229', - 'netlify dev --edge-inspect-brk', - 'netlify dev --edge-inspect-brk=127.0.0.1:9229', - 'BROWSER=none netlify dev # disable browser auto opening', - ]) - .action(dev) - ) + .conflicts('edgeInspect') + .argParser(validateShortFlagArgs), + ) + .addExamples([ + 'netlify dev', + 'netlify dev -d public', + 'netlify dev -c "hugo server -w" --target-port 1313', + 'netlify dev --context production', + 'netlify dev --edge-inspect', + 'netlify dev --edge-inspect=127.0.0.1:9229', + 'netlify dev --edge-inspect-brk', + 'netlify dev --edge-inspect-brk=127.0.0.1:9229', + 'BROWSER=none netlify dev # disable browser auto opening', + ]) + .action(dev) } diff --git a/src/commands/logs/functions.ts b/src/commands/logs/functions.ts index e966114db60..dc84063bee2 100644 --- a/src/commands/logs/functions.ts +++ b/src/commands/logs/functions.ts @@ -7,7 +7,6 @@ import type BaseCommand from '../base-command.js' import { CLI_LOG_LEVEL_CHOICES_STRING, LOG_LEVELS, LOG_LEVELS_LIST } from './log-levels.js' - function getLog(logData: { level: string; message: string }) { let logString = '' switch (logData.level) { diff --git a/tests/integration/commands/sites/sites.test.ts b/tests/integration/commands/sites/sites.test.ts index caaecbf89fa..1727e3f702b 100644 --- a/tests/integration/commands/sites/sites.test.ts +++ b/tests/integration/commands/sites/sites.test.ts @@ -5,12 +5,8 @@ import { render } from 'prettyjson' import { afterAll, beforeEach, describe, expect, test, vi } from 'vitest' import BaseCommand from '../../../../src/commands/base-command.js' -import { - fetchTemplates, -} from '../../../../src/commands/sites/sites-create-template.js' -import { createSitesCreateCommand , - createSitesFromTemplateCommand -} from '../../../../src/commands/sites/sites.js' +import { fetchTemplates } from '../../../../src/commands/sites/sites-create-template.js' +import { createSitesCreateCommand, createSitesFromTemplateCommand } from '../../../../src/commands/sites/sites.js' import { getGitHubToken } from '../../../../src/utils/init/config-github.js' import { createRepo, getTemplatesFromGitHub } from '../../../../src/utils/sites/utils.js' import { getEnvironmentVariables, withMockApi } from '../../utils/mock-api.js'