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
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import inquirer from 'inquirer';
|
|
2
|
-
import { chalk, error, exit, log } from '../../utils/command-helpers.
|
|
3
|
-
|
|
4
|
-
* The sites:delete command
|
|
5
|
-
* @param {string} siteId
|
|
6
|
-
* @param {import('commander').OptionValues} options
|
|
7
|
-
* @param {import('../base-command.mjs').default} command
|
|
8
|
-
*/
|
|
9
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'siteId' implicitly has an 'any' type.
|
|
10
|
-
const sitesDelete = async (siteId, options, command) => {
|
|
2
|
+
import { chalk, error, exit, log } from '../../utils/command-helpers.js';
|
|
3
|
+
export const sitesDelete = async (siteId, options, command) => {
|
|
11
4
|
command.setAnalyticsPayload({ force: options.force });
|
|
12
5
|
const { api, site } = command.netlify;
|
|
13
6
|
const cwdSiteId = site.id;
|
|
@@ -81,16 +74,3 @@ const sitesDelete = async (siteId, options, command) => {
|
|
|
81
74
|
}
|
|
82
75
|
log(`Site "${siteId}" successfully deleted!`);
|
|
83
76
|
};
|
|
84
|
-
/**
|
|
85
|
-
* Creates the `netlify sites:delete` command
|
|
86
|
-
* @param {import('../base-command.mjs').default} program
|
|
87
|
-
* @returns
|
|
88
|
-
*/
|
|
89
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
90
|
-
export const createSitesDeleteCommand = (program) => program
|
|
91
|
-
.command('sites:delete')
|
|
92
|
-
.description('Delete a site\nThis command will permanently delete the site on Netlify. Use with caution.')
|
|
93
|
-
.argument('<siteId>', 'Site ID to delete.')
|
|
94
|
-
.option('-f, --force', 'delete without prompting (useful for CI)')
|
|
95
|
-
.addExamples(['netlify sites:delete 1234-3262-1211'])
|
|
96
|
-
.action(sitesDelete);
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import { listSites } from '../../lib/api.
|
|
2
|
-
import { startSpinner, stopSpinner } from '../../lib/spinner.
|
|
3
|
-
import { chalk, log, logJson } from '../../utils/command-helpers.
|
|
4
|
-
|
|
5
|
-
* The sites:list command
|
|
6
|
-
* @param {import('commander').OptionValues} options
|
|
7
|
-
* @param {import('../base-command.mjs').default} command
|
|
8
|
-
* @returns {Promise<{ id: any; name: any; ssl_url: any; account_name: any; }|boolean>}
|
|
9
|
-
*/
|
|
10
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
|
|
11
|
-
const sitesList = async (options, command) => {
|
|
1
|
+
import { listSites } from '../../lib/api.js';
|
|
2
|
+
import { startSpinner, stopSpinner } from '../../lib/spinner.js';
|
|
3
|
+
import { chalk, log, logJson } from '../../utils/command-helpers.js';
|
|
4
|
+
export const sitesList = async (options, command) => {
|
|
12
5
|
const { api } = command.netlify;
|
|
13
6
|
/** @type {import('ora').Ora} */
|
|
14
7
|
let spinner;
|
|
@@ -69,16 +62,3 @@ Count: ${logSites.length}
|
|
|
69
62
|
});
|
|
70
63
|
}
|
|
71
64
|
};
|
|
72
|
-
/**
|
|
73
|
-
* Creates the `netlify sites:list` command
|
|
74
|
-
* @param {import('../base-command.mjs').default} program
|
|
75
|
-
*/
|
|
76
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
77
|
-
export const createSitesListCommand = (program) => program
|
|
78
|
-
.command('sites:list')
|
|
79
|
-
.description('List all sites you have access to')
|
|
80
|
-
.option('--json', 'Output site data as JSON')
|
|
81
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
|
|
82
|
-
.action(async (options, command) => {
|
|
83
|
-
await sitesList(options, command);
|
|
84
|
-
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { InvalidArgumentError } from 'commander';
|
|
2
|
+
const MAX_SITE_NAME_LENGTH = 63;
|
|
3
|
+
// @ts-expect-error TS(7006) FIXME: Parameter 'value' implicitly has an 'any' type.
|
|
4
|
+
const validateName = function (value) {
|
|
5
|
+
// netlify sites:create --name <A string of more than 63 words>
|
|
6
|
+
if (typeof value === 'string' && value.length > MAX_SITE_NAME_LENGTH) {
|
|
7
|
+
throw new InvalidArgumentError(`--name should be less than 64 characters, input length: ${value.length}`);
|
|
8
|
+
}
|
|
9
|
+
return value;
|
|
10
|
+
};
|
|
11
|
+
const sites = (options, command) => {
|
|
12
|
+
command.help();
|
|
13
|
+
};
|
|
14
|
+
export const createSitesFromTemplateCommand = (program) => {
|
|
15
|
+
program
|
|
16
|
+
.command('sites:create-template')
|
|
17
|
+
.description(`(Beta) Create a site from a starter template
|
|
18
|
+
Create a site from a starter template.`)
|
|
19
|
+
.option('-n, --name [name]', 'name of site')
|
|
20
|
+
.option('-u, --url [url]', 'template url')
|
|
21
|
+
.option('-a, --account-slug [slug]', 'account slug to create the site under')
|
|
22
|
+
.option('-c, --with-ci', 'initialize CI hooks during site creation')
|
|
23
|
+
.argument('[repository]', 'repository to use as starter template')
|
|
24
|
+
.addHelpText('after', `(Beta) Create a site from starter template.`)
|
|
25
|
+
.addExamples([
|
|
26
|
+
'netlify sites:create-template',
|
|
27
|
+
'netlify sites:create-template nextjs-blog-theme',
|
|
28
|
+
'netlify sites:create-template my-github-profile/my-template',
|
|
29
|
+
])
|
|
30
|
+
.action(async (repository, options, command) => {
|
|
31
|
+
const { sitesCreateTemplate } = await import('./sites-create-template.js');
|
|
32
|
+
await sitesCreateTemplate(repository, options, command);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
export const createSitesCreateCommand = (program) => {
|
|
36
|
+
program
|
|
37
|
+
.command('sites:create')
|
|
38
|
+
.description(`Create an empty site (advanced)
|
|
39
|
+
Create a blank site that isn't associated with any git remote. Will link the site to the current working directory.`)
|
|
40
|
+
.option('-n, --name <name>', 'name of site', validateName)
|
|
41
|
+
.option('-a, --account-slug <slug>', 'account slug to create the site under')
|
|
42
|
+
.option('-c, --with-ci', 'initialize CI hooks during site creation')
|
|
43
|
+
.option('-m, --manual', 'force manual CI setup. Used --with-ci flag')
|
|
44
|
+
.option('--disable-linking', 'create the site without linking it to current directory')
|
|
45
|
+
.addHelpText('after', `Create a blank site that isn't associated with any git remote. Will link the site to the current working directory.`)
|
|
46
|
+
.action(async (options, command) => {
|
|
47
|
+
const { sitesCreate } = await import('./sites-create.js');
|
|
48
|
+
await sitesCreate(options, command);
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
export const createSitesCommand = (program) => {
|
|
52
|
+
createSitesCreateCommand(program);
|
|
53
|
+
createSitesFromTemplateCommand(program);
|
|
54
|
+
program
|
|
55
|
+
.command('sites:list')
|
|
56
|
+
.description('List all sites you have access to')
|
|
57
|
+
.option('--json', 'Output site data as JSON')
|
|
58
|
+
.action(async (options, command) => {
|
|
59
|
+
const { sitesList } = await import('./sites-list.js');
|
|
60
|
+
await sitesList(options, command);
|
|
61
|
+
});
|
|
62
|
+
program
|
|
63
|
+
.command('sites:delete')
|
|
64
|
+
.description('Delete a site\nThis command will permanently delete the site on Netlify. Use with caution.')
|
|
65
|
+
.argument('<siteId>', 'Site ID to delete.')
|
|
66
|
+
.option('-f, --force', 'delete without prompting (useful for CI)')
|
|
67
|
+
.addExamples(['netlify sites:delete 1234-3262-1211'])
|
|
68
|
+
.action(async (siteId, options, command) => {
|
|
69
|
+
const { sitesDelete } = await import('./sites-delete.js');
|
|
70
|
+
await sitesDelete(siteId, options, command);
|
|
71
|
+
});
|
|
72
|
+
return program
|
|
73
|
+
.command('sites')
|
|
74
|
+
.description(`Handle various site operations\nThe sites command will help you manage all your sites`)
|
|
75
|
+
.addExamples(['netlify sites:create --name my-new-site', 'netlify sites:list'])
|
|
76
|
+
.action(sites);
|
|
77
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import requiresSiteInfo from '../../utils/hooks/requires-site-info.js';
|
|
2
|
+
export const createStatusCommand = (program) => {
|
|
3
|
+
program
|
|
4
|
+
.command('status:hooks')
|
|
5
|
+
.description('Print hook information of the linked site')
|
|
6
|
+
.hook('preAction', requiresSiteInfo)
|
|
7
|
+
.action(async (options, command) => {
|
|
8
|
+
const { statusHooks } = await import('./status-hooks.js');
|
|
9
|
+
await statusHooks(options, command);
|
|
10
|
+
});
|
|
11
|
+
return program
|
|
12
|
+
.command('status')
|
|
13
|
+
.description('Print status information')
|
|
14
|
+
.option('--verbose', 'Output system info')
|
|
15
|
+
.action(async (options, command) => {
|
|
16
|
+
const { status } = await import('./status.js');
|
|
17
|
+
await status(options, command);
|
|
18
|
+
});
|
|
19
|
+
};
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import prettyjson from 'prettyjson';
|
|
2
|
-
import { log } from '../../utils/command-helpers.
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The status:hooks command
|
|
6
|
-
* @param {import('commander').OptionValues} options
|
|
7
|
-
* @param {import('../base-command.mjs').default} command
|
|
8
|
-
*/
|
|
9
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
|
|
10
|
-
const statusHooks = async (options, command) => {
|
|
2
|
+
import { log } from '../../utils/command-helpers.js';
|
|
3
|
+
export const statusHooks = async (options, command) => {
|
|
11
4
|
const { api, siteInfo } = command.netlify;
|
|
12
5
|
await command.authenticate();
|
|
13
6
|
const ntlHooks = await api.listHooksBySiteId({ siteId: siteInfo.id });
|
|
@@ -34,14 +27,3 @@ Site Hook Status │
|
|
|
34
27
|
─────────────────┘`);
|
|
35
28
|
log(prettyjson.render(data));
|
|
36
29
|
};
|
|
37
|
-
/**
|
|
38
|
-
* Creates the `netlify status:hooks` command
|
|
39
|
-
* @param {import('../base-command.mjs').default} program
|
|
40
|
-
* @returns
|
|
41
|
-
*/
|
|
42
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
43
|
-
export const createStatusHooksCommand = (program) => program
|
|
44
|
-
.command('status:hooks')
|
|
45
|
-
.description('Print hook information of the linked site')
|
|
46
|
-
.hook('preAction', requiresSiteInfo)
|
|
47
|
-
.action(statusHooks);
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import clean from 'clean-deep';
|
|
2
2
|
import prettyjson from 'prettyjson';
|
|
3
|
-
import { chalk, error, exit, getToken, log, logJson, warn } from '../../utils/command-helpers.
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* The status command
|
|
7
|
-
* @param {import('commander').OptionValues} options
|
|
8
|
-
* @param {import('../base-command.mjs').default} command
|
|
9
|
-
*/
|
|
10
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
|
|
11
|
-
const status = async (options, command) => {
|
|
3
|
+
import { chalk, error, exit, getToken, log, logJson, warn } from '../../utils/command-helpers.js';
|
|
4
|
+
export const status = async (options, command) => {
|
|
12
5
|
const { api, globalConfig, site, siteInfo } = command.netlify;
|
|
13
6
|
const current = globalConfig.get('userId');
|
|
14
7
|
// @ts-expect-error TS(2554) FIXME: Expected 1 arguments, but got 0.
|
|
@@ -85,17 +78,3 @@ const status = async (options, command) => {
|
|
|
85
78
|
}));
|
|
86
79
|
log();
|
|
87
80
|
};
|
|
88
|
-
/**
|
|
89
|
-
* Creates the `netlify status` command
|
|
90
|
-
* @param {import('../base-command.mjs').default} program
|
|
91
|
-
* @returns
|
|
92
|
-
*/
|
|
93
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
94
|
-
export const createStatusCommand = (program) => {
|
|
95
|
-
createStatusHooksCommand(program);
|
|
96
|
-
return program
|
|
97
|
-
.command('status')
|
|
98
|
-
.description('Print status information')
|
|
99
|
-
.option('--verbose', 'Output system info')
|
|
100
|
-
.action(status);
|
|
101
|
-
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const createSwitchCommand = (program) => program
|
|
2
|
+
.command('switch')
|
|
3
|
+
.description('Switch your active Netlify account')
|
|
4
|
+
.action(async (options, command) => {
|
|
5
|
+
const { switchCommand } = await import('./switch.js');
|
|
6
|
+
await switchCommand(options, command);
|
|
7
|
+
});
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import inquirer from 'inquirer';
|
|
2
|
-
import { chalk, log } from '../../utils/command-helpers.
|
|
3
|
-
import { login } from '../login/
|
|
2
|
+
import { chalk, log } from '../../utils/command-helpers.js';
|
|
3
|
+
import { login } from '../login/login.js';
|
|
4
4
|
const LOGIN_NEW = 'I would like to login to a new account';
|
|
5
|
-
|
|
6
|
-
* The switch command
|
|
7
|
-
* @param {import('commander').OptionValues} options
|
|
8
|
-
* @param {import('../base-command.mjs').default} command
|
|
9
|
-
*/
|
|
10
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
|
|
11
|
-
const switchCommand = async (options, command) => {
|
|
5
|
+
export const switchCommand = async (options, command) => {
|
|
12
6
|
const availableUsersChoices = Object.values(command.netlify.globalConfig.get('users') || {}).reduce((prev, current) =>
|
|
13
7
|
// @ts-expect-error TS(2769) FIXME: No overload matches this call.
|
|
14
8
|
Object.assign(prev, { [current.id]: current.name ? `${current.name} (${current.email})` : current.email }), {});
|
|
@@ -34,10 +28,3 @@ const switchCommand = async (options, command) => {
|
|
|
34
28
|
log(`You're now using ${chalk.bold(selectedAccount[1])}.`);
|
|
35
29
|
}
|
|
36
30
|
};
|
|
37
|
-
/**
|
|
38
|
-
* Creates the `netlify switch` command
|
|
39
|
-
* @param {import('../base-command.mjs').default} program
|
|
40
|
-
* @returns
|
|
41
|
-
*/
|
|
42
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
43
|
-
export const createSwitchCommand = (program) => program.command('switch').description('Switch your active Netlify account').action(switchCommand);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { exit, log } from '../../utils/command-helpers.js';
|
|
2
|
+
import { track } from '../../utils/telemetry/index.js';
|
|
3
|
+
export const unlink = async (options, command) => {
|
|
4
|
+
const { site, siteInfo, state } = command.netlify;
|
|
5
|
+
const siteId = site.id;
|
|
6
|
+
if (!siteId) {
|
|
7
|
+
log(`Folder is not linked to a Netlify site. Run 'netlify link' to link it`);
|
|
8
|
+
return exit();
|
|
9
|
+
}
|
|
10
|
+
const siteData = siteInfo;
|
|
11
|
+
state.delete('siteId');
|
|
12
|
+
await track('sites_unlinked', {
|
|
13
|
+
siteId: siteData.id || siteId,
|
|
14
|
+
});
|
|
15
|
+
if (site) {
|
|
16
|
+
log(`Unlinked ${site.configPath} from ${siteData ? siteData.name : siteId}`);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
log('Unlinked site');
|
|
20
|
+
}
|
|
21
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const createWatchCommand = (program) => program
|
|
2
|
+
.command('watch')
|
|
3
|
+
.description('Watch for site deploy to finish')
|
|
4
|
+
.addExamples([`netlify watch`, `git push && netlify watch`])
|
|
5
|
+
.action(async (options, command) => {
|
|
6
|
+
const { watch } = await import('./watch.js');
|
|
7
|
+
await watch(options, command);
|
|
8
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import pWaitFor from 'p-wait-for';
|
|
2
2
|
import prettyjson from 'prettyjson';
|
|
3
|
-
import { startSpinner, stopSpinner } from '../../lib/spinner.
|
|
4
|
-
import { chalk, error, log } from '../../utils/command-helpers.
|
|
5
|
-
import { init } from '../init/
|
|
3
|
+
import { startSpinner, stopSpinner } from '../../lib/spinner.js';
|
|
4
|
+
import { chalk, error, log } from '../../utils/command-helpers.js';
|
|
5
|
+
import { init } from '../init/init.js';
|
|
6
6
|
// 1 second
|
|
7
7
|
const INIT_WAIT = 1e3;
|
|
8
8
|
// 1 second
|
|
@@ -44,13 +44,7 @@ const waitForBuildFinish = async function (api, siteId, spinner) {
|
|
|
44
44
|
// return only when build done or timeout happens
|
|
45
45
|
return firstPass;
|
|
46
46
|
};
|
|
47
|
-
|
|
48
|
-
* The watch command
|
|
49
|
-
* @param {import('commander').OptionValues} options
|
|
50
|
-
* @param {import('../base-command.mjs').default} command
|
|
51
|
-
*/
|
|
52
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
|
|
53
|
-
const watch = async (options, command) => {
|
|
47
|
+
export const watch = async (options, command) => {
|
|
54
48
|
await command.authenticate();
|
|
55
49
|
const client = command.netlify.api;
|
|
56
50
|
let siteId = command.netlify.site.id;
|
|
@@ -104,14 +98,3 @@ const watch = async (options, command) => {
|
|
|
104
98
|
error(error_);
|
|
105
99
|
}
|
|
106
100
|
};
|
|
107
|
-
/**
|
|
108
|
-
* Creates the `netlify watch` command
|
|
109
|
-
* @param {import('../base-command.mjs').default} program
|
|
110
|
-
* @returns
|
|
111
|
-
*/
|
|
112
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
113
|
-
export const createWatchCommand = (program) => program
|
|
114
|
-
.command('watch')
|
|
115
|
-
.description('Watch for site deploy to finish')
|
|
116
|
-
.addExamples([`netlify watch`, `git push && netlify watch`])
|
|
117
|
-
.action(watch);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { warn } from '../utils/command-helpers.
|
|
1
|
+
import { warn } from '../utils/command-helpers.js';
|
|
2
2
|
// @ts-expect-error TS(7031) FIXME: Binding element 'api' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
3
3
|
export const cancelDeploy = async ({ api, deployId }) => {
|
|
4
4
|
try {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { BlobsServer } from '@netlify/blobs';
|
|
3
3
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
|
-
import { log, NETLIFYDEVLOG } from '../../utils/command-helpers.
|
|
5
|
-
import { getPathInProject } from '../settings.
|
|
4
|
+
import { log, NETLIFYDEVLOG } from '../../utils/command-helpers.js';
|
|
5
|
+
import { getPathInProject } from '../settings.js';
|
|
6
6
|
let hasPrintedLocalBlobsNotice = false;
|
|
7
7
|
const printLocalBlobsNotice = () => {
|
|
8
8
|
if (hasPrintedLocalBlobsNotice) {
|
|
@@ -3,9 +3,9 @@ import process from 'process';
|
|
|
3
3
|
import build from '@netlify/build';
|
|
4
4
|
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'toml... Remove this comment to see the full error message
|
|
5
5
|
import tomlify from 'tomlify-j0.4';
|
|
6
|
-
import { isFeatureFlagEnabled } from '../utils/feature-flags.
|
|
7
|
-
import { getBootstrapURL } from './edge-functions/bootstrap.
|
|
8
|
-
import { featureFlags as edgeFunctionsFeatureFlags } from './edge-functions/consts.
|
|
6
|
+
import { isFeatureFlagEnabled } from '../utils/feature-flags.js';
|
|
7
|
+
import { getBootstrapURL } from './edge-functions/bootstrap.js';
|
|
8
|
+
import { featureFlags as edgeFunctionsFeatureFlags } from './edge-functions/consts.js';
|
|
9
9
|
/**
|
|
10
10
|
* The buildConfig + a missing cachedConfig
|
|
11
11
|
* @typedef BuildConfig
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { getPathInHome } from '../settings.
|
|
1
|
+
import { getPathInHome } from '../settings.js';
|
|
2
2
|
export const AUTOCOMPLETION_FILE = getPathInHome(['autocompletion.json']);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import { dirname } from 'path';
|
|
3
|
-
import { sortOptions, warn } from '../../utils/command-helpers.
|
|
4
|
-
import { AUTOCOMPLETION_FILE } from './constants.
|
|
3
|
+
import { sortOptions, warn } from '../../utils/command-helpers.js';
|
|
4
|
+
import { AUTOCOMPLETION_FILE } from './constants.js';
|
|
5
5
|
/**
|
|
6
6
|
* Create or updates the autocompletion information for the CLI
|
|
7
|
-
* @param {import('../../commands/base-command.
|
|
7
|
+
* @param {import('../../commands/base-command.js').default} program
|
|
8
8
|
* @returns {void}
|
|
9
9
|
*/
|
|
10
10
|
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as generateAutocompletion } from './generate-autocompletion.
|
|
1
|
+
export { default as generateAutocompletion } from './generate-autocompletion.js';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// This script is run by the completion (every log output will be displayed on tab)
|
|
3
|
-
// src/commands/completion/completion.
|
|
3
|
+
// src/commands/completion/completion.js -> dynamically references this file
|
|
4
4
|
// if this file is renamed or moved then it needs to be adapted there
|
|
5
5
|
import { existsSync, readFileSync } from 'fs';
|
|
6
6
|
import process from 'process';
|
|
7
7
|
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'tabt... Remove this comment to see the full error message
|
|
8
8
|
import { log, parseEnv } from 'tabtab';
|
|
9
|
-
import { AUTOCOMPLETION_FILE } from './constants.
|
|
10
|
-
import getAutocompletion from './get-autocompletion.
|
|
9
|
+
import { AUTOCOMPLETION_FILE } from './constants.js';
|
|
10
|
+
import getAutocompletion from './get-autocompletion.js';
|
|
11
11
|
/**
|
|
12
12
|
* @typedef CompletionItem
|
|
13
13
|
* @type import('tabtab').CompletionItem
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { stat } from 'fs/promises';
|
|
2
2
|
import { join } from 'path';
|
|
3
|
-
import { getPathInProject } from '../settings.
|
|
4
|
-
import { EDGE_FUNCTIONS_FOLDER, PUBLIC_URL_PATH } from './consts.
|
|
3
|
+
import { getPathInProject } from '../settings.js';
|
|
4
|
+
import { EDGE_FUNCTIONS_FOLDER, PUBLIC_URL_PATH } from './consts.js';
|
|
5
5
|
const distPath = getPathInProject([EDGE_FUNCTIONS_FOLDER]);
|
|
6
6
|
/**
|
|
7
7
|
* @param {string} workingDir
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { env } from 'process';
|
|
2
2
|
import inquirer from 'inquirer';
|
|
3
|
-
import { runRecipe } from '../../commands/recipes/
|
|
3
|
+
import { runRecipe } from '../../commands/recipes/recipes.js';
|
|
4
4
|
const STATE_PROMPT_PROPERTY = 'promptVSCodeSettings';
|
|
5
5
|
// @ts-expect-error TS(7031) FIXME: Binding element 'NETLIFYDEVLOG' implicitly has an ... Remove this comment to see the full error message
|
|
6
6
|
export const promptEditorHelper = async ({ NETLIFYDEVLOG, chalk, config, log, repositoryRoot, state }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFile, stat } from 'fs/promises';
|
|
2
2
|
import { dirname, join, resolve } from 'path';
|
|
3
|
-
import { getPathInProject } from '../settings.
|
|
4
|
-
import { INTERNAL_EDGE_FUNCTIONS_FOLDER } from './consts.
|
|
3
|
+
import { getPathInProject } from '../settings.js';
|
|
4
|
+
import { INTERNAL_EDGE_FUNCTIONS_FOLDER } from './consts.js';
|
|
5
5
|
/**
|
|
6
6
|
* @param {string} workingDir
|
|
7
7
|
*/
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { Buffer } from 'buffer';
|
|
2
2
|
import { rm } from 'fs/promises';
|
|
3
3
|
import { join, resolve } from 'path';
|
|
4
|
-
// eslint-disable-next-line import/no-namespace
|
|
5
4
|
import * as bundler from '@netlify/edge-bundler';
|
|
6
5
|
import getAvailablePort from 'get-port';
|
|
7
|
-
import { NETLIFYDEVERR, chalk, error as printError } from '../../utils/command-helpers.
|
|
8
|
-
import { getGeoLocation } from '../geo-location.
|
|
9
|
-
import { getPathInProject } from '../settings.
|
|
10
|
-
import { startSpinner, stopSpinner } from '../spinner.
|
|
11
|
-
import { getBootstrapURL } from './bootstrap.
|
|
12
|
-
import { DIST_IMPORT_MAP_PATH, EDGE_FUNCTIONS_SERVE_FOLDER } from './consts.
|
|
13
|
-
import { headers, getFeatureFlagsHeader, getInvocationMetadataHeader } from './headers.
|
|
14
|
-
import { getInternalFunctions } from './internal.
|
|
15
|
-
import { EdgeFunctionsRegistry } from './registry.
|
|
6
|
+
import { NETLIFYDEVERR, chalk, error as printError } from '../../utils/command-helpers.js';
|
|
7
|
+
import { getGeoLocation } from '../geo-location.js';
|
|
8
|
+
import { getPathInProject } from '../settings.js';
|
|
9
|
+
import { startSpinner, stopSpinner } from '../spinner.js';
|
|
10
|
+
import { getBootstrapURL } from './bootstrap.js';
|
|
11
|
+
import { DIST_IMPORT_MAP_PATH, EDGE_FUNCTIONS_SERVE_FOLDER } from './consts.js';
|
|
12
|
+
import { headers, getFeatureFlagsHeader, getInvocationMetadataHeader } from './headers.js';
|
|
13
|
+
import { getInternalFunctions } from './internal.js';
|
|
14
|
+
import { EdgeFunctionsRegistry } from './registry.js';
|
|
16
15
|
const headersSymbol = Symbol('Edge Functions Headers');
|
|
17
16
|
const LOCAL_HOST = '127.0.0.1';
|
|
18
17
|
const getDownloadUpdateFunctions = () => {
|
|
@@ -58,7 +57,7 @@ export const createAccountInfoHeader = (accountInfo = {}) => {
|
|
|
58
57
|
*
|
|
59
58
|
* @param {object} config
|
|
60
59
|
* @param {*} config.accountId
|
|
61
|
-
* @param {import("../blobs/blobs.
|
|
60
|
+
* @param {import("../blobs/blobs.js").BlobsContext} config.blobsContext
|
|
62
61
|
* @param {*} config.config
|
|
63
62
|
* @param {*} config.configPath
|
|
64
63
|
* @param {*} config.debug
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fileURLToPath } from 'url';
|
|
2
|
-
import { NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, nonNullable, chalk, log, warn, watchDebounced, isNodeError, } from '../../utils/command-helpers.
|
|
2
|
+
import { NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, nonNullable, chalk, log, warn, watchDebounced, isNodeError, } from '../../utils/command-helpers.js';
|
|
3
3
|
const featureFlags = { edge_functions_correct_order: true };
|
|
4
4
|
export class EdgeFunctionsRegistry {
|
|
5
5
|
constructor({ bundler, config, configPath, directories, env, getUpdatedConfig, internalDirectories, internalFunctions, projectDir, runIsolate, servePath, }) {
|
|
@@ -3,9 +3,9 @@ import process from 'process';
|
|
|
3
3
|
import { fetchLatest, fetchVersion, newerVersion, updateAvailable } from 'gh-release-fetch';
|
|
4
4
|
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'isex... Remove this comment to see the full error message
|
|
5
5
|
import isExe from 'isexe';
|
|
6
|
-
import { NETLIFYDEVWARN, error, getTerminalLink, log } from '../utils/command-helpers.
|
|
6
|
+
import { NETLIFYDEVWARN, error, getTerminalLink, log } from '../utils/command-helpers.js';
|
|
7
7
|
// @ts-expect-error TS(7034) FIXME: Variable 'execa' implicitly has type 'any' in some... Remove this comment to see the full error message
|
|
8
|
-
import execa from '../utils/execa.
|
|
8
|
+
import execa from '../utils/execa.js';
|
|
9
9
|
const isWindows = () => process.platform === 'win32';
|
|
10
10
|
// @ts-expect-error TS(7031) FIXME: Binding element 'packageName' implicitly has an 'a... Remove this comment to see the full error message
|
|
11
11
|
const getRepository = ({ packageName }) => `netlify/${packageName}`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NETLIFYDEVERR, NETLIFYDEVLOG } from '../../utils/command-helpers.
|
|
2
|
-
import { formatLambdaError, styleFunctionName } from './utils.
|
|
1
|
+
import { NETLIFYDEVERR, NETLIFYDEVLOG } from '../../utils/command-helpers.js';
|
|
2
|
+
import { formatLambdaError, styleFunctionName } from './utils.js';
|
|
3
3
|
const BACKGROUND_FUNCTION_STATUS_CODE = 202;
|
|
4
4
|
// @ts-expect-error TS(7006) FIXME: Parameter 'functionName' implicitly has an 'any' t... Remove this comment to see the full error message
|
|
5
5
|
export const handleBackgroundFunction = (functionName, response) => {
|
|
@@ -4,9 +4,9 @@ import { parse as parseContentType } from 'content-type';
|
|
|
4
4
|
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'mult... Remove this comment to see the full error message
|
|
5
5
|
import multiparty from 'multiparty';
|
|
6
6
|
import getRawBody from 'raw-body';
|
|
7
|
-
import { warn } from '../../utils/command-helpers.
|
|
8
|
-
import { BACKGROUND } from '../../utils/functions/index.
|
|
9
|
-
import { capitalize } from '../string.
|
|
7
|
+
import { warn } from '../../utils/command-helpers.js';
|
|
8
|
+
import { BACKGROUND } from '../../utils/functions/index.js';
|
|
9
|
+
import { capitalize } from '../string.js';
|
|
10
10
|
// @ts-expect-error TS(7031) FIXME: Binding element 'functionsRegistry' implicitly has... Remove this comment to see the full error message
|
|
11
11
|
const getFormHandler = function ({ functionsRegistry }) {
|
|
12
12
|
const handlers = ['submission-created', `submission-created${BACKGROUND}`]
|
|
@@ -2,7 +2,7 @@ import { stdout } from 'process';
|
|
|
2
2
|
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module '@net... Remove this comment to see the full error message
|
|
3
3
|
import { getBinaryPath as getFunctionsProxyPath } from '@netlify/local-functions-proxy';
|
|
4
4
|
// @ts-expect-error TS(7034) FIXME: Variable 'execa' implicitly has type 'any' in some... Remove this comment to see the full error message
|
|
5
|
-
import execa from '../../utils/execa.
|
|
5
|
+
import execa from '../../utils/execa.js';
|
|
6
6
|
// @ts-expect-error TS(7031) FIXME: Binding element 'binaryPath' implicitly has an 'an... Remove this comment to see the full error message
|
|
7
7
|
export const runFunctionsProxy = ({ binaryPath, context, directory, event, name, timeout }) => {
|
|
8
8
|
const functionsProxyPath = getFunctionsProxyPath();
|
|
@@ -3,8 +3,8 @@ import { basename, extname } from 'path';
|
|
|
3
3
|
import { version as nodeVersion } from 'process';
|
|
4
4
|
import CronParser from 'cron-parser';
|
|
5
5
|
import semver from 'semver';
|
|
6
|
-
import { error as errorExit } from '../../utils/command-helpers.
|
|
7
|
-
import { BACKGROUND } from '../../utils/functions/get-functions.
|
|
6
|
+
import { error as errorExit } from '../../utils/command-helpers.js';
|
|
7
|
+
import { BACKGROUND } from '../../utils/functions/get-functions.js';
|
|
8
8
|
const TYPESCRIPT_EXTENSIONS = new Set(['.cts', '.mts', '.ts']);
|
|
9
9
|
const V2_MIN_NODE_VERSION = '18.14.0';
|
|
10
10
|
// Returns a new set with all elements of `setA` that don't exist in `setB`.
|
|
@@ -103,7 +103,7 @@ export default class NetlifyFunction {
|
|
|
103
103
|
return '.mts';
|
|
104
104
|
}
|
|
105
105
|
if (extension === '.js') {
|
|
106
|
-
return '.
|
|
106
|
+
return '.js';
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
hasValidName() {
|
|
@@ -4,12 +4,12 @@ import { basename, extname, isAbsolute, join, resolve } from 'path';
|
|
|
4
4
|
import { env } from 'process';
|
|
5
5
|
import { listFunctions } from '@netlify/zip-it-and-ship-it';
|
|
6
6
|
import extractZip from 'extract-zip';
|
|
7
|
-
import { chalk, log, getTerminalLink, NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, warn, watchDebounced, } from '../../utils/command-helpers.
|
|
8
|
-
import { INTERNAL_FUNCTIONS_FOLDER, SERVE_FUNCTIONS_FOLDER } from '../../utils/functions/functions.
|
|
9
|
-
import { BACKGROUND_FUNCTIONS_WARNING } from '../log.
|
|
10
|
-
import { getPathInProject } from '../settings.
|
|
11
|
-
import NetlifyFunction from './netlify-function.
|
|
12
|
-
import runtimes from './runtimes/index.
|
|
7
|
+
import { chalk, log, getTerminalLink, NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, warn, watchDebounced, } from '../../utils/command-helpers.js';
|
|
8
|
+
import { INTERNAL_FUNCTIONS_FOLDER, SERVE_FUNCTIONS_FOLDER } from '../../utils/functions/functions.js';
|
|
9
|
+
import { BACKGROUND_FUNCTIONS_WARNING } from '../log.js';
|
|
10
|
+
import { getPathInProject } from '../settings.js';
|
|
11
|
+
import NetlifyFunction from './netlify-function.js';
|
|
12
|
+
import runtimes from './runtimes/index.js';
|
|
13
13
|
export const DEFAULT_FUNCTION_URL_EXPRESSION = /^\/.netlify\/(functions|builders)\/([^/]+).*/;
|
|
14
14
|
const TYPES_PACKAGE = '@netlify/functions';
|
|
15
15
|
const ZIP_EXTENSION = '.zip';
|
|
@@ -51,7 +51,7 @@ export class FunctionsRegistry {
|
|
|
51
51
|
/**
|
|
52
52
|
* Context object for Netlify Blobs
|
|
53
53
|
*
|
|
54
|
-
* @type {import("../blobs/blobs.
|
|
54
|
+
* @type {import("../blobs/blobs.js").BlobsContext}
|
|
55
55
|
*/
|
|
56
56
|
// @ts-expect-error TS(2339) FIXME: Property 'blobsContext' does not exist on type 'Fu... Remove this comment to see the full error message
|
|
57
57
|
this.blobsContext = blobsContext;
|
|
@@ -363,10 +363,10 @@ export class FunctionsRegistry {
|
|
|
363
363
|
func.buildData = manifestEntry?.buildData || {};
|
|
364
364
|
// When we look at an unzipped function, we don't know whether it uses
|
|
365
365
|
// the legacy entry file format (i.e. `[function name].js`) or the new
|
|
366
|
-
// one (i.e. `___netlify-entry-point.
|
|
366
|
+
// one (i.e. `___netlify-entry-point.js`). Let's look for the new one
|
|
367
367
|
// and use it if it exists, otherwise use the old one.
|
|
368
368
|
try {
|
|
369
|
-
const v2EntryPointPath = join(unzippedDirectory, '___netlify-entry-point.
|
|
369
|
+
const v2EntryPointPath = join(unzippedDirectory, '___netlify-entry-point.js');
|
|
370
370
|
await stat(v2EntryPointPath);
|
|
371
371
|
func.mainFile = v2EntryPointPath;
|
|
372
372
|
}
|