netlify-cli 17.5.3 → 17.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/{run.mjs → run.js} +3 -3
- package/npm-shrinkwrap.json +4 -4
- package/package.json +8 -9
- package/scripts/{postinstall.mjs → postinstall.js} +3 -4
- package/src/commands/addons/addons-auth.js +22 -0
- package/src/commands/addons/{addons-config.mjs → addons-config.js} +9 -34
- package/src/commands/addons/{addons-create.mjs → addons-create.js} +7 -33
- package/src/commands/addons/addons-delete.js +33 -0
- package/src/commands/addons/{addons-list.mjs → addons-list.js} +3 -25
- package/src/commands/addons/addons.js +68 -0
- package/src/commands/addons/index.js +1 -0
- package/src/commands/api/{api.mjs → api.js} +2 -24
- package/src/commands/api/index.js +13 -0
- package/src/commands/{base-command.mjs → base-command.js} +7 -7
- package/src/commands/blobs/blobs-delete.js +20 -0
- package/src/commands/blobs/{blobs-get.mjs → blobs-get.js} +2 -15
- package/src/commands/blobs/{blobs-list.mjs → blobs-list.js} +2 -16
- package/src/commands/blobs/{blobs-set.mjs → blobs-set.js} +2 -17
- package/src/commands/blobs/blobs.js +74 -0
- package/src/commands/blobs/index.js +1 -0
- package/src/commands/build/{build.mjs → build.js} +7 -28
- package/src/commands/build/index.js +13 -0
- package/src/commands/completion/completion.js +29 -0
- package/src/commands/completion/index.js +26 -0
- package/src/commands/deploy/{deploy.mjs → deploy.js} +17 -133
- package/src/commands/deploy/index.js +106 -0
- package/src/commands/dev/{dev-exec.mjs → dev-exec.js} +3 -15
- package/src/commands/dev/{dev.mjs → dev.js} +19 -38
- package/src/commands/dev/index.js +1 -0
- package/src/commands/env/{env-clone.mjs → env-clone.js} +71 -94
- package/src/commands/env/env-get.js +34 -0
- package/src/commands/env/{env-import.mjs → env-import.js} +38 -65
- package/src/commands/env/{env-list.mjs → env-list.js} +3 -37
- package/src/commands/env/{env-set.mjs → env-set.js} +36 -81
- package/src/commands/env/{env-unset.mjs → env-unset.js} +30 -62
- package/src/commands/env/env.js +127 -0
- package/src/commands/env/index.js +1 -0
- package/src/commands/functions/{functions-build.mjs → functions-build.js} +3 -22
- package/src/commands/functions/{functions-create.mjs → functions-create.js} +20 -47
- package/src/commands/functions/{functions-invoke.mjs → functions-invoke.js} +3 -41
- package/src/commands/functions/{functions-list.mjs → functions-list.js} +3 -27
- package/src/commands/functions/{functions-serve.mjs → functions-serve.js} +6 -28
- package/src/commands/functions/functions.js +98 -0
- package/src/commands/functions/index.js +1 -0
- package/src/commands/index.js +2 -0
- package/src/commands/init/index.js +12 -0
- package/src/commands/init/{init.mjs → init.js} +10 -31
- package/src/commands/integration/{deploy.mjs → deploy.js} +7 -28
- package/src/commands/integration/index.js +26 -0
- package/src/commands/link/index.js +13 -0
- package/src/commands/link/{link.mjs → link.js} +6 -28
- package/src/commands/lm/index.js +1 -0
- package/src/commands/lm/{lm-info.mjs → lm-info.js} +2 -9
- package/src/commands/lm/lm-install.js +8 -0
- package/src/commands/lm/{lm-setup.mjs → lm-setup.js} +6 -25
- package/src/commands/lm/lm-uninstall.js +7 -0
- package/src/commands/lm/lm.js +46 -0
- package/src/commands/login/index.js +9 -0
- package/src/commands/login/{login.mjs → login.js} +1 -19
- package/src/commands/logout/index.js +7 -0
- package/src/commands/logout/{logout.mjs → logout.js} +3 -16
- package/src/commands/logs/{build.mjs → build.js} +3 -8
- package/src/commands/logs/{functions.mjs → functions.js} +14 -14
- package/src/commands/logs/index.js +39 -0
- package/src/commands/logs/log-levels.js +11 -0
- package/src/commands/{main.mjs → main.js} +32 -32
- package/src/commands/open/index.js +31 -0
- package/src/commands/open/open-admin.js +11 -0
- package/src/commands/open/open-site.js +12 -0
- package/src/commands/open/open.js +13 -0
- package/src/commands/recipes/{common.mjs → common.js} +2 -2
- package/src/commands/recipes/index.js +20 -0
- package/src/commands/recipes/recipes-list.js +14 -0
- package/src/commands/recipes/{recipes.mjs → recipes.js} +8 -32
- package/src/commands/serve/index.js +27 -0
- package/src/commands/serve/{serve.mjs → serve.js} +14 -51
- package/src/commands/sites/index.js +1 -0
- package/src/commands/sites/{sites-create-template.mjs → sites-create-template.js} +9 -38
- package/src/commands/sites/{sites-create.mjs → sites-create.js} +5 -38
- package/src/commands/sites/{sites-delete.mjs → sites-delete.js} +2 -22
- package/src/commands/sites/{sites-list.mjs → sites-list.js} +4 -24
- package/src/commands/sites/sites.js +77 -0
- package/src/commands/status/index.js +19 -0
- package/src/commands/status/{status-hooks.mjs → status-hooks.js} +2 -20
- package/src/commands/status/{status.mjs → status.js} +2 -23
- package/src/commands/switch/index.js +7 -0
- package/src/commands/switch/{switch.mjs → switch.js} +3 -16
- package/src/commands/unlink/index.js +7 -0
- package/src/commands/unlink/unlink.js +21 -0
- package/src/commands/watch/index.js +8 -0
- package/src/commands/watch/{watch.mjs → watch.js} +4 -21
- package/src/lib/{api.mjs → api.js} +1 -1
- package/src/lib/blobs/{blobs.mjs → blobs.js} +2 -2
- package/src/lib/{build.mjs → build.js} +3 -3
- package/src/lib/completion/{constants.mjs → constants.js} +1 -1
- package/src/lib/completion/{generate-autocompletion.mjs → generate-autocompletion.js} +3 -3
- package/src/lib/completion/{index.mjs → index.js} +1 -1
- package/src/lib/completion/{script.mjs → script.js} +3 -3
- package/src/lib/edge-functions/{deploy.mjs → deploy.js} +2 -2
- package/src/lib/edge-functions/{editor-helper.mjs → editor-helper.js} +1 -1
- package/src/lib/edge-functions/{internal.mjs → internal.js} +2 -2
- package/src/lib/edge-functions/{proxy.mjs → proxy.js} +10 -11
- package/src/lib/edge-functions/{registry.mjs → registry.js} +1 -1
- package/src/lib/{exec-fetcher.mjs → exec-fetcher.js} +2 -2
- package/src/lib/functions/{background.mjs → background.js} +2 -2
- package/src/lib/functions/{form-submissions-handler.mjs → form-submissions-handler.js} +3 -3
- package/src/lib/functions/{local-proxy.mjs → local-proxy.js} +1 -1
- package/src/lib/functions/{netlify-function.mjs → netlify-function.js} +3 -3
- package/src/lib/functions/{registry.mjs → registry.js} +9 -9
- package/src/lib/functions/runtimes/go/{index.mjs → index.js} +2 -2
- package/src/lib/functions/runtimes/{index.mjs → index.js} +3 -4
- package/src/lib/functions/runtimes/js/builders/{netlify-lambda.mjs → netlify-lambda.js} +3 -3
- package/src/lib/functions/runtimes/js/builders/{zisi.mjs → zisi.js} +6 -6
- package/src/lib/functions/runtimes/js/{index.mjs → index.js} +4 -4
- package/src/lib/functions/runtimes/rust/{index.mjs → index.js} +4 -4
- package/src/lib/functions/{scheduled.mjs → scheduled.js} +2 -2
- package/src/lib/functions/{server.mjs → server.js} +15 -15
- package/src/lib/functions/{synchronous.mjs → synchronous.js} +3 -3
- package/src/lib/functions/{utils.mjs → utils.js} +2 -2
- package/src/lib/{geo-location.mjs → geo-location.js} +1 -1
- package/src/lib/{http-agent.mjs → http-agent.js} +1 -1
- package/src/lib/images/{proxy.mjs → proxy.js} +2 -2
- package/src/lib/{log.mjs → log.js} +1 -1
- package/src/recipes/vscode/{index.mjs → index.js} +2 -2
- package/src/recipes/vscode/{settings.mjs → settings.js} +0 -1
- package/src/utils/addons/diffs/{index.mjs → index.js} +1 -1
- package/src/utils/addons/diffs/{options.mjs → options.js} +0 -1
- package/src/utils/addons/{prepare.mjs → prepare.js} +2 -2
- package/src/utils/addons/{prompts.mjs → prompts.js} +1 -1
- package/src/utils/addons/{render.mjs → render.js} +1 -1
- package/src/utils/{banner.mjs → banner.js} +1 -1
- package/src/utils/{build-info.mjs → build-info.js} +3 -3
- package/src/utils/{command-helpers.mjs → command-helpers.js} +4 -9
- package/src/utils/deploy/{deploy-site.mjs → deploy-site.js} +8 -8
- package/src/utils/deploy/{hash-files.mjs → hash-files.js} +1 -1
- package/src/utils/deploy/{hash-fns.mjs → hash-fns.js} +3 -3
- package/src/utils/deploy/{hasher-segments.mjs → hasher-segments.js} +1 -1
- package/src/utils/deploy/{upload-files.mjs → upload-files.js} +1 -1
- package/src/utils/deploy/{util.mjs → util.js} +1 -1
- package/src/utils/{detect-server-settings.mjs → detect-server-settings.js} +6 -7
- package/src/utils/{dev.mjs → dev.js} +3 -3
- package/src/utils/{dot-env.mjs → dot-env.js} +2 -2
- package/src/utils/env/{index.mjs → index.js} +1 -1
- package/src/utils/{framework-server.mjs → framework-server.js} +4 -4
- package/src/utils/functions/{functions.mjs → functions.js} +2 -2
- package/src/utils/functions/{get-functions.mjs → get-functions.js} +1 -1
- package/src/utils/functions/index.js +3 -0
- package/src/utils/{get-global-config.mjs → get-global-config.js} +1 -1
- package/src/utils/{get-repo-data.mjs → get-repo-data.js} +1 -1
- package/src/utils/{get-site.mjs → get-site.js} +1 -1
- package/src/utils/{gh-auth.mjs → gh-auth.js} +3 -3
- package/src/utils/{gitignore.mjs → gitignore.js} +2 -2
- package/src/utils/{headers.mjs → headers.js} +1 -1
- package/src/utils/hooks/{requires-site-info.mjs → requires-site-info.js} +1 -1
- package/src/utils/init/{config-github.mjs → config-github.js} +4 -4
- package/src/utils/init/{config-manual.mjs → config-manual.js} +5 -5
- package/src/utils/init/{config.mjs → config.js} +4 -4
- package/src/utils/init/{node-version.mjs → node-version.js} +1 -1
- package/src/utils/init/{utils.mjs → utils.js} +7 -7
- package/src/utils/{live-tunnel.mjs → live-tunnel.js} +4 -4
- package/src/utils/lm/{install.mjs → install.js} +6 -6
- package/src/utils/lm/{requirements.mjs → requirements.js} +1 -1
- package/src/utils/lm/{steps.mjs → steps.js} +2 -2
- package/src/utils/lm/{ui.mjs → ui.js} +2 -2
- package/src/utils/{open-browser.mjs → open-browser.js} +1 -1
- package/src/utils/{proxy-server.mjs → proxy-server.js} +5 -5
- package/src/utils/{proxy.mjs → proxy.js} +11 -11
- package/src/utils/{redirects.mjs → redirects.js} +1 -1
- package/src/utils/{rules-proxy.mjs → rules-proxy.js} +3 -3
- package/src/utils/{run-build.mjs → run-build.js} +8 -8
- package/src/utils/{shell.mjs → shell.js} +2 -2
- package/src/utils/{state-config.mjs → state-config.js} +1 -1
- package/src/utils/{static-server.mjs → static-server.js} +1 -1
- package/src/utils/telemetry/index.js +2 -0
- package/src/utils/telemetry/{report-error.mjs → report-error.js} +4 -4
- package/src/utils/telemetry/{request.mjs → request.js} +1 -1
- package/src/utils/telemetry/{telemetry.mjs → telemetry.js} +5 -5
- package/src/utils/telemetry/{utils.mjs → utils.js} +1 -1
- package/src/utils/telemetry/{validation.mjs → validation.js} +1 -1
- package/src/utils/{validation.mjs → validation.js} +1 -1
- package/src/commands/addons/addons-auth.mjs +0 -45
- package/src/commands/addons/addons-delete.mjs +0 -53
- package/src/commands/addons/addons.mjs +0 -39
- package/src/commands/addons/index.mjs +0 -1
- package/src/commands/api/index.mjs +0 -1
- package/src/commands/blobs/blobs-delete.mjs +0 -35
- package/src/commands/blobs/blobs.mjs +0 -32
- package/src/commands/blobs/index.mjs +0 -1
- package/src/commands/build/index.mjs +0 -1
- package/src/commands/completion/completion.mjs +0 -53
- package/src/commands/completion/index.mjs +0 -1
- package/src/commands/deploy/index.mjs +0 -1
- package/src/commands/dev/index.mjs +0 -1
- package/src/commands/dev/types.d.ts +0 -30
- package/src/commands/env/env-get.mjs +0 -66
- package/src/commands/env/env.mjs +0 -41
- package/src/commands/env/index.mjs +0 -1
- package/src/commands/functions/functions.mjs +0 -39
- package/src/commands/functions/index.mjs +0 -1
- package/src/commands/index.mjs +0 -2
- package/src/commands/init/index.mjs +0 -1
- package/src/commands/integration/index.mjs +0 -24
- package/src/commands/link/index.mjs +0 -1
- package/src/commands/lm/index.mjs +0 -1
- package/src/commands/lm/lm-install.mjs +0 -27
- package/src/commands/lm/lm-uninstall.mjs +0 -18
- package/src/commands/lm/lm.mjs +0 -30
- package/src/commands/login/index.mjs +0 -1
- package/src/commands/logout/index.mjs +0 -1
- package/src/commands/logs/index.mjs +0 -12
- package/src/commands/open/index.mjs +0 -1
- package/src/commands/open/open-admin.mjs +0 -30
- package/src/commands/open/open-site.mjs +0 -31
- package/src/commands/open/open.mjs +0 -36
- package/src/commands/recipes/index.mjs +0 -1
- package/src/commands/recipes/recipes-list.mjs +0 -25
- package/src/commands/serve/index.mjs +0 -1
- package/src/commands/sites/index.mjs +0 -2
- package/src/commands/sites/sites.mjs +0 -30
- package/src/commands/status/index.mjs +0 -1
- package/src/commands/switch/index.mjs +0 -1
- package/src/commands/types.d.ts +0 -31
- package/src/commands/unlink/index.mjs +0 -1
- package/src/commands/unlink/unlink.mjs +0 -34
- package/src/commands/watch/index.mjs +0 -1
- package/src/functions-templates/typescript/abtest/{{name}}.ts +0 -31
- package/src/functions-templates/typescript/geolocation/{{name}}.ts +0 -24
- package/src/functions-templates/typescript/hello-world/{{name}}.ts +0 -12
- package/src/functions-templates/typescript/json/{{name}}.ts +0 -5
- package/src/functions-templates/typescript/log/{{name}}.ts +0 -9
- package/src/functions-templates/typescript/scheduled-function/{{name}}.ts +0 -12
- package/src/functions-templates/typescript/set-cookies/{{name}}.ts +0 -29
- package/src/functions-templates/typescript/set-req-header/{{name}}.ts +0 -5
- package/src/functions-templates/typescript/set-res-header/{{name}}.ts +0 -7
- package/src/functions-templates/typescript/transform-response/{{name}}.ts +0 -13
- package/src/utils/functions/index.mjs +0 -3
- package/src/utils/telemetry/index.mjs +0 -2
- package/src/utils/types.d.ts +0 -46
- /package/src/functions-templates/go/hello-world/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/javascript/hello/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/javascript/hello-world/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/javascript/identity-signup/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/javascript/image-external/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/javascript/localized-content/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/javascript/sanity-create/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/javascript/sanity-groq/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/javascript/scheduled-function/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/javascript/set-cookies/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/javascript/set-req-header/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/javascript/set-res-header/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/javascript/submission-created/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/javascript/transform-response/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/rust/hello-world/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/typescript/abtest/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/typescript/geolocation/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/typescript/hello-world/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/typescript/json/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/typescript/log/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/typescript/scheduled-function/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/typescript/set-cookies/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/typescript/set-req-header/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/typescript/set-res-header/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/functions-templates/typescript/transform-response/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
- /package/src/lib/{account.mjs → account.js} +0 -0
- /package/src/lib/completion/{get-autocompletion.mjs → get-autocompletion.js} +0 -0
- /package/src/lib/edge-functions/{bootstrap.mjs → bootstrap.js} +0 -0
- /package/src/lib/edge-functions/{consts.mjs → consts.js} +0 -0
- /package/src/lib/edge-functions/{headers.mjs → headers.js} +0 -0
- /package/src/lib/{fs.mjs → fs.js} +0 -0
- /package/src/lib/functions/{config.mjs → config.js} +0 -0
- /package/src/lib/functions/{memoized-build.mjs → memoized-build.js} +0 -0
- /package/src/lib/functions/runtimes/js/{constants.mjs → constants.js} +0 -0
- /package/src/lib/functions/runtimes/js/{worker.mjs → worker.js} +0 -0
- /package/src/lib/{path.mjs → path.js} +0 -0
- /package/src/lib/{render-error-template.mjs → render-error-template.js} +0 -0
- /package/src/lib/{settings.mjs → settings.js} +0 -0
- /package/src/lib/{spinner.mjs → spinner.js} +0 -0
- /package/src/lib/{string.mjs → string.js} +0 -0
- /package/src/utils/addons/{compare.mjs → compare.js} +0 -0
- /package/src/utils/addons/{validation.mjs → validation.js} +0 -0
- /package/src/utils/{create-deferred.mjs → create-deferred.js} +0 -0
- /package/src/utils/{create-stream-promise.mjs → create-stream-promise.js} +0 -0
- /package/src/utils/deploy/{constants.mjs → constants.js} +0 -0
- /package/src/utils/deploy/{hash-config.mjs → hash-config.js} +0 -0
- /package/src/utils/{execa.mjs → execa.js} +0 -0
- /package/src/utils/{feature-flags.mjs → feature-flags.js} +0 -0
- /package/src/utils/functions/{constants.mjs → constants.js} +0 -0
- /package/src/utils/{get-package-json.mjs → get-package-json.js} +0 -0
- /package/src/utils/init/{plugins.mjs → plugins.js} +0 -0
- /package/src/utils/{parse-raw-flags.mjs → parse-raw-flags.js} +0 -0
- /package/src/utils/{read-repo-url.mjs → read-repo-url.js} +0 -0
- /package/src/utils/{request-id.mjs → request-id.js} +0 -0
- /package/src/utils/{sign-redirect.mjs → sign-redirect.js} +0 -0
- /package/src/utils/sites/{utils.mjs → utils.js} +0 -0
- /package/src/utils/websockets/{index.mjs → index.js} +0 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { chalk } from '../../utils/command-helpers.js';
|
|
2
|
+
import requiresSiteInfo from '../../utils/hooks/requires-site-info.js';
|
|
3
|
+
const functions = (options, command) => {
|
|
4
|
+
command.help();
|
|
5
|
+
};
|
|
6
|
+
export const createFunctionsCommand = (program) => {
|
|
7
|
+
program
|
|
8
|
+
.command('functions:build')
|
|
9
|
+
.alias('function:build')
|
|
10
|
+
.description('Build functions locally')
|
|
11
|
+
.option('-f, --functions <directory>', 'Specify a functions directory to build to')
|
|
12
|
+
.option('-s, --src <directory>', 'Specify the source directory for the functions')
|
|
13
|
+
.action(async (options, command) => {
|
|
14
|
+
const { functionsBuild } = await import('./functions-build.js');
|
|
15
|
+
await functionsBuild(options, command);
|
|
16
|
+
});
|
|
17
|
+
program
|
|
18
|
+
.command('functions:create')
|
|
19
|
+
.alias('function:create')
|
|
20
|
+
.argument('[name]', 'name of your new function file inside your functions directory')
|
|
21
|
+
.description('Create a new function locally')
|
|
22
|
+
.option('-n, --name <name>', 'function name')
|
|
23
|
+
.option('-u, --url <url>', 'pull template from URL')
|
|
24
|
+
.option('-l, --language <lang>', 'function language')
|
|
25
|
+
.addExamples([
|
|
26
|
+
'netlify functions:create',
|
|
27
|
+
'netlify functions:create hello-world',
|
|
28
|
+
'netlify functions:create --name hello-world',
|
|
29
|
+
])
|
|
30
|
+
.action(async (name, options, command) => {
|
|
31
|
+
const { functionsCreate } = await import('./functions-create.js');
|
|
32
|
+
await functionsCreate(name, options, command);
|
|
33
|
+
});
|
|
34
|
+
program
|
|
35
|
+
.command('functions:invoke')
|
|
36
|
+
.alias('function:trigger')
|
|
37
|
+
.argument('[name]', 'function name to invoke')
|
|
38
|
+
.description(`Trigger a function while in netlify dev with simulated data, good for testing function calls including Netlify's Event Triggered Functions`)
|
|
39
|
+
.option('-n, --name <name>', 'function name to invoke')
|
|
40
|
+
.option('-f, --functions <dir>', 'Specify a functions folder to parse, overriding netlify.toml')
|
|
41
|
+
.option('-q, --querystring <query>', 'Querystring to add to your function invocation')
|
|
42
|
+
.option('-p, --payload <data>', 'Supply POST payload in stringified json, or a path to a json file')
|
|
43
|
+
// TODO: refactor to not need the `undefined` state by removing the --identity flag (value `identity` will be then always defined to true or false)
|
|
44
|
+
.option('--identity', 'simulate Netlify Identity authentication JWT. pass --identity to affirm unauthenticated request')
|
|
45
|
+
.option('--no-identity', 'simulate Netlify Identity authentication JWT. pass --no-identity to affirm unauthenticated request')
|
|
46
|
+
.option('--port <port>', 'Port where netlify dev is accessible. e.g. 8888', (value) => Number.parseInt(value))
|
|
47
|
+
.addExamples([
|
|
48
|
+
'netlify functions:invoke',
|
|
49
|
+
'netlify functions:invoke myfunction',
|
|
50
|
+
'netlify functions:invoke --name myfunction',
|
|
51
|
+
'netlify functions:invoke --name myfunction --identity',
|
|
52
|
+
'netlify functions:invoke --name myfunction --no-identity',
|
|
53
|
+
`netlify functions:invoke myfunction --payload '{"foo": 1}'`,
|
|
54
|
+
'netlify functions:invoke myfunction --querystring "foo=1',
|
|
55
|
+
'netlify functions:invoke myfunction --payload "./pathTo.json"',
|
|
56
|
+
])
|
|
57
|
+
.action(async (name, options, command) => {
|
|
58
|
+
const { functionsInvoke } = await import('./functions-invoke.js');
|
|
59
|
+
await functionsInvoke(name, options, command);
|
|
60
|
+
});
|
|
61
|
+
program
|
|
62
|
+
.command('functions:list')
|
|
63
|
+
.alias('function:list')
|
|
64
|
+
.description(`List functions that exist locally
|
|
65
|
+
Helpful for making sure that you have formatted your functions correctly
|
|
66
|
+
|
|
67
|
+
NOT the same as listing the functions that have been deployed. For that info you need to go to your Netlify deploy log.`)
|
|
68
|
+
.option('-f, --functions <dir>', 'Specify a functions directory to list')
|
|
69
|
+
.option('--json', 'Output function data as JSON')
|
|
70
|
+
.hook('preAction', requiresSiteInfo)
|
|
71
|
+
.action(async (options, command) => {
|
|
72
|
+
const { functionsList } = await import('./functions-list.js');
|
|
73
|
+
await functionsList(options, command);
|
|
74
|
+
});
|
|
75
|
+
program
|
|
76
|
+
.command('functions:serve')
|
|
77
|
+
.alias('function:serve')
|
|
78
|
+
.description('Serve functions locally')
|
|
79
|
+
.option('-f, --functions <dir>', 'Specify a functions directory to serve')
|
|
80
|
+
.option('-p, --port <port>', 'Specify a port for the functions server', (value) => Number.parseInt(value))
|
|
81
|
+
.option('-o, --offline', 'disables any features that require network access')
|
|
82
|
+
.addHelpText('after', 'Helpful for debugging functions.')
|
|
83
|
+
.action(async (options, command) => {
|
|
84
|
+
const { functionsServe } = await import('./functions-serve.js');
|
|
85
|
+
await functionsServe(options, command);
|
|
86
|
+
});
|
|
87
|
+
const name = chalk.greenBright('`functions`');
|
|
88
|
+
return program
|
|
89
|
+
.command('functions')
|
|
90
|
+
.alias('function')
|
|
91
|
+
.description(`Manage netlify functions
|
|
92
|
+
The ${name} command will help you manage the functions in this site`)
|
|
93
|
+
.addExamples([
|
|
94
|
+
'netlify functions:create --name function-xyz',
|
|
95
|
+
'netlify functions:build --functions build/to/directory --src source/directory',
|
|
96
|
+
])
|
|
97
|
+
.action(functions);
|
|
98
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createFunctionsCommand } from './functions.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Option } from 'commander';
|
|
2
|
+
export const createInitCommand = (program) => program
|
|
3
|
+
.command('init')
|
|
4
|
+
.description('Configure continuous deployment for a new or existing site. To create a new site without continuous deployment, use `netlify sites:create`')
|
|
5
|
+
.option('-m, --manual', 'Manually configure a git remote for CI')
|
|
6
|
+
.option('--force', 'Reinitialize CI hooks if the linked site is already configured to use CI')
|
|
7
|
+
.addOption(new Option('--gitRemoteName <name>', 'Old, prefer --git-remote-name. Name of Git remote to use. e.g. "origin"').hideHelp(true))
|
|
8
|
+
.option('--git-remote-name <name>', 'Name of Git remote to use. e.g. "origin"')
|
|
9
|
+
.action(async (options, command) => {
|
|
10
|
+
const { init } = await import('./init.js');
|
|
11
|
+
await init(options, command);
|
|
12
|
+
});
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { Option } from 'commander';
|
|
2
1
|
import inquirer from 'inquirer';
|
|
3
2
|
import isEmpty from 'lodash/isEmpty.js';
|
|
4
|
-
import { chalk, exit, log } from '../../utils/command-helpers.
|
|
5
|
-
import getRepoData from '../../utils/get-repo-data.
|
|
6
|
-
import { ensureNetlifyIgnore } from '../../utils/gitignore.
|
|
7
|
-
import { configureRepo } from '../../utils/init/config.
|
|
8
|
-
import { track } from '../../utils/telemetry/index.
|
|
9
|
-
import { link } from '../link/
|
|
10
|
-
import { sitesCreate } from '../sites/
|
|
3
|
+
import { chalk, exit, log } from '../../utils/command-helpers.js';
|
|
4
|
+
import getRepoData from '../../utils/get-repo-data.js';
|
|
5
|
+
import { ensureNetlifyIgnore } from '../../utils/gitignore.js';
|
|
6
|
+
import { configureRepo } from '../../utils/init/config.js';
|
|
7
|
+
import { track } from '../../utils/telemetry/index.js';
|
|
8
|
+
import { link } from '../link/link.js';
|
|
9
|
+
import { sitesCreate } from '../sites/sites-create.js';
|
|
11
10
|
// @ts-expect-error TS(7031) FIXME: Binding element 'siteInfo' implicitly has an 'any'... Remove this comment to see the full error message
|
|
12
11
|
const persistState = ({ siteInfo, state }) => {
|
|
13
12
|
// Save to .netlify/state.json file
|
|
@@ -39,7 +38,7 @@ const logExistingAndExit = ({ siteInfo }) => {
|
|
|
39
38
|
* Creates and new site and exits the process
|
|
40
39
|
* @param {object} config
|
|
41
40
|
* @param {*} config.state
|
|
42
|
-
* @param {import('../base-command.
|
|
41
|
+
* @param {import('../base-command.js').default} config.command
|
|
43
42
|
*/
|
|
44
43
|
// @ts-expect-error TS(7031) FIXME: Binding element 'command' implicitly has an 'any' ... Remove this comment to see the full error message
|
|
45
44
|
const createNewSiteAndExit = async ({ command, state }) => {
|
|
@@ -86,7 +85,7 @@ const logGitSetupInstructionsAndExit = () => {
|
|
|
86
85
|
/**
|
|
87
86
|
* Handles the case where no git remote was found.
|
|
88
87
|
* @param {object} config
|
|
89
|
-
* @param {import('../base-command.
|
|
88
|
+
* @param {import('../base-command.js').default} config.command
|
|
90
89
|
* @param {object} config.error
|
|
91
90
|
* @param {object} config.state
|
|
92
91
|
*/
|
|
@@ -126,7 +125,7 @@ git remote add origin https://github.com/YourUserName/RepoName.git
|
|
|
126
125
|
};
|
|
127
126
|
/**
|
|
128
127
|
* Creates a new site or links an existing one to the repository
|
|
129
|
-
* @param {import('../base-command.
|
|
128
|
+
* @param {import('../base-command.js').default} command
|
|
130
129
|
*/
|
|
131
130
|
// @ts-expect-error TS(7006) FIXME: Parameter 'command' implicitly has an 'any' type.
|
|
132
131
|
const createOrLinkSiteToRepo = async (command) => {
|
|
@@ -162,12 +161,6 @@ const logExistingRepoSetupAndExit = ({ repoUrl, siteName }) => {
|
|
|
162
161
|
// TODO add support for changing GitHub repo in site:config command
|
|
163
162
|
exit();
|
|
164
163
|
};
|
|
165
|
-
/**
|
|
166
|
-
* The init command
|
|
167
|
-
* @param {import('commander').OptionValues} options
|
|
168
|
-
* @param {import('../base-command.mjs').default} command
|
|
169
|
-
*/
|
|
170
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
|
|
171
164
|
export const init = async (options, command) => {
|
|
172
165
|
command.setAnalyticsPayload({ manual: options.manual, force: options.force });
|
|
173
166
|
const { repositoryRoot, state } = command.netlify;
|
|
@@ -198,17 +191,3 @@ export const init = async (options, command) => {
|
|
|
198
191
|
await configureRepo({ command, siteId: siteInfo.id, repoData, manual: options.manual });
|
|
199
192
|
return siteInfo;
|
|
200
193
|
};
|
|
201
|
-
/**
|
|
202
|
-
* Creates the `netlify init` command
|
|
203
|
-
* @param {import('../base-command.mjs').default} program
|
|
204
|
-
* @returns
|
|
205
|
-
*/
|
|
206
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
207
|
-
export const createInitCommand = (program) => program
|
|
208
|
-
.command('init')
|
|
209
|
-
.description('Configure continuous deployment for a new or existing site. To create a new site without continuous deployment, use `netlify sites:create`')
|
|
210
|
-
.option('-m, --manual', 'Manually configure a git remote for CI')
|
|
211
|
-
.option('--force', 'Reinitialize CI hooks if the linked site is already configured to use CI')
|
|
212
|
-
.addOption(new Option('--gitRemoteName <name>', 'Old, prefer --git-remote-name. Name of Git remote to use. e.g. "origin"').hideHelp(true))
|
|
213
|
-
.option('--git-remote-name <name>', 'Name of Git remote to use. e.g. "origin"')
|
|
214
|
-
.action(init);
|
|
@@ -7,11 +7,11 @@ import yaml from 'js-yaml';
|
|
|
7
7
|
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'node... Remove this comment to see the full error message
|
|
8
8
|
import fetch from 'node-fetch';
|
|
9
9
|
import { z } from 'zod';
|
|
10
|
-
import { getBuildOptions } from '../../lib/build.
|
|
11
|
-
import { getToken, chalk, log } from '../../utils/command-helpers.
|
|
12
|
-
import { getSiteInformation } from '../../utils/dev.
|
|
13
|
-
import { checkOptions } from '../build/build.
|
|
14
|
-
import { deploy as siteDeploy } from '../deploy/deploy.
|
|
10
|
+
import { getBuildOptions } from '../../lib/build.js';
|
|
11
|
+
import { getToken, chalk, log } from '../../utils/command-helpers.js';
|
|
12
|
+
import { getSiteInformation } from '../../utils/dev.js';
|
|
13
|
+
import { checkOptions } from '../build/build.js';
|
|
14
|
+
import { deploy as siteDeploy } from '../deploy/deploy.js';
|
|
15
15
|
function getIntegrationAPIUrl() {
|
|
16
16
|
return env.INTEGRATION_URL || 'https://api.netlifysdk.com';
|
|
17
17
|
}
|
|
@@ -319,24 +319,18 @@ export const getConfiguration = (workingDir) => {
|
|
|
319
319
|
exit(1);
|
|
320
320
|
}
|
|
321
321
|
};
|
|
322
|
-
|
|
323
|
-
* The deploy command for Netlify Integrations
|
|
324
|
-
* @param {import('commander').OptionValues} options
|
|
325
|
-
* * @param {import('../base-command.mjs').default} command
|
|
326
|
-
*/
|
|
327
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
|
|
328
|
-
const deploy = async (options, command) => {
|
|
322
|
+
export const deploy = async (options, command) => {
|
|
329
323
|
const { api, cachedConfig, site, siteInfo } = command.netlify;
|
|
330
324
|
const { id: siteId } = site;
|
|
331
325
|
// @ts-expect-error TS(2554) FIXME: Expected 1 arguments, but got 0.
|
|
332
326
|
const [token] = await getToken();
|
|
333
327
|
const workingDir = resolve(command.workingDir);
|
|
334
|
-
// @ts-expect-error TS(2345) FIXME: Argument of type '{ cachedConfig: any; packagePath... Remove this comment to see the full error message
|
|
335
328
|
const buildOptions = await getBuildOptions({
|
|
336
329
|
cachedConfig,
|
|
337
330
|
packagePath: command.workspacePackage,
|
|
338
331
|
currentDir: command.workingDir,
|
|
339
332
|
token,
|
|
333
|
+
// @ts-expect-error TS(2740)
|
|
340
334
|
options,
|
|
341
335
|
});
|
|
342
336
|
// Confirm that a site is linked and that the user is logged in
|
|
@@ -369,18 +363,3 @@ const deploy = async (options, command) => {
|
|
|
369
363
|
await siteDeploy(options, command);
|
|
370
364
|
log(`${chalk.cyanBright.bold(`Your integration has been deployed. Next step is to enable it for a team or site.`)} https://ntl.fyi/create-private-integration`);
|
|
371
365
|
};
|
|
372
|
-
/**
|
|
373
|
-
* Creates the `netlify int deploy` command
|
|
374
|
-
* @param {import('../base-command.mjs').default} program
|
|
375
|
-
* @returns
|
|
376
|
-
*/
|
|
377
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
378
|
-
export const createDeployCommand = (program) => program
|
|
379
|
-
.command('integration:deploy')
|
|
380
|
-
.alias('int:deploy')
|
|
381
|
-
.description('Register, build, and deploy a private integration on Netlify')
|
|
382
|
-
.option('-p, --prod', 'Deploy to production', false)
|
|
383
|
-
.option('-b, --build', 'Build the integration', false)
|
|
384
|
-
.option('-a, --auth <token>', 'Netlify auth token to deploy with', env.NETLIFY_AUTH_TOKEN)
|
|
385
|
-
.option('-s, --site <name-or-id>', 'A site name or ID to deploy to', env.NETLIFY_SITE_ID)
|
|
386
|
-
.action(deploy);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { env } from 'process';
|
|
2
|
+
const integrations = (options, command) => {
|
|
3
|
+
command.help();
|
|
4
|
+
};
|
|
5
|
+
export const createIntegrationDeployCommand = (program) => {
|
|
6
|
+
program
|
|
7
|
+
.command('integration:deploy')
|
|
8
|
+
.alias('int:deploy')
|
|
9
|
+
.description('Register, build, and deploy a private integration on Netlify')
|
|
10
|
+
.option('-p, --prod', 'Deploy to production', false)
|
|
11
|
+
.option('-b, --build', 'Build the integration', false)
|
|
12
|
+
.option('-a, --auth <token>', 'Netlify auth token to deploy with', env.NETLIFY_AUTH_TOKEN)
|
|
13
|
+
.option('-s, --site <name-or-id>', 'A site name or ID to deploy to', env.NETLIFY_SITE_ID)
|
|
14
|
+
.action(async (options, command) => {
|
|
15
|
+
const { deploy } = await import('./deploy.js');
|
|
16
|
+
await deploy(options, command);
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
export const createIntegrationCommand = (program) => {
|
|
20
|
+
createIntegrationDeployCommand(program);
|
|
21
|
+
return program
|
|
22
|
+
.command('integration')
|
|
23
|
+
.alias('int')
|
|
24
|
+
.description('Manage Netlify Integrations built with the Netlify SDK')
|
|
25
|
+
.action(integrations);
|
|
26
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Option } from 'commander';
|
|
2
|
+
export const createLinkCommand = (program) => program
|
|
3
|
+
.command('link')
|
|
4
|
+
.description('Link a local repo or project folder to an existing site on Netlify')
|
|
5
|
+
.option('--id <id>', 'ID of site to link to')
|
|
6
|
+
.option('--name <name>', 'Name of site to link to')
|
|
7
|
+
.addOption(new Option('--gitRemoteName <name>', 'Old, prefer --git-remote-name. Name of Git remote to use. e.g. "origin"').hideHelp(true))
|
|
8
|
+
.option('--git-remote-name <name>', 'Name of Git remote to use. e.g. "origin"')
|
|
9
|
+
.addExamples(['netlify link', 'netlify link --id 123-123-123-123', 'netlify link --name my-site-name'])
|
|
10
|
+
.action(async (options, command) => {
|
|
11
|
+
const { link } = await import('./link.js');
|
|
12
|
+
await link(options, command);
|
|
13
|
+
});
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { Option } from 'commander';
|
|
2
1
|
import inquirer from 'inquirer';
|
|
3
2
|
import isEmpty from 'lodash/isEmpty.js';
|
|
4
|
-
import { listSites } from '../../lib/api.
|
|
5
|
-
import { chalk, error, exit, log } from '../../utils/command-helpers.
|
|
6
|
-
import getRepoData from '../../utils/get-repo-data.
|
|
7
|
-
import { ensureNetlifyIgnore } from '../../utils/gitignore.
|
|
8
|
-
import { track } from '../../utils/telemetry/index.
|
|
3
|
+
import { listSites } from '../../lib/api.js';
|
|
4
|
+
import { chalk, error, exit, log } from '../../utils/command-helpers.js';
|
|
5
|
+
import getRepoData from '../../utils/get-repo-data.js';
|
|
6
|
+
import { ensureNetlifyIgnore } from '../../utils/gitignore.js';
|
|
7
|
+
import { track } from '../../utils/telemetry/index.js';
|
|
9
8
|
/**
|
|
10
9
|
*
|
|
11
|
-
* @param {import('../base-command.
|
|
10
|
+
* @param {import('../base-command.js').default} command
|
|
12
11
|
* @param {import('commander').OptionValues} options
|
|
13
12
|
*/
|
|
14
13
|
// @ts-expect-error TS(7006) FIXME: Parameter 'command' implicitly has an 'any' type.
|
|
@@ -228,12 +227,6 @@ or run ${chalk.cyanBright('netlify sites:create')} to create a site.`);
|
|
|
228
227
|
log(`You can now run other \`netlify\` cli commands in this directory`);
|
|
229
228
|
return site;
|
|
230
229
|
};
|
|
231
|
-
/**
|
|
232
|
-
* The link command
|
|
233
|
-
* @param {import('commander').OptionValues} options
|
|
234
|
-
* @param {import('../base-command.mjs').default} command
|
|
235
|
-
*/
|
|
236
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
|
|
237
230
|
export const link = async (options, command) => {
|
|
238
231
|
await command.authenticate();
|
|
239
232
|
const { api, repositoryRoot, site: { id: siteId }, siteInfo, state, } = command.netlify;
|
|
@@ -317,18 +310,3 @@ export const link = async (options, command) => {
|
|
|
317
310
|
}
|
|
318
311
|
return siteData;
|
|
319
312
|
};
|
|
320
|
-
/**
|
|
321
|
-
* Creates the `netlify link` command
|
|
322
|
-
* @param {import('../base-command.mjs').default} program
|
|
323
|
-
* @returns
|
|
324
|
-
*/
|
|
325
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
326
|
-
export const createLinkCommand = (program) => program
|
|
327
|
-
.command('link')
|
|
328
|
-
.description('Link a local repo or project folder to an existing site on Netlify')
|
|
329
|
-
.option('--id <id>', 'ID of site to link to')
|
|
330
|
-
.option('--name <name>', 'Name of site to link to')
|
|
331
|
-
.addOption(new Option('--gitRemoteName <name>', 'Old, prefer --git-remote-name. Name of Git remote to use. e.g. "origin"').hideHelp(true))
|
|
332
|
-
.option('--git-remote-name <name>', 'Name of Git remote to use. e.g. "origin"')
|
|
333
|
-
.addExamples(['netlify link', 'netlify link --id 123-123-123-123', 'netlify link --name my-site-name'])
|
|
334
|
-
.action(link);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createLmCommand } from './lm.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Listr } from 'listr2';
|
|
2
|
-
import { checkGitLFSVersionStep, checkGitVersionStep, checkHelperVersionStep, checkLFSFiltersStep, } from '../../utils/lm/steps.
|
|
2
|
+
import { checkGitLFSVersionStep, checkGitVersionStep, checkHelperVersionStep, checkLFSFiltersStep, } from '../../utils/lm/steps.js';
|
|
3
3
|
/**
|
|
4
4
|
* The lm:info command
|
|
5
5
|
*/
|
|
6
|
-
const lmInfo = async () => {
|
|
6
|
+
export const lmInfo = async () => {
|
|
7
7
|
const steps = [
|
|
8
8
|
checkGitVersionStep,
|
|
9
9
|
checkGitLFSVersionStep,
|
|
@@ -23,10 +23,3 @@ const lmInfo = async () => {
|
|
|
23
23
|
// an error is already reported when a task fails
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
/**
|
|
27
|
-
* Creates the `netlify lm:info` command
|
|
28
|
-
* @param {import('../base-command.mjs').default} program
|
|
29
|
-
* @returns
|
|
30
|
-
*/
|
|
31
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
32
|
-
export const createLmInfoCommand = (program) => program.command('lm:info', { hidden: true }).description('Show large media requirements information.').action(lmInfo);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { installPlatform } from '../../utils/lm/install.js';
|
|
2
|
+
import { printBanner } from '../../utils/lm/ui.js';
|
|
3
|
+
export const lmInstall = async ({ force }) => {
|
|
4
|
+
const installed = await installPlatform({ force });
|
|
5
|
+
if (installed) {
|
|
6
|
+
printBanner(force);
|
|
7
|
+
}
|
|
8
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Listr } from 'listr2';
|
|
2
|
-
import { error } from '../../utils/command-helpers.
|
|
2
|
+
import { error } from '../../utils/command-helpers.js';
|
|
3
3
|
// @ts-expect-error TS(7034) FIXME: Variable 'execa' implicitly has type 'any' in some... Remove this comment to see the full error message
|
|
4
|
-
import execa from '../../utils/execa.
|
|
5
|
-
import { installPlatform } from '../../utils/lm/install.
|
|
6
|
-
import { checkHelperVersion } from '../../utils/lm/requirements.
|
|
7
|
-
import { printBanner } from '../../utils/lm/ui.
|
|
4
|
+
import execa from '../../utils/execa.js';
|
|
5
|
+
import { installPlatform } from '../../utils/lm/install.js';
|
|
6
|
+
import { checkHelperVersion } from '../../utils/lm/requirements.js';
|
|
7
|
+
import { printBanner } from '../../utils/lm/ui.js';
|
|
8
8
|
// @ts-expect-error TS(7031) FIXME: Binding element 'force' implicitly has an 'any' ty... Remove this comment to see the full error message
|
|
9
9
|
const installHelperIfMissing = async function ({ force }) {
|
|
10
10
|
let installHelper = false;
|
|
@@ -48,13 +48,7 @@ const configureLFSURL = async function (siteId, api) {
|
|
|
48
48
|
// @ts-expect-error TS(7005) FIXME: Variable 'execa' implicitly has an 'any' type.
|
|
49
49
|
return execa('git', ['config', '-f', '.lfsconfig', 'lfs.url', url]);
|
|
50
50
|
};
|
|
51
|
-
|
|
52
|
-
* The lm:setup command
|
|
53
|
-
* @param {import('commander').OptionValues} options
|
|
54
|
-
* @param {import('../base-command.mjs').default} command
|
|
55
|
-
*/
|
|
56
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
|
|
57
|
-
const lmSetup = async (options, command) => {
|
|
51
|
+
export const lmSetup = async (options, command) => {
|
|
58
52
|
await command.authenticate();
|
|
59
53
|
const { api, site } = command.netlify;
|
|
60
54
|
let helperInstalled = false;
|
|
@@ -86,16 +80,3 @@ const lmSetup = async (options, command) => {
|
|
|
86
80
|
printBanner(options.forceInstall);
|
|
87
81
|
}
|
|
88
82
|
};
|
|
89
|
-
/**
|
|
90
|
-
* Creates the `netlify lm:setup` command
|
|
91
|
-
* @param {import('../base-command.mjs').default} program
|
|
92
|
-
* @returns
|
|
93
|
-
*/
|
|
94
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
95
|
-
export const createLmSetupCommand = (program) => program
|
|
96
|
-
.command('lm:setup', { hidden: true })
|
|
97
|
-
.description('Configures your site to use Netlify Large Media')
|
|
98
|
-
.option('-s, --skip-install', 'Skip the credentials helper installation check')
|
|
99
|
-
.option('-f, --force-install', 'Force the credentials helper installation')
|
|
100
|
-
.addHelpText('after', 'It runs the install command if you have not installed the dependencies yet.')
|
|
101
|
-
.action(lmSetup);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const lm = (options, command) => {
|
|
2
|
+
command.help();
|
|
3
|
+
};
|
|
4
|
+
export const createLmCommand = (program) => {
|
|
5
|
+
program
|
|
6
|
+
.command('lm:info', { hidden: true })
|
|
7
|
+
.description('Show large media requirements information.')
|
|
8
|
+
.action(async () => {
|
|
9
|
+
const { lmInfo } = await import('./lm-info.js');
|
|
10
|
+
await lmInfo();
|
|
11
|
+
});
|
|
12
|
+
program
|
|
13
|
+
.command('lm:install', { hidden: true })
|
|
14
|
+
.alias('lm:init')
|
|
15
|
+
.description(`Configures your computer to use Netlify Large Media
|
|
16
|
+
It installs the required credentials helper for Git,
|
|
17
|
+
and configures your Git environment with the right credentials.`)
|
|
18
|
+
.option('-f, --force', 'Force the credentials helper installation')
|
|
19
|
+
.action(async (options) => {
|
|
20
|
+
const { lmInstall } = await import('./lm-install.js');
|
|
21
|
+
await lmInstall(options);
|
|
22
|
+
});
|
|
23
|
+
program
|
|
24
|
+
.command('lm:setup', { hidden: true })
|
|
25
|
+
.description('Configures your site to use Netlify Large Media')
|
|
26
|
+
.option('-s, --skip-install', 'Skip the credentials helper installation check')
|
|
27
|
+
.option('-f, --force-install', 'Force the credentials helper installation')
|
|
28
|
+
.addHelpText('after', 'It runs the install command if you have not installed the dependencies yet.')
|
|
29
|
+
.action(async (options, command) => {
|
|
30
|
+
const { lmSetup } = await import('./lm-setup.js');
|
|
31
|
+
await lmSetup(options, command);
|
|
32
|
+
});
|
|
33
|
+
program
|
|
34
|
+
.command('lm:uninstall', { hidden: true })
|
|
35
|
+
.alias('lm:remove')
|
|
36
|
+
.description('Uninstalls Netlify git credentials helper and cleans up any related configuration changes made by the install command.')
|
|
37
|
+
.action(async () => {
|
|
38
|
+
const { lmUninstall } = await import('./lm-uninstall.js');
|
|
39
|
+
await lmUninstall();
|
|
40
|
+
});
|
|
41
|
+
program
|
|
42
|
+
.command('lm', { hidden: true })
|
|
43
|
+
.description('[Deprecated and will be removed from future versions] Handle Netlify Large Media operations\nThe lm command will help you manage large media for a site')
|
|
44
|
+
.addExamples(['netlify lm:info', 'netlify lm:install', 'netlify lm:setup'])
|
|
45
|
+
.action(lm);
|
|
46
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const createLoginCommand = (program) => program
|
|
2
|
+
.command('login')
|
|
3
|
+
.description(`Login to your Netlify account
|
|
4
|
+
Opens a web browser to acquire an OAuth token.`)
|
|
5
|
+
.option('--new', 'Login to new Netlify account')
|
|
6
|
+
.action(async (options, command) => {
|
|
7
|
+
const { login } = await import('./login.js');
|
|
8
|
+
await login(options, command);
|
|
9
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { chalk, exit, getToken, log } from '../../utils/command-helpers.
|
|
1
|
+
import { chalk, exit, getToken, log } from '../../utils/command-helpers.js';
|
|
2
2
|
// @ts-expect-error TS(7006) FIXME: Parameter 'location' implicitly has an 'any' type.
|
|
3
3
|
const msg = function (location) {
|
|
4
4
|
switch (location) {
|
|
@@ -12,12 +12,6 @@ const msg = function (location) {
|
|
|
12
12
|
return '';
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
-
/**
|
|
16
|
-
* The login command
|
|
17
|
-
* @param {import('commander').OptionValues} options
|
|
18
|
-
* @param {import('../base-command.mjs').default} command
|
|
19
|
-
*/
|
|
20
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
|
|
21
15
|
export const login = async (options, command) => {
|
|
22
16
|
// @ts-expect-error TS(2554) FIXME: Expected 1 arguments, but got 0.
|
|
23
17
|
const [accessToken, location] = await getToken();
|
|
@@ -35,15 +29,3 @@ export const login = async (options, command) => {
|
|
|
35
29
|
}
|
|
36
30
|
await command.expensivelyAuthenticate();
|
|
37
31
|
};
|
|
38
|
-
/**
|
|
39
|
-
* Creates the `netlify login` command
|
|
40
|
-
* @param {import('../base-command.mjs').default} program
|
|
41
|
-
* @returns
|
|
42
|
-
*/
|
|
43
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
44
|
-
export const createLoginCommand = (program) => program
|
|
45
|
-
.command('login')
|
|
46
|
-
.description(`Login to your Netlify account
|
|
47
|
-
Opens a web browser to acquire an OAuth token.`)
|
|
48
|
-
.option('--new', 'Login to new Netlify account')
|
|
49
|
-
.action(login);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const createLogoutCommand = (program) => program
|
|
2
|
+
.command('logout', { hidden: true })
|
|
3
|
+
.description('Logout of your Netlify account')
|
|
4
|
+
.action(async (options, command) => {
|
|
5
|
+
const { logout } = await import('./logout.js');
|
|
6
|
+
await logout(options, command);
|
|
7
|
+
});
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import { exit, getToken, log } from '../../utils/command-helpers.
|
|
2
|
-
import { track } from '../../utils/telemetry/index.
|
|
3
|
-
|
|
4
|
-
* The logout command
|
|
5
|
-
* @param {import('commander').OptionValues} options
|
|
6
|
-
* @param {import('../base-command.mjs').default} command
|
|
7
|
-
*/
|
|
8
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
|
|
9
|
-
const logout = async (options, command) => {
|
|
1
|
+
import { exit, getToken, log } from '../../utils/command-helpers.js';
|
|
2
|
+
import { track } from '../../utils/telemetry/index.js';
|
|
3
|
+
export const logout = async (options, command) => {
|
|
10
4
|
// @ts-expect-error TS(2554) FIXME: Expected 1 arguments, but got 0.
|
|
11
5
|
const [accessToken, location] = await getToken();
|
|
12
6
|
if (!accessToken) {
|
|
@@ -27,10 +21,3 @@ const logout = async (options, command) => {
|
|
|
27
21
|
}
|
|
28
22
|
log(`Logging you out of Netlify. Come back soon!`);
|
|
29
23
|
};
|
|
30
|
-
/**
|
|
31
|
-
* Creates the `netlify logout` command
|
|
32
|
-
* @param {import('../base-command.mjs').default} program
|
|
33
|
-
* @returns
|
|
34
|
-
*/
|
|
35
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
36
|
-
export const createLogoutCommand = (program) => program.command('logout', { hidden: true }).description('Logout of your Netlify account').action(logout);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import inquirer from 'inquirer';
|
|
2
|
-
import { log, chalk } from '../../utils/command-helpers.
|
|
3
|
-
import { getWebSocket } from '../../utils/websockets/index.
|
|
2
|
+
import { log, chalk } from '../../utils/command-helpers.js';
|
|
3
|
+
import { getWebSocket } from '../../utils/websockets/index.js';
|
|
4
4
|
export function getName({ deploy, userId }) {
|
|
5
5
|
let normalisedName = '';
|
|
6
6
|
const isUserDeploy = deploy.user_id === userId;
|
|
@@ -24,7 +24,7 @@ export function getName({ deploy, userId }) {
|
|
|
24
24
|
}
|
|
25
25
|
return `(${deploy.id.slice(0, 7)}) ${normalisedName}`;
|
|
26
26
|
}
|
|
27
|
-
const logsBuild = async (options, command) => {
|
|
27
|
+
export const logsBuild = async (options, command) => {
|
|
28
28
|
await command.authenticate();
|
|
29
29
|
const client = command.netlify.api;
|
|
30
30
|
const { site } = command.netlify;
|
|
@@ -65,8 +65,3 @@ const logsBuild = async (options, command) => {
|
|
|
65
65
|
log('---');
|
|
66
66
|
});
|
|
67
67
|
};
|
|
68
|
-
export const createLogsBuildCommand = (program) => program
|
|
69
|
-
.command('logs:deploy')
|
|
70
|
-
.alias('logs:build')
|
|
71
|
-
.description('(Beta) Stream the logs of deploys currently being built to the console')
|
|
72
|
-
.action(logsBuild);
|