netlify-cli 17.6.0 → 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} +4 -27
- 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
package/bin/{run.mjs → run.js}
RENAMED
|
@@ -3,9 +3,9 @@ import { argv } from 'process'
|
|
|
3
3
|
|
|
4
4
|
import updateNotifier from 'update-notifier'
|
|
5
5
|
|
|
6
|
-
import { createMainCommand } from '../src/commands/index.
|
|
7
|
-
import { error } from '../src/utils/command-helpers.
|
|
8
|
-
import getPackageJson from '../src/utils/get-package-json.
|
|
6
|
+
import { createMainCommand } from '../src/commands/index.js'
|
|
7
|
+
import { error } from '../src/utils/command-helpers.js'
|
|
8
|
+
import getPackageJson from '../src/utils/get-package-json.js'
|
|
9
9
|
|
|
10
10
|
// 12 hours
|
|
11
11
|
const UPDATE_CHECK_INTERVAL = 432e5
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.7.0",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "netlify-cli",
|
|
9
|
-
"version": "17.
|
|
9
|
+
"version": "17.7.0",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
@@ -123,8 +123,8 @@
|
|
|
123
123
|
"zod": "3.22.4"
|
|
124
124
|
},
|
|
125
125
|
"bin": {
|
|
126
|
-
"netlify": "bin/run.
|
|
127
|
-
"ntl": "bin/run.
|
|
126
|
+
"netlify": "bin/run.js",
|
|
127
|
+
"ntl": "bin/run.js"
|
|
128
128
|
},
|
|
129
129
|
"engines": {
|
|
130
130
|
"node": ">=18.14.0"
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
3
|
"description": "Netlify command line tool",
|
|
4
|
-
"version": "17.
|
|
4
|
+
"version": "17.7.0",
|
|
5
5
|
"author": "Netlify Inc.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"/bin",
|
|
12
12
|
"/npm-shrinkwrap.json",
|
|
13
|
-
"/scripts/postinstall.
|
|
13
|
+
"/scripts/postinstall.js",
|
|
14
14
|
"/src/**/*.js",
|
|
15
|
-
"/src/**/*.mjs",
|
|
16
15
|
"/src/**/types.d.ts",
|
|
17
16
|
"/src/**/*.sh",
|
|
18
17
|
"/src/**/*.ps1",
|
|
@@ -20,8 +19,8 @@
|
|
|
20
19
|
"/src/lib/templates/**",
|
|
21
20
|
"!/src/**/node_modules/**",
|
|
22
21
|
"!/src/**/*.test.js",
|
|
23
|
-
"!/src/**/*.
|
|
24
|
-
"!/src/**/*.d.
|
|
22
|
+
"!/src/**/*.ts",
|
|
23
|
+
"!/src/**/*.d.ts.map"
|
|
25
24
|
],
|
|
26
25
|
"homepage": "https://github.com/netlify/cli",
|
|
27
26
|
"keywords": [
|
|
@@ -33,15 +32,15 @@
|
|
|
33
32
|
"license": "MIT",
|
|
34
33
|
"repository": "https://github.com/netlify/cli",
|
|
35
34
|
"bin": {
|
|
36
|
-
"ntl": "./bin/run.
|
|
37
|
-
"netlify": "./bin/run.
|
|
35
|
+
"ntl": "./bin/run.js",
|
|
36
|
+
"netlify": "./bin/run.js"
|
|
38
37
|
},
|
|
39
38
|
"bugs": {
|
|
40
39
|
"url": "https://github.com/netlify/cli/issues"
|
|
41
40
|
},
|
|
42
41
|
"scripts": {
|
|
43
|
-
"prepublishOnly": "node ./scripts/prepare-for-publish.
|
|
44
|
-
"postinstall": "node ./scripts/postinstall.
|
|
42
|
+
"prepublishOnly": "node ./scripts/prepare-for-publish.js",
|
|
43
|
+
"postinstall": "node ./scripts/postinstall.js"
|
|
45
44
|
},
|
|
46
45
|
"dependencies": {
|
|
47
46
|
"@bugsnag/js": "7.20.2",
|
|
@@ -2,9 +2,8 @@ import process from 'process'
|
|
|
2
2
|
|
|
3
3
|
import chalk from 'chalk'
|
|
4
4
|
|
|
5
|
-
import { createMainCommand } from '../src/commands/index.
|
|
6
|
-
|
|
7
|
-
import { generateAutocompletion } from '../src/lib/completion/index.mjs'
|
|
5
|
+
import { createMainCommand } from '../src/commands/index.js'
|
|
6
|
+
import { generateAutocompletion } from '../src/lib/completion/index.js'
|
|
8
7
|
|
|
9
8
|
const id = (message) => message
|
|
10
9
|
|
|
@@ -28,7 +27,7 @@ const format = (message, styles) => {
|
|
|
28
27
|
const postInstall = async () => {
|
|
29
28
|
// yarn plug and play seems to have an issue with reading an esm file by building up the cache.
|
|
30
29
|
// as yarn pnp analyzes everything inside the postinstall
|
|
31
|
-
// yarn pnp executes it out of a .yarn folder .yarn/unplugged/netlify-cli-file-fb026a3a6d/node_modules/netlify-cli/scripts/postinstall.
|
|
30
|
+
// yarn pnp executes it out of a .yarn folder .yarn/unplugged/netlify-cli-file-fb026a3a6d/node_modules/netlify-cli/scripts/postinstall.js
|
|
32
31
|
if (!process.argv[1].includes('.yarn')) {
|
|
33
32
|
// create or update the autocompletion definition
|
|
34
33
|
const program = createMainCommand()
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ADDON_VALIDATION, prepareAddonCommand } from '../../utils/addons/prepare.js';
|
|
2
|
+
import { exit, log } from '../../utils/command-helpers.js';
|
|
3
|
+
import openBrowser from '../../utils/open-browser.js';
|
|
4
|
+
export const addonsAuth = async (addonName, options, command) => {
|
|
5
|
+
const { addon } = await prepareAddonCommand({
|
|
6
|
+
command,
|
|
7
|
+
addonName,
|
|
8
|
+
validation: ADDON_VALIDATION.EXISTS,
|
|
9
|
+
});
|
|
10
|
+
if (!addon.auth_url) {
|
|
11
|
+
log(`No Admin URL found for the "${addonName} add-on"`);
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
log();
|
|
15
|
+
log(`Opening ${addonName} add-on admin URL:`);
|
|
16
|
+
log();
|
|
17
|
+
log(addon.auth_url);
|
|
18
|
+
log();
|
|
19
|
+
// @ts-expect-error TS(2345) FIXME: Argument of type '{ url: any; }' is not assignable... Remove this comment to see the full error message
|
|
20
|
+
await openBrowser({ url: addon.auth_url });
|
|
21
|
+
exit();
|
|
22
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import inquirer from 'inquirer';
|
|
2
2
|
import isEmpty from 'lodash/isEmpty.js';
|
|
3
|
-
import compare from '../../utils/addons/compare.
|
|
4
|
-
import diffValues from '../../utils/addons/diffs/index.
|
|
5
|
-
import { ADDON_VALIDATION, prepareAddonCommand } from '../../utils/addons/prepare.
|
|
6
|
-
import generatePrompts from '../../utils/addons/prompts.
|
|
7
|
-
import { renderConfigValues } from '../../utils/addons/render.
|
|
8
|
-
import { missingConfigValues, requiredConfigValues, updateConfigValues } from '../../utils/addons/validation.
|
|
9
|
-
import { chalk, error, log } from '../../utils/command-helpers.
|
|
10
|
-
import { parseRawFlags } from '../../utils/parse-raw-flags.
|
|
3
|
+
import compare from '../../utils/addons/compare.js';
|
|
4
|
+
import diffValues from '../../utils/addons/diffs/index.js';
|
|
5
|
+
import { ADDON_VALIDATION, prepareAddonCommand } from '../../utils/addons/prepare.js';
|
|
6
|
+
import generatePrompts from '../../utils/addons/prompts.js';
|
|
7
|
+
import { renderConfigValues } from '../../utils/addons/render.js';
|
|
8
|
+
import { missingConfigValues, requiredConfigValues, updateConfigValues } from '../../utils/addons/validation.js';
|
|
9
|
+
import { chalk, error, log } from '../../utils/command-helpers.js';
|
|
10
|
+
import { parseRawFlags } from '../../utils/parse-raw-flags.js';
|
|
11
11
|
// @ts-expect-error TS(7031) FIXME: Binding element 'addonName' implicitly has an 'any... Remove this comment to see the full error message
|
|
12
12
|
const update = async function ({ addonName, api, currentConfig, instanceId, newConfig, siteId }) {
|
|
13
13
|
const codeDiff = diffValues(currentConfig, newConfig);
|
|
@@ -35,15 +35,7 @@ const update = async function ({ addonName, api, currentConfig, instanceId, newC
|
|
|
35
35
|
error(error_.message);
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
|
|
39
|
-
* The addons:config command
|
|
40
|
-
* @param {string} addonName
|
|
41
|
-
* @param {import('commander').OptionValues} options
|
|
42
|
-
* @param {import('../base-command.mjs').default} command
|
|
43
|
-
* @returns {Promise<boolean>}
|
|
44
|
-
*/
|
|
45
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'addonName' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
46
|
-
const addonsConfig = async (addonName, options, command) => {
|
|
38
|
+
export const addonsConfig = async (addonName, options, command) => {
|
|
47
39
|
const { addon, manifest, siteData } = await prepareAddonCommand({
|
|
48
40
|
command,
|
|
49
41
|
addonName,
|
|
@@ -151,20 +143,3 @@ const addonsConfig = async (addonName, options, command) => {
|
|
|
151
143
|
});
|
|
152
144
|
}
|
|
153
145
|
};
|
|
154
|
-
/**
|
|
155
|
-
* Creates the `netlify addons:config` command
|
|
156
|
-
* @param {import('../base-command.mjs').default} program
|
|
157
|
-
* @returns
|
|
158
|
-
*/
|
|
159
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
160
|
-
export const createAddonsConfigCommand = (program) => program
|
|
161
|
-
.command('addons:config', { hidden: true })
|
|
162
|
-
.alias('addon:config')
|
|
163
|
-
.argument('<name>', 'Add-on namespace')
|
|
164
|
-
.description('Configure add-on settings')
|
|
165
|
-
// allow for any flags. Handy for variadic configuration options
|
|
166
|
-
.allowUnknownOption(true)
|
|
167
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'addonName' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
168
|
-
.action(async (addonName, options, command) => {
|
|
169
|
-
await addonsConfig(addonName, options, command);
|
|
170
|
-
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import inquirer from 'inquirer';
|
|
2
2
|
import isEmpty from 'lodash/isEmpty.js';
|
|
3
|
-
import { ADDON_VALIDATION, prepareAddonCommand } from '../../utils/addons/prepare.
|
|
4
|
-
import generatePrompts from '../../utils/addons/prompts.
|
|
5
|
-
import { renderConfigValues, renderMissingValues } from '../../utils/addons/render.
|
|
6
|
-
import { missingConfigValues, requiredConfigValues, updateConfigValues } from '../../utils/addons/validation.
|
|
7
|
-
import { chalk, error, log } from '../../utils/command-helpers.
|
|
8
|
-
import { parseRawFlags } from '../../utils/parse-raw-flags.
|
|
3
|
+
import { ADDON_VALIDATION, prepareAddonCommand } from '../../utils/addons/prepare.js';
|
|
4
|
+
import generatePrompts from '../../utils/addons/prompts.js';
|
|
5
|
+
import { renderConfigValues, renderMissingValues } from '../../utils/addons/render.js';
|
|
6
|
+
import { missingConfigValues, requiredConfigValues, updateConfigValues } from '../../utils/addons/validation.js';
|
|
7
|
+
import { chalk, error, log } from '../../utils/command-helpers.js';
|
|
8
|
+
import { parseRawFlags } from '../../utils/parse-raw-flags.js';
|
|
9
9
|
// @ts-expect-error TS(7031) FIXME: Binding element 'addonName' implicitly has an 'any... Remove this comment to see the full error message
|
|
10
10
|
const createAddon = async ({ addonName, api, config, siteData, siteId }) => {
|
|
11
11
|
try {
|
|
@@ -25,15 +25,7 @@ const createAddon = async ({ addonName, api, config, siteData, siteId }) => {
|
|
|
25
25
|
error(error_.message);
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
|
|
29
|
-
* The addons:create command
|
|
30
|
-
* @param {string} addonName
|
|
31
|
-
* @param {import('commander').OptionValues} options
|
|
32
|
-
* @param {import('../base-command.mjs').default} command
|
|
33
|
-
* @returns {Promise<boolean>}
|
|
34
|
-
*/
|
|
35
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'addonName' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
36
|
-
const addonsCreate = async (addonName, options, command) => {
|
|
28
|
+
export const addonsCreate = async (addonName, options, command) => {
|
|
37
29
|
const { manifest, siteData } = await prepareAddonCommand({
|
|
38
30
|
command,
|
|
39
31
|
addonName,
|
|
@@ -96,21 +88,3 @@ const addonsCreate = async (addonName, options, command) => {
|
|
|
96
88
|
}
|
|
97
89
|
await createAddon({ api, siteId, addonName, config: configValues, siteData });
|
|
98
90
|
};
|
|
99
|
-
/**
|
|
100
|
-
* Creates the `netlify addons:create` command
|
|
101
|
-
* @param {import('../base-command.mjs').default} program
|
|
102
|
-
* @returns
|
|
103
|
-
*/
|
|
104
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
105
|
-
export const createAddonsCreateCommand = (program) => program
|
|
106
|
-
.command('addons:create', { hidden: true })
|
|
107
|
-
.alias('addon:create')
|
|
108
|
-
.argument('<name>', 'Add-on namespace')
|
|
109
|
-
.description(`Add an add-on extension to your site
|
|
110
|
-
Add-ons are a way to extend the functionality of your Netlify site`)
|
|
111
|
-
// allow for any flags. Handy for variadic configuration options
|
|
112
|
-
.allowUnknownOption(true)
|
|
113
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'addonName' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
114
|
-
.action(async (addonName, options, command) => {
|
|
115
|
-
await addonsCreate(addonName, options, command);
|
|
116
|
-
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import inquirer from 'inquirer';
|
|
2
|
+
import { ADDON_VALIDATION, prepareAddonCommand } from '../../utils/addons/prepare.js';
|
|
3
|
+
import { error, exit, log } from '../../utils/command-helpers.js';
|
|
4
|
+
export const addonsDelete = async (addonName, options, command) => {
|
|
5
|
+
const { addon } = await prepareAddonCommand({
|
|
6
|
+
command,
|
|
7
|
+
addonName,
|
|
8
|
+
validation: ADDON_VALIDATION.EXISTS,
|
|
9
|
+
});
|
|
10
|
+
if (!options.force && !options.f) {
|
|
11
|
+
const { wantsToDelete } = await inquirer.prompt({
|
|
12
|
+
type: 'confirm',
|
|
13
|
+
name: 'wantsToDelete',
|
|
14
|
+
message: `Are you sure you want to delete the ${addonName} add-on? (to skip this prompt, pass a --force flag)`,
|
|
15
|
+
default: false,
|
|
16
|
+
});
|
|
17
|
+
if (!wantsToDelete) {
|
|
18
|
+
exit();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
await command.netlify.api.deleteServiceInstance({
|
|
23
|
+
siteId: command.netlify.site.id,
|
|
24
|
+
addon: addonName,
|
|
25
|
+
instanceId: addon.id,
|
|
26
|
+
});
|
|
27
|
+
log(`Addon "${addonName}" deleted`);
|
|
28
|
+
}
|
|
29
|
+
catch (error_) {
|
|
30
|
+
// @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
|
|
31
|
+
error(error_.message);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import AsciiTable from 'ascii-table';
|
|
2
|
-
import { prepareAddonCommand } from '../../utils/addons/prepare.
|
|
3
|
-
import { log, logJson } from '../../utils/command-helpers.
|
|
4
|
-
|
|
5
|
-
* The addons:list command
|
|
6
|
-
* @param {import('commander').OptionValues} options
|
|
7
|
-
* @param {import('../base-command.mjs').default} command
|
|
8
|
-
* @returns {Promise<boolean>}
|
|
9
|
-
*/
|
|
10
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
|
|
11
|
-
const addonsList = async (options, command) => {
|
|
2
|
+
import { prepareAddonCommand } from '../../utils/addons/prepare.js';
|
|
3
|
+
import { log, logJson } from '../../utils/command-helpers.js';
|
|
4
|
+
export const addonsList = async (options, command) => {
|
|
12
5
|
// @ts-expect-error TS(2345) FIXME: Argument of type '{ command: any; }' is not assign... Remove this comment to see the full error message
|
|
13
6
|
const { addons, siteData } = await prepareAddonCommand({ command });
|
|
14
7
|
// Return json response for piping commands
|
|
@@ -38,18 +31,3 @@ const addonsList = async (options, command) => {
|
|
|
38
31
|
// Log da addons
|
|
39
32
|
log(table.toString());
|
|
40
33
|
};
|
|
41
|
-
/**
|
|
42
|
-
* Creates the `netlify addons:list` command
|
|
43
|
-
* @param {import('../base-command.mjs').default} program
|
|
44
|
-
* @returns
|
|
45
|
-
*/
|
|
46
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
47
|
-
export const createAddonsListCommand = (program) => program
|
|
48
|
-
.command('addons:list', { hidden: true })
|
|
49
|
-
.alias('addon:list')
|
|
50
|
-
.description(`List currently installed add-ons for site`)
|
|
51
|
-
.option('--json', 'Output add-on data as JSON')
|
|
52
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
|
|
53
|
-
.action(async (options, command) => {
|
|
54
|
-
await addonsList(options, command);
|
|
55
|
-
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const addons = (options, command) => {
|
|
2
|
+
command.help();
|
|
3
|
+
};
|
|
4
|
+
export const createAddonsCommand = (program) => {
|
|
5
|
+
program
|
|
6
|
+
.command('addons:auth', { hidden: true })
|
|
7
|
+
.alias('addon:auth')
|
|
8
|
+
.argument('<name>', 'Add-on slug')
|
|
9
|
+
.description('Login to add-on provider')
|
|
10
|
+
.action(async (addonName, options, command) => {
|
|
11
|
+
const { addonsAuth } = await import('./addons-auth.js');
|
|
12
|
+
await addonsAuth(addonName, options, command);
|
|
13
|
+
});
|
|
14
|
+
program
|
|
15
|
+
.command('addons:config', { hidden: true })
|
|
16
|
+
.alias('addon:config')
|
|
17
|
+
.argument('<name>', 'Add-on namespace')
|
|
18
|
+
.description('Configure add-on settings')
|
|
19
|
+
// allow for any flags. Handy for variadic configuration options
|
|
20
|
+
.allowUnknownOption(true)
|
|
21
|
+
.action(async (addonName, options, command) => {
|
|
22
|
+
const { addonsConfig } = await import('./addons-config.js');
|
|
23
|
+
await addonsConfig(addonName, options, command);
|
|
24
|
+
});
|
|
25
|
+
program
|
|
26
|
+
.command('addons:create', { hidden: true })
|
|
27
|
+
.alias('addon:create')
|
|
28
|
+
.argument('<name>', 'Add-on namespace')
|
|
29
|
+
.description(`Add an add-on extension to your site
|
|
30
|
+
Add-ons are a way to extend the functionality of your Netlify site`)
|
|
31
|
+
// allow for any flags. Handy for variadic configuration options
|
|
32
|
+
.allowUnknownOption(true)
|
|
33
|
+
.action(async (addonName, options, command) => {
|
|
34
|
+
const { addonsCreate } = await import('./addons-create.js');
|
|
35
|
+
await addonsCreate(addonName, options, command);
|
|
36
|
+
});
|
|
37
|
+
program
|
|
38
|
+
.command('addons:delete', { hidden: true })
|
|
39
|
+
.alias('addon:delete')
|
|
40
|
+
.argument('<name>', 'Add-on namespace')
|
|
41
|
+
.description(`Remove an add-on extension to your site\nAdd-ons are a way to extend the functionality of your Netlify site`)
|
|
42
|
+
.option('-f, --force', 'delete without prompting (useful for CI)')
|
|
43
|
+
.action(async (addonName, options, command) => {
|
|
44
|
+
const { addonsDelete } = await import('./addons-delete.js');
|
|
45
|
+
await addonsDelete(addonName, options, command);
|
|
46
|
+
});
|
|
47
|
+
program
|
|
48
|
+
.command('addons:list', { hidden: true })
|
|
49
|
+
.alias('addon:list')
|
|
50
|
+
.description(`List currently installed add-ons for site`)
|
|
51
|
+
.option('--json', 'Output add-on data as JSON')
|
|
52
|
+
.action(async (options, command) => {
|
|
53
|
+
const { addonsList } = await import('./addons-list.js');
|
|
54
|
+
await addonsList(options, command);
|
|
55
|
+
});
|
|
56
|
+
return program
|
|
57
|
+
.command('addons', { hidden: true })
|
|
58
|
+
.alias('addon')
|
|
59
|
+
.description('[Deprecated and will be removed from future versions] Manage Netlify Add-ons')
|
|
60
|
+
.addExamples([
|
|
61
|
+
'netlify addons:create addon-xyz',
|
|
62
|
+
'netlify addons:list',
|
|
63
|
+
'netlify addons:config addon-xyz',
|
|
64
|
+
'netlify addons:delete addon-xyz',
|
|
65
|
+
'netlify addons:auth addon-xyz',
|
|
66
|
+
])
|
|
67
|
+
.action(addons);
|
|
68
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createAddonsCommand } from './addons.js';
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import AsciiTable from 'ascii-table';
|
|
2
2
|
import { methods } from 'netlify';
|
|
3
|
-
import { chalk, error, exit, log, logJson } from '../../utils/command-helpers.
|
|
4
|
-
|
|
5
|
-
* The api command
|
|
6
|
-
* @param {string} apiMethod
|
|
7
|
-
* @param {import('commander').OptionValues} options
|
|
8
|
-
* @param {import('../base-command.mjs').default} command
|
|
9
|
-
*/
|
|
10
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'apiMethod' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
11
|
-
const apiCommand = async (apiMethod, options, command) => {
|
|
3
|
+
import { chalk, error, exit, log, logJson } from '../../utils/command-helpers.js';
|
|
4
|
+
export const apiCommand = async (apiMethod, options, command) => {
|
|
12
5
|
const { api } = command.netlify;
|
|
13
6
|
if (options.list) {
|
|
14
7
|
const table = new AsciiTable(`Netlify API Methods`);
|
|
@@ -45,18 +38,3 @@ const apiCommand = async (apiMethod, options, command) => {
|
|
|
45
38
|
error(error_);
|
|
46
39
|
}
|
|
47
40
|
};
|
|
48
|
-
/**
|
|
49
|
-
* Creates the `netlify api` command
|
|
50
|
-
* @param {import('../base-command.mjs').default} program
|
|
51
|
-
* @returns
|
|
52
|
-
*/
|
|
53
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
54
|
-
export const createApiCommand = (program) => program
|
|
55
|
-
.command('api')
|
|
56
|
-
.argument('[apiMethod]', 'Open API method to run')
|
|
57
|
-
.description(`Run any Netlify API method
|
|
58
|
-
For more information on available methods checkout https://open-api.netlify.com/ or run '${chalk.grey('netlify api --list')}'`)
|
|
59
|
-
.option('-d, --data <data>', 'Data to use')
|
|
60
|
-
.option('--list', 'List out available API methods', false)
|
|
61
|
-
.addExamples(['netlify api --list', `netlify api getSite --data '{ "site_id": "123456" }'`])
|
|
62
|
-
.action(apiCommand);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { chalk } from '../../utils/command-helpers.js';
|
|
2
|
+
export const createApiCommand = (program) => program
|
|
3
|
+
.command('api')
|
|
4
|
+
.argument('[apiMethod]', 'Open API method to run')
|
|
5
|
+
.description(`Run any Netlify API method
|
|
6
|
+
For more information on available methods checkout https://open-api.netlify.com/ or run '${chalk.grey('netlify api --list')}'`)
|
|
7
|
+
.option('-d, --data <data>', 'Data to use')
|
|
8
|
+
.option('--list', 'List out available API methods', false)
|
|
9
|
+
.addExamples(['netlify api --list', `netlify api getSite --data '{ "site_id": "123456" }'`])
|
|
10
|
+
.action(async (apiMethod, options, command) => {
|
|
11
|
+
const { apiCommand } = await import('./api.js');
|
|
12
|
+
await apiCommand(apiMethod, options, command);
|
|
13
|
+
});
|
|
@@ -15,13 +15,13 @@ import inquirer from 'inquirer';
|
|
|
15
15
|
import inquirerAutocompletePrompt from 'inquirer-autocomplete-prompt';
|
|
16
16
|
import merge from 'lodash/merge.js';
|
|
17
17
|
import { NetlifyAPI } from 'netlify';
|
|
18
|
-
import { getAgent } from '../lib/http-agent.
|
|
19
|
-
import { NETLIFY_CYAN, USER_AGENT, chalk, error, exit, getToken, log, normalizeConfig, padLeft, pollForToken, sortOptions, warn, } from '../utils/command-helpers.
|
|
20
|
-
import getGlobalConfig from '../utils/get-global-config.
|
|
21
|
-
import { getSiteByName } from '../utils/get-site.
|
|
22
|
-
import openBrowser from '../utils/open-browser.
|
|
23
|
-
import StateConfig from '../utils/state-config.
|
|
24
|
-
import { identify, reportError, track } from '../utils/telemetry/index.
|
|
18
|
+
import { getAgent } from '../lib/http-agent.js';
|
|
19
|
+
import { NETLIFY_CYAN, USER_AGENT, chalk, error, exit, getToken, log, normalizeConfig, padLeft, pollForToken, sortOptions, warn, } from '../utils/command-helpers.js';
|
|
20
|
+
import getGlobalConfig from '../utils/get-global-config.js';
|
|
21
|
+
import { getSiteByName } from '../utils/get-site.js';
|
|
22
|
+
import openBrowser from '../utils/open-browser.js';
|
|
23
|
+
import StateConfig from '../utils/state-config.js';
|
|
24
|
+
import { identify, reportError, track } from '../utils/telemetry/index.js';
|
|
25
25
|
// load the autocomplete plugin
|
|
26
26
|
inquirer.registerPrompt('autocomplete', inquirerAutocompletePrompt);
|
|
27
27
|
/** Netlify CLI client id. Lives in bot@netlify.com */
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getStore } from '@netlify/blobs';
|
|
2
|
+
import { chalk, error as printError } from '../../utils/command-helpers.js';
|
|
3
|
+
/**
|
|
4
|
+
* The blobs:delete command
|
|
5
|
+
*/
|
|
6
|
+
export const blobsDelete = async (storeName, key, _options, command) => {
|
|
7
|
+
const { api, siteInfo } = command.netlify;
|
|
8
|
+
const store = getStore({
|
|
9
|
+
apiURL: `${api.scheme}://${api.host}`,
|
|
10
|
+
name: storeName,
|
|
11
|
+
siteID: siteInfo.id ?? '',
|
|
12
|
+
token: api.accessToken ?? '',
|
|
13
|
+
});
|
|
14
|
+
try {
|
|
15
|
+
await store.delete(key);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return printError(`Could not delete blob ${chalk.yellow(key)} from store ${chalk.yellow(storeName)}`);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { promises as fs } from 'fs';
|
|
2
2
|
import { resolve } from 'path';
|
|
3
3
|
import { getStore } from '@netlify/blobs';
|
|
4
|
-
import { chalk, error as printError } from '../../utils/command-helpers.
|
|
5
|
-
|
|
6
|
-
const blobsGet = async (storeName, key, options, command) => {
|
|
4
|
+
import { chalk, error as printError } from '../../utils/command-helpers.js';
|
|
5
|
+
export const blobsGet = async (storeName, key, options, command) => {
|
|
7
6
|
const { api, siteInfo } = command.netlify;
|
|
8
7
|
const { output } = options;
|
|
9
8
|
const store = getStore({
|
|
@@ -30,15 +29,3 @@ const blobsGet = async (storeName, key, options, command) => {
|
|
|
30
29
|
console.log(blob);
|
|
31
30
|
}
|
|
32
31
|
};
|
|
33
|
-
/**
|
|
34
|
-
* Creates the `netlify blobs:get` command
|
|
35
|
-
*/
|
|
36
|
-
export const createBlobsGetCommand = (program) => program
|
|
37
|
-
.command('blobs:get')
|
|
38
|
-
.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`)
|
|
39
|
-
.argument('<store>', 'Name of the store')
|
|
40
|
-
.argument('<key>', 'Object key')
|
|
41
|
-
.option('-o, --output <path>', 'Defines the filesystem path where the blob data should be persisted')
|
|
42
|
-
.alias('blob:get')
|
|
43
|
-
.hook('preAction', requiresSiteInfo)
|
|
44
|
-
.action(blobsGet);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { getStore } from '@netlify/blobs';
|
|
2
2
|
import AsciiTable from 'ascii-table';
|
|
3
|
-
import { chalk, error as printError, log, logJson } from '../../utils/command-helpers.
|
|
4
|
-
|
|
5
|
-
const blobsList = async (storeName, options, command) => {
|
|
3
|
+
import { chalk, error as printError, log, logJson } from '../../utils/command-helpers.js';
|
|
4
|
+
export const blobsList = async (storeName, options, command) => {
|
|
6
5
|
const { api, siteInfo } = command.netlify;
|
|
7
6
|
const store = getStore({
|
|
8
7
|
apiURL: `${api.scheme}://${api.host}`,
|
|
@@ -33,16 +32,3 @@ const blobsList = async (storeName, options, command) => {
|
|
|
33
32
|
return printError(`Could not list blobs from store ${chalk.yellow(storeName)}`);
|
|
34
33
|
}
|
|
35
34
|
};
|
|
36
|
-
/**
|
|
37
|
-
* Creates the `netlify blobs:list` command
|
|
38
|
-
*/
|
|
39
|
-
export const createBlobsListCommand = (program) => program
|
|
40
|
-
.command('blobs:list')
|
|
41
|
-
.description(`(Beta) Lists objects in a Netlify Blobs store`)
|
|
42
|
-
.argument('<store>', 'Name of the store')
|
|
43
|
-
.option('-d, --directories', `Indicates that keys with the '/' character should be treated as directories, returning a list of sub-directories at a given level rather than all the keys inside them`)
|
|
44
|
-
.option('-p, --prefix <prefix>', `A string for filtering down the entries; when specified, only the entries whose key starts with that prefix are returned`)
|
|
45
|
-
.option('--json', `Output list contents as JSON`)
|
|
46
|
-
.alias('blob:list')
|
|
47
|
-
.hook('preAction', requiresSiteInfo)
|
|
48
|
-
.action(blobsList);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { promises as fs } from 'fs';
|
|
2
2
|
import { resolve } from 'path';
|
|
3
3
|
import { getStore } from '@netlify/blobs';
|
|
4
|
-
import { chalk, error as printError, isNodeError } from '../../utils/command-helpers.
|
|
5
|
-
|
|
6
|
-
// eslint-disable-next-line max-params
|
|
7
|
-
const blobsSet = async (storeName, key, valueParts, options, command) => {
|
|
4
|
+
import { chalk, error as printError, isNodeError } from '../../utils/command-helpers.js';
|
|
5
|
+
export const blobsSet = async (storeName, key, valueParts, options, command) => {
|
|
8
6
|
const { api, siteInfo } = command.netlify;
|
|
9
7
|
const { input } = options;
|
|
10
8
|
const store = getStore({
|
|
@@ -39,16 +37,3 @@ const blobsSet = async (storeName, key, valueParts, options, command) => {
|
|
|
39
37
|
return printError(`Could not set blob ${chalk.yellow(key)} in store ${chalk.yellow(storeName)}`);
|
|
40
38
|
}
|
|
41
39
|
};
|
|
42
|
-
/**
|
|
43
|
-
* Creates the `netlify blobs:set` command
|
|
44
|
-
*/
|
|
45
|
-
export const createBlobsSetCommand = (program) => program
|
|
46
|
-
.command('blobs:set')
|
|
47
|
-
.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`)
|
|
48
|
-
.argument('<store>', 'Name of the store')
|
|
49
|
-
.argument('<key>', 'Object key')
|
|
50
|
-
.argument('[value...]', 'Object value')
|
|
51
|
-
.option('-i, --input <path>', 'Defines the filesystem path where the blob data should be read from')
|
|
52
|
-
.alias('blob:set')
|
|
53
|
-
.hook('preAction', requiresSiteInfo)
|
|
54
|
-
.action(blobsSet);
|