Skip to content

Commit

Permalink
chore: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahetter committed Nov 17, 2023
1 parent fac8ecc commit ca739d5
Show file tree
Hide file tree
Showing 59 changed files with 269 additions and 334 deletions.
1 change: 0 additions & 1 deletion src/commands/addons/addons-auth.mts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { exit, log } from '../../utils/command-helpers.mjs'
import openBrowser from '../../utils/open-browser.mjs'
import BaseCommand from '../base-command.mjs'


export const addonsAuth = async (addonName: string, options: OptionValues, command: BaseCommand) => {
const { addon } = await prepareAddonCommand({
command,
Expand Down
1 change: 0 additions & 1 deletion src/commands/addons/addons-create.mts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const createAddon = async ({ addonName, api, config, siteData, siteId }) => {
}
}


export const addonsCreate = async (addonName: string, options: OptionValues, command: BaseCommand) => {
const { manifest, siteData } = await prepareAddonCommand({
command,
Expand Down
1 change: 0 additions & 1 deletion src/commands/addons/addons-list.mts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { prepareAddonCommand } from '../../utils/addons/prepare.mjs'
import { log, logJson } from '../../utils/command-helpers.mjs'
import BaseCommand from '../base-command.mjs'


export const addonsList = async (options: OptionValues, command: BaseCommand) => {
// @ts-expect-error TS(2345) FIXME: Argument of type '{ command: any; }' is not assign... Remove this comment to see the full error message
const { addons, siteData } = await prepareAddonCommand({ command })
Expand Down
99 changes: 49 additions & 50 deletions src/commands/addons/addons.mts
Original file line number Diff line number Diff line change
Expand Up @@ -8,65 +8,64 @@ const addons = (options: OptionValues, command: BaseCommand) => {

export const createAddonsCommand = (program: BaseCommand) => {
program
.command('addons:auth', { hidden: true })
.alias('addon:auth')
.argument('<name>', 'Add-on slug')
.description('Login to add-on provider')
.action(async (addonName: string, options: OptionValues, command: BaseCommand) => {
const { addonsAuth } = await import('./addons-auth.mjs')
await addonsAuth(addonName, options, command)
})
.command('addons:auth', { hidden: true })
.alias('addon:auth')
.argument('<name>', 'Add-on slug')
.description('Login to add-on provider')
.action(async (addonName: string, options: OptionValues, command: BaseCommand) => {
const { addonsAuth } = await import('./addons-auth.mjs')
await addonsAuth(addonName, options, command)
})

program
.command('addons:config', { hidden: true })
.alias('addon:config')
.argument('<name>', 'Add-on namespace')
.description('Configure add-on settings')
// allow for any flags. Handy for variadic configuration options
.allowUnknownOption(true)
.action(async (addonName: string, options: OptionValues, command: BaseCommand) => {
const { addonsConfig } = await import('./addons-config.mjs')
await addonsConfig(addonName, options, command)
})
.command('addons:config', { hidden: true })
.alias('addon:config')
.argument('<name>', 'Add-on namespace')
.description('Configure add-on settings')
// allow for any flags. Handy for variadic configuration options
.allowUnknownOption(true)
.action(async (addonName: string, options: OptionValues, command: BaseCommand) => {
const { addonsConfig } = await import('./addons-config.mjs')
await addonsConfig(addonName, options, command)
})

program
.command('addons:create', { hidden: true })
.alias('addon:create')
.argument('<name>', 'Add-on namespace')
.description(
`Add an add-on extension to your site
.command('addons:create', { hidden: true })
.alias('addon:create')
.argument('<name>', 'Add-on namespace')
.description(
`Add an add-on extension to your site
Add-ons are a way to extend the functionality of your Netlify site`,
)
// allow for any flags. Handy for variadic configuration options
.allowUnknownOption(true)
.action(async (addonName: string, options: OptionValues, command: BaseCommand) => {
const { addonsCreate } = await import('./addons-create.mjs')
await addonsCreate(addonName, options, command)
})
)
// allow for any flags. Handy for variadic configuration options
.allowUnknownOption(true)
.action(async (addonName: string, options: OptionValues, command: BaseCommand) => {
const { addonsCreate } = await import('./addons-create.mjs')
await addonsCreate(addonName, options, command)
})

program
.command('addons:delete', { hidden: true })
.alias('addon:delete')
.argument('<name>', 'Add-on namespace')
.description(
`Remove an add-on extension to your site\nAdd-ons are a way to extend the functionality of your Netlify site`,
)
.option('-f, --force', 'delete without prompting (useful for CI)')
.action(async (addonName: string, options: OptionValues, command: BaseCommand) => {
const { addonsDelete } = await import('./addons-delete.mjs')
await addonsDelete(addonName, options, command)
})

.command('addons:delete', { hidden: true })
.alias('addon:delete')
.argument('<name>', 'Add-on namespace')
.description(
`Remove an add-on extension to your site\nAdd-ons are a way to extend the functionality of your Netlify site`,
)
.option('-f, --force', 'delete without prompting (useful for CI)')
.action(async (addonName: string, options: OptionValues, command: BaseCommand) => {
const { addonsDelete } = await import('./addons-delete.mjs')
await addonsDelete(addonName, options, command)
})

program
.command('addons:list', { hidden: true })
.alias('addon:list')
.description(`List currently installed add-ons for site`)
.option('--json', 'Output add-on data as JSON')
.action(async (options: OptionValues, command: BaseCommand) => {
const {addonsList} = await import('./addons-list.mjs')
await addonsList(options, command)
})
.command('addons:list', { hidden: true })
.alias('addon:list')
.description(`List currently installed add-ons for site`)
.option('--json', 'Output add-on data as JSON')
.action(async (options: OptionValues, command: BaseCommand) => {
const { addonsList } = await import('./addons-list.mjs')
await addonsList(options, command)
})

return program
.command('addons', { hidden: true })
Expand Down
2 changes: 0 additions & 2 deletions src/commands/api/api.mts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { methods } from 'netlify'
import { chalk, error, exit, log, logJson } from '../../utils/command-helpers.mjs'
import BaseCommand from '../base-command.mjs'


export const apiCommand = async (apiMethod: string, options: OptionValues, command: BaseCommand) => {
const { api } = command.netlify

Expand Down Expand Up @@ -45,4 +44,3 @@ export const apiCommand = async (apiMethod: string, options: OptionValues, comma
error(error_)
}
}

8 changes: 4 additions & 4 deletions src/commands/api/index.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { chalk } from '../../utils/command-helpers.mjs'
import BaseCommand from "../base-command.mjs";
import { chalk } from '../../utils/command-helpers.mjs'
import BaseCommand from '../base-command.mjs'

export const createApiCommand = (program: BaseCommand) =>
program
Expand All @@ -16,5 +16,5 @@ For more information on available methods checkout https://open-api.netlify.com/
.addExamples(['netlify api --list', `netlify api getSite --data '{ "site_id": "123456" }'`])
.action(async (apiMethod, options, command) => {
const { apiCommand } = await import('./api.mjs')
await apiCommand(apiMethod, options, command )
} )
await apiCommand(apiMethod, options, command)
})
8 changes: 7 additions & 1 deletion src/commands/blobs/blobs-set.mts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ interface Options extends OptionValues {
}

// eslint-disable-next-line max-params
export const blobsSet = async (storeName: string, key: string, valueParts: string[], options: Options, command: BaseCommand) => {
export const blobsSet = async (
storeName: string,
key: string,
valueParts: string[],
options: Options,
command: BaseCommand,
) => {
const { api, siteInfo } = command.netlify
const { input } = options
const store = getStore({
Expand Down
20 changes: 11 additions & 9 deletions src/commands/blobs/blobs.mts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const createBlobsCommand = (program: BaseCommand) => {
await blobsDelete(storeName, key, _options, command)
})

program
program
.command('blobs:get')
.description(
`(Beta) Reads an object with a given key from a Netlify Blobs store and, if it exists, prints the content to the terminal or saves it to a file`,
Expand All @@ -36,12 +36,12 @@ export const createBlobsCommand = (program: BaseCommand) => {
.option('-o, --output <path>', '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) => {
.action(async (storeName: string, key: string, options: OptionValues, command: BaseCommand) => {
const { blobsGet } = await import('./blobs-get.mjs')
await blobsGet(storeName, key, options, command)
})

program
program
.command('blobs:list')
.description(`(Beta) Lists objects in a Netlify Blobs store`)
.argument('<store>', 'Name of the store')
Expand All @@ -56,12 +56,12 @@ export const createBlobsCommand = (program: BaseCommand) => {
.option('--json', `Output list contents as JSON`)
.alias('blob:list')
.hook('preAction', requiresSiteInfo)
.action(async(storeName: string, options: OptionValues, command: BaseCommand) => {
.action(async (storeName: string, options: OptionValues, command: BaseCommand) => {
const { blobsList } = await import('./blobs-list.mjs')
await blobsList(storeName, options, command)
})

program
program
.command('blobs:set')
.description(
`(Beta) Writes to a Netlify Blobs store an object with the data provided in the command or the contents of a file defined by the 'input' parameter`,
Expand All @@ -73,10 +73,12 @@ export const createBlobsCommand = (program: BaseCommand) => {
.alias('blob:set')
.hook('preAction', requiresSiteInfo)
// eslint-disable-next-line max-params
.action(async(storeName: string, key: string, valueParts: string[], options: OptionValues, command: BaseCommand) => {
const { blobsSet } = await import('./blobs-set.mjs')
await blobsSet(storeName, key, valueParts, options, command)
})
.action(
async (storeName: string, key: string, valueParts: string[], options: OptionValues, command: BaseCommand) => {
const { blobsSet } = await import('./blobs-set.mjs')
await blobsSet(storeName, key, valueParts, options, command)
},
)

return program
.command('blobs')
Expand Down
4 changes: 1 addition & 3 deletions src/commands/build/build.mts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const injectEnv = async function (command, { api, buildOptions, context, siteInf
}
}


export const build = async (options: OptionValues, command: BaseCommand) => {
const { cachedConfig, siteInfo } = command.netlify
command.setAnalyticsPayload({ dry: options.dry })
Expand All @@ -53,7 +52,7 @@ export const build = async (options: OptionValues, command: BaseCommand) => {
packagePath: command.workspacePackage,
currentDir: command.workingDir,
token,
// @ts-expect-error TS(2740)
// @ts-expect-error TS(2740)
options,
})

Expand All @@ -68,4 +67,3 @@ export const build = async (options: OptionValues, command: BaseCommand) => {
const { exitCode } = await runBuild(buildOptions)
exit(exitCode)
}

6 changes: 3 additions & 3 deletions src/commands/build/index.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import process from 'process'

import { normalizeContext } from '../../utils/env/index.mjs'
import BaseCommand from "../base-command.mjs";
import BaseCommand from '../base-command.mjs'

export const createBuildCommand = (program: BaseCommand) =>
program
Expand All @@ -16,7 +16,7 @@ export const createBuildCommand = (program: BaseCommand) =>
.option('--dry', 'Dry run: show instructions without running them', false)
.option('-o, --offline', 'disables any features that require network access', false)
.addExamples(['netlify build'])
.action(async(options, command) => {
.action(async (options, command) => {
const { build } = await import('./build.mjs')
await build(options, command )
await build(options, command)
})
9 changes: 4 additions & 5 deletions src/commands/completion/index.mts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { OptionValues } from "commander"

import BaseCommand from "../base-command.mjs"
import { OptionValues } from 'commander'

import BaseCommand from '../base-command.mjs'

export const createCompletionCommand = (program: BaseCommand) => {
program
.command('completion:install')
.alias('completion:generate')
.description('Generates completion script for your preferred shell')
.action(async(options: OptionValues, command: BaseCommand) => {
.action(async (options: OptionValues, command: BaseCommand) => {
const { completionGenerate } = await import('./completion.mjs')
await completionGenerate(options, command)
})
Expand All @@ -18,7 +17,7 @@ export const createCompletionCommand = (program: BaseCommand) => {
.alias('completion:remove')
.description('Uninstalls the installed completions')
.addExamples(['netlify completion:uninstall'])
.action(async(options: OptionValues, command: BaseCommand) => {
.action(async (options: OptionValues, command: BaseCommand) => {
const { completionUninstall } = await import('./completion.mjs')
await completionUninstall(options, command)
})
Expand Down
1 change: 0 additions & 1 deletion src/commands/deploy/deploy.mts
Original file line number Diff line number Diff line change
Expand Up @@ -819,4 +819,3 @@ export const deploy = async (options: OptionValues, command: BaseCommand) => {
exit()
}
}

3 changes: 1 addition & 2 deletions src/commands/dev/dev-exec.mts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { getDotEnvVariables, injectEnvVariables } from '../../utils/dev.mjs'
import { getEnvelopeEnv } from '../../utils/env/index.mjs'
import BaseCommand from '../base-command.mjs'


export const devExec = async (cmd:string, options: OptionValues, command: BaseCommand) => {
export const devExec = async (cmd: string, options: OptionValues, command: BaseCommand) => {
const { api, cachedConfig, config, site, siteInfo } = command.netlify

let { env } = cachedConfig
Expand Down
2 changes: 0 additions & 2 deletions src/commands/dev/dev.mts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { getProxyUrl } from '../../utils/proxy.mjs'
import { runDevTimeline } from '../../utils/run-build.mjs'
import BaseCommand from '../base-command.mjs'


/**
*
* @param {object} config
Expand Down Expand Up @@ -66,7 +65,6 @@ const handleLiveTunnel = async ({ api, options, settings, site, state }) => {
}
}


export const dev = async (options: OptionValues, command: BaseCommand) => {
log(`${NETLIFYDEV}`)
const { api, cachedConfig, config, repositoryRoot, site, siteInfo, state } = command.netlify
Expand Down
42 changes: 19 additions & 23 deletions src/commands/dev/index.mts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { Option, OptionValues } from 'commander'

import {
BANG,
chalk,
} from '../../utils/command-helpers.mjs'
import { normalizeContext } from '../../utils/env/index.mjs'
import { BANG, chalk } from '../../utils/command-helpers.mjs'
import { normalizeContext } from '../../utils/env/index.mjs'
import { getGeoCountryArgParser } from '../../utils/validation.mjs'
import BaseCommand from '../base-command.mjs'

Expand All @@ -26,24 +23,23 @@ const validateShortFlagArgs = (args: string) => {

export const createDevCommand = (program: BaseCommand) => {
program
.command('dev:exec')
.argument('<...cmd>', `the command that should be executed`)
.option(
'--context <context>',
'Specify a deploy context or branch for environment variables (contexts: "production", "deploy-preview", "branch-deploy", "dev")',
normalizeContext,
'dev',
)
.description(
'Exec command\nRuns a command within the netlify dev environment, e.g. with env variables from any installed addons',
)
.allowExcessArguments(true)
.addExamples(['netlify dev:exec npm run bootstrap'])
.action(async (cmd:string, options: OptionValues, command: BaseCommand) => {
const { devExec } = await import('./dev-exec.mjs')
await devExec(cmd, options, command)
})

.command('dev:exec')
.argument('<...cmd>', `the command that should be executed`)
.option(
'--context <context>',
'Specify a deploy context or branch for environment variables (contexts: "production", "deploy-preview", "branch-deploy", "dev")',
normalizeContext,
'dev',
)
.description(
'Exec command\nRuns a command within the netlify dev environment, e.g. with env variables from any installed addons',
)
.allowExcessArguments(true)
.addExamples(['netlify dev:exec npm run bootstrap'])
.action(async (cmd: string, options: OptionValues, command: BaseCommand) => {
const { devExec } = await import('./dev-exec.mjs')
await devExec(cmd, options, command)
})

return program
.command('dev')
Expand Down
Loading

0 comments on commit ca739d5

Please sign in to comment.