netlify-cli 17.3.2 → 17.4.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/README.md +2 -138
- package/npm-shrinkwrap.json +76 -76
- package/package.json +16 -15
- package/src/commands/addons/addons-auth.mjs +27 -30
- package/src/commands/addons/addons-config.mjs +145 -154
- package/src/commands/addons/addons-create.mjs +94 -108
- package/src/commands/addons/addons-delete.mjs +36 -41
- package/src/commands/addons/addons-list.mjs +38 -42
- package/src/commands/addons/addons.mjs +26 -28
- package/src/commands/addons/index.mjs +1 -1
- package/src/commands/api/api.mjs +45 -53
- package/src/commands/api/index.mjs +1 -1
- package/src/commands/base-command.mjs +597 -684
- package/src/commands/blobs/blobs-delete.mjs +35 -0
- package/src/commands/blobs/blobs-get.mjs +44 -0
- package/src/commands/blobs/blobs-list.mjs +48 -0
- package/src/commands/blobs/blobs-set.mjs +54 -0
- package/src/commands/blobs/blobs.mjs +32 -0
- package/src/commands/blobs/index.mjs +1 -0
- package/src/commands/build/build.mjs +55 -67
- package/src/commands/build/index.mjs +1 -1
- package/src/commands/completion/completion.mjs +41 -46
- package/src/commands/completion/index.mjs +1 -1
- package/src/commands/deploy/deploy.mjs +675 -710
- package/src/commands/deploy/index.mjs +1 -1
- package/src/commands/dev/dev-exec.mjs +20 -32
- package/src/commands/dev/dev.mjs +217 -302
- package/src/commands/dev/index.mjs +1 -1
- package/src/commands/dev/types.d.ts +30 -0
- package/src/commands/env/env-clone.mjs +157 -184
- package/src/commands/env/env-get.mjs +49 -68
- package/src/commands/env/env-import.mjs +100 -119
- package/src/commands/env/env-list.mjs +104 -129
- package/src/commands/env/env-set.mjs +160 -185
- package/src/commands/env/env-unset.mjs +104 -122
- package/src/commands/env/env.mjs +28 -30
- package/src/commands/env/index.mjs +1 -1
- package/src/commands/functions/functions-build.mjs +29 -41
- package/src/commands/functions/functions-create.mjs +533 -601
- package/src/commands/functions/functions-invoke.mjs +193 -216
- package/src/commands/functions/functions-list.mjs +45 -55
- package/src/commands/functions/functions-serve.mjs +51 -61
- package/src/commands/functions/functions.mjs +26 -32
- package/src/commands/functions/index.mjs +1 -1
- package/src/commands/index.mjs +2 -2
- package/src/commands/init/index.mjs +1 -1
- package/src/commands/init/init.mjs +138 -167
- package/src/commands/integration/deploy.mjs +337 -399
- package/src/commands/integration/index.mjs +12 -13
- package/src/commands/link/index.mjs +1 -1
- package/src/commands/link/link.mjs +298 -317
- package/src/commands/lm/index.mjs +1 -1
- package/src/commands/lm/lm-info.mjs +23 -31
- package/src/commands/lm/lm-install.mjs +13 -17
- package/src/commands/lm/lm-setup.mjs +80 -84
- package/src/commands/lm/lm-uninstall.mjs +7 -12
- package/src/commands/lm/lm.mjs +18 -22
- package/src/commands/login/index.mjs +1 -1
- package/src/commands/login/login.mjs +35 -41
- package/src/commands/logout/index.mjs +1 -1
- package/src/commands/logout/logout.mjs +25 -31
- package/src/commands/main.mjs +166 -201
- package/src/commands/open/index.mjs +1 -1
- package/src/commands/open/open-admin.mjs +15 -18
- package/src/commands/open/open-site.mjs +16 -19
- package/src/commands/open/open.mjs +24 -27
- package/src/commands/recipes/common.mjs +23 -34
- package/src/commands/recipes/index.mjs +1 -1
- package/src/commands/recipes/recipes-list.mjs +13 -20
- package/src/commands/recipes/recipes.mjs +59 -72
- package/src/commands/serve/index.mjs +1 -1
- package/src/commands/serve/serve.mjs +142 -189
- package/src/commands/sites/index.mjs +2 -2
- package/src/commands/sites/sites-create-template.mjs +214 -236
- package/src/commands/sites/sites-create.mjs +145 -157
- package/src/commands/sites/sites-delete.mjs +75 -81
- package/src/commands/sites/sites-list.mjs +63 -66
- package/src/commands/sites/sites.mjs +18 -20
- package/src/commands/status/index.mjs +1 -1
- package/src/commands/status/status-hooks.mjs +32 -34
- package/src/commands/status/status.mjs +99 -106
- package/src/commands/switch/index.mjs +1 -1
- package/src/commands/switch/switch.mjs +32 -37
- package/src/commands/types.d.ts +31 -0
- package/src/commands/unlink/index.mjs +1 -1
- package/src/commands/unlink/unlink.mjs +23 -29
- package/src/commands/watch/index.mjs +1 -1
- package/src/commands/watch/watch.mjs +91 -105
- package/src/functions-templates/javascript/hello/{{name}}.js +2 -3
- package/src/lib/account.mjs +4 -5
- package/src/lib/api.mjs +22 -20
- package/src/lib/blobs/blobs.mjs +36 -45
- package/src/lib/build.mjs +82 -85
- package/src/lib/completion/constants.mjs +2 -4
- package/src/lib/completion/generate-autocompletion.mjs +33 -36
- package/src/lib/completion/get-autocompletion.mjs +31 -35
- package/src/lib/completion/index.mjs +1 -1
- package/src/lib/completion/script.mjs +12 -19
- package/src/lib/edge-functions/bootstrap.mjs +3 -5
- package/src/lib/edge-functions/consts.mjs +9 -10
- package/src/lib/edge-functions/deploy.mjs +28 -34
- package/src/lib/edge-functions/editor-helper.mjs +29 -42
- package/src/lib/edge-functions/headers.mjs +24 -26
- package/src/lib/edge-functions/internal.mjs +38 -44
- package/src/lib/edge-functions/proxy.mjs +229 -228
- package/src/lib/edge-functions/registry.mjs +473 -574
- package/src/lib/exec-fetcher.mjs +115 -122
- package/src/lib/fs.mjs +28 -27
- package/src/lib/functions/background.mjs +16 -20
- package/src/lib/functions/config.mjs +12 -9
- package/src/lib/functions/form-submissions-handler.mjs +143 -149
- package/src/lib/functions/local-proxy.mjs +40 -44
- package/src/lib/functions/memoized-build.mjs +19 -21
- package/src/lib/functions/netlify-function.mjs +269 -249
- package/src/lib/functions/registry.mjs +509 -568
- package/src/lib/functions/runtimes/go/index.mjs +62 -71
- package/src/lib/functions/runtimes/index.mjs +8 -15
- package/src/lib/functions/runtimes/js/builders/netlify-lambda.mjs +55 -64
- package/src/lib/functions/runtimes/js/builders/zisi.mjs +135 -154
- package/src/lib/functions/runtimes/js/constants.mjs +1 -1
- package/src/lib/functions/runtimes/js/index.mjs +92 -109
- package/src/lib/functions/runtimes/js/worker.mjs +43 -45
- package/src/lib/functions/runtimes/rust/index.mjs +64 -73
- package/src/lib/functions/scheduled.mjs +70 -88
- package/src/lib/functions/server.mjs +269 -327
- package/src/lib/functions/synchronous.mjs +118 -147
- package/src/lib/functions/utils.mjs +38 -46
- package/src/lib/geo-location.mjs +69 -81
- package/src/lib/http-agent.mjs +87 -90
- package/src/lib/images/proxy.mjs +97 -99
- package/src/lib/log.mjs +6 -9
- package/src/lib/path.mjs +2 -1
- package/src/lib/render-error-template.mjs +19 -20
- package/src/lib/settings.mjs +17 -19
- package/src/lib/spinner.mjs +21 -23
- package/src/lib/string.mjs +4 -2
- package/src/recipes/vscode/index.mjs +69 -85
- package/src/recipes/vscode/settings.mjs +53 -58
- package/src/utils/addons/compare.mjs +31 -32
- package/src/utils/addons/diffs/index.mjs +16 -17
- package/src/utils/addons/diffs/options.mjs +99 -101
- package/src/utils/addons/prepare.mjs +100 -97
- package/src/utils/addons/prompts.mjs +73 -76
- package/src/utils/addons/render.mjs +33 -36
- package/src/utils/addons/validation.mjs +19 -15
- package/src/utils/banner.mjs +11 -16
- package/src/utils/build-info.mjs +65 -66
- package/src/utils/command-helpers.mjs +185 -199
- package/src/utils/create-deferred.mjs +9 -12
- package/src/utils/create-stream-promise.mjs +54 -47
- package/src/utils/deploy/constants.mjs +9 -11
- package/src/utils/deploy/deploy-site.mjs +162 -182
- package/src/utils/deploy/hash-config.mjs +21 -21
- package/src/utils/deploy/hash-files.mjs +34 -38
- package/src/utils/deploy/hash-fns.mjs +149 -154
- package/src/utils/deploy/hasher-segments.mjs +58 -52
- package/src/utils/deploy/upload-files.mjs +99 -113
- package/src/utils/deploy/util.mjs +85 -91
- package/src/utils/detect-server-settings.mjs +236 -268
- package/src/utils/dev.mjs +163 -178
- package/src/utils/dot-env.mjs +37 -42
- package/src/utils/env/index.mjs +148 -148
- package/src/utils/execa.mjs +9 -13
- package/src/utils/feature-flags.mjs +6 -5
- package/src/utils/framework-server.mjs +43 -52
- package/src/utils/functions/constants.mjs +1 -1
- package/src/utils/functions/functions.mjs +30 -40
- package/src/utils/functions/get-functions.mjs +28 -29
- package/src/utils/functions/index.mjs +3 -3
- package/src/utils/get-global-config.mjs +33 -36
- package/src/utils/get-package-json.mjs +14 -15
- package/src/utils/get-repo-data.mjs +54 -64
- package/src/utils/get-site.mjs +14 -14
- package/src/utils/gh-auth.mjs +79 -100
- package/src/utils/gitignore.mjs +37 -40
- package/src/utils/headers.mjs +33 -35
- package/src/utils/hooks/requires-site-info.mjs +26 -22
- package/src/utils/init/config-github.mjs +207 -219
- package/src/utils/init/config-manual.mjs +83 -100
- package/src/utils/init/config.mjs +25 -26
- package/src/utils/init/node-version.mjs +23 -30
- package/src/utils/init/plugins.mjs +12 -8
- package/src/utils/init/utils.mjs +152 -172
- package/src/utils/live-tunnel.mjs +118 -141
- package/src/utils/lm/install.mjs +220 -259
- package/src/utils/lm/requirements.mjs +54 -63
- package/src/utils/lm/steps.mjs +31 -31
- package/src/utils/lm/ui.mjs +13 -20
- package/src/utils/open-browser.mjs +31 -32
- package/src/utils/parse-raw-flags.mjs +39 -35
- package/src/utils/proxy-server.mjs +84 -71
- package/src/utils/proxy.mjs +696 -750
- package/src/utils/read-repo-url.mjs +48 -47
- package/src/utils/redirects.mjs +49 -49
- package/src/utils/request-id.mjs +2 -4
- package/src/utils/rules-proxy.mjs +96 -100
- package/src/utils/run-build.mjs +109 -132
- package/src/utils/shell.mjs +99 -106
- package/src/utils/sign-redirect.mjs +14 -14
- package/src/utils/sites/utils.mjs +48 -55
- package/src/utils/state-config.mjs +101 -101
- package/src/utils/static-server.mjs +28 -34
- package/src/utils/telemetry/index.mjs +2 -2
- package/src/utils/telemetry/report-error.mjs +45 -49
- package/src/utils/telemetry/request.mjs +36 -43
- package/src/utils/telemetry/telemetry.mjs +90 -105
- package/src/utils/telemetry/utils.mjs +5 -6
- package/src/utils/telemetry/validation.mjs +55 -53
- package/src/utils/types.d.ts +46 -0
- package/src/utils/validation.mjs +10 -13
|
@@ -1,40 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
checkGitLFSVersionStep,
|
|
6
|
-
checkGitVersionStep,
|
|
7
|
-
checkHelperVersionStep,
|
|
8
|
-
checkLFSFiltersStep,
|
|
9
|
-
} from '../../utils/lm/steps.mjs'
|
|
10
|
-
|
|
1
|
+
import { Listr } from 'listr2';
|
|
2
|
+
import { checkGitLFSVersionStep, checkGitVersionStep, checkHelperVersionStep, checkLFSFiltersStep, } from '../../utils/lm/steps.mjs';
|
|
11
3
|
/**
|
|
12
4
|
* The lm:info command
|
|
13
5
|
*/
|
|
14
6
|
const lmInfo = async () => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
7
|
+
const steps = [
|
|
8
|
+
checkGitVersionStep,
|
|
9
|
+
checkGitLFSVersionStep,
|
|
10
|
+
// @ts-expect-error TS(7006) FIXME: Parameter 'ctx' implicitly has an 'any' type.
|
|
11
|
+
checkLFSFiltersStep((ctx, task, installed) => {
|
|
12
|
+
if (!installed) {
|
|
13
|
+
throw new Error('Git LFS filters are not installed, run `git lfs install` to install them');
|
|
14
|
+
}
|
|
15
|
+
}),
|
|
16
|
+
checkHelperVersionStep,
|
|
17
|
+
];
|
|
18
|
+
const tasks = new Listr(steps, { concurrent: true, exitOnError: false });
|
|
19
|
+
try {
|
|
20
|
+
await tasks.run();
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
// an error is already reported when a task fails
|
|
24
|
+
}
|
|
25
|
+
};
|
|
34
26
|
/**
|
|
35
27
|
* Creates the `netlify lm:info` command
|
|
36
28
|
* @param {import('../base-command.mjs').default} program
|
|
37
29
|
* @returns
|
|
38
30
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
32
|
+
export const createLmInfoCommand = (program) => program.command('lm:info', { hidden: true }).description('Show large media requirements information.').action(lmInfo);
|
|
@@ -1,31 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { printBanner } from '../../utils/lm/ui.mjs'
|
|
4
|
-
|
|
1
|
+
import { installPlatform } from '../../utils/lm/install.mjs';
|
|
2
|
+
import { printBanner } from '../../utils/lm/ui.mjs';
|
|
5
3
|
/**
|
|
6
4
|
* The lm:install command
|
|
7
5
|
* @param {import('commander').OptionValues} options
|
|
8
6
|
*/
|
|
7
|
+
// @ts-expect-error TS(7031) FIXME: Binding element 'force' implicitly has an 'any' ty... Remove this comment to see the full error message
|
|
9
8
|
const lmInstall = async ({ force }) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
9
|
+
const installed = await installPlatform({ force });
|
|
10
|
+
if (installed) {
|
|
11
|
+
printBanner(force);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
16
14
|
/**
|
|
17
15
|
* Creates the `netlify lm:install` command
|
|
18
16
|
* @param {import('../base-command.mjs').default} program
|
|
19
17
|
* @returns
|
|
20
18
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
20
|
+
export const createLmInstallCommand = (program) => program
|
|
23
21
|
.command('lm:install', { hidden: true })
|
|
24
22
|
.alias('lm:init')
|
|
25
|
-
.description(
|
|
26
|
-
`Configures your computer to use Netlify Large Media
|
|
23
|
+
.description(`Configures your computer to use Netlify Large Media
|
|
27
24
|
It installs the required credentials helper for Git,
|
|
28
|
-
and configures your Git environment with the right credentials
|
|
29
|
-
)
|
|
25
|
+
and configures your Git environment with the right credentials.`)
|
|
30
26
|
.option('-f, --force', 'Force the credentials helper installation')
|
|
31
|
-
.action(lmInstall)
|
|
27
|
+
.action(lmInstall);
|
|
@@ -1,105 +1,101 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { Listr } from 'listr2';
|
|
2
|
+
import { error } from '../../utils/command-helpers.mjs';
|
|
3
|
+
// @ts-expect-error TS(7034) FIXME: Variable 'execa' implicitly has type 'any' in some... Remove this comment to see the full error message
|
|
4
|
+
import execa from '../../utils/execa.mjs';
|
|
5
|
+
import { installPlatform } from '../../utils/lm/install.mjs';
|
|
6
|
+
import { checkHelperVersion } from '../../utils/lm/requirements.mjs';
|
|
7
|
+
import { printBanner } from '../../utils/lm/ui.mjs';
|
|
8
|
+
// @ts-expect-error TS(7031) FIXME: Binding element 'force' implicitly has an 'any' ty... Remove this comment to see the full error message
|
|
10
9
|
const installHelperIfMissing = async function ({ force }) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
let installHelper = false;
|
|
11
|
+
try {
|
|
12
|
+
const version = await checkHelperVersion();
|
|
13
|
+
if (!version) {
|
|
14
|
+
installHelper = true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
installHelper = true;
|
|
19
|
+
}
|
|
20
|
+
if (installHelper) {
|
|
21
|
+
return installPlatform({ force });
|
|
16
22
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (installHelper) {
|
|
22
|
-
return installPlatform({ force })
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return false
|
|
26
|
-
}
|
|
27
|
-
|
|
23
|
+
return false;
|
|
24
|
+
};
|
|
25
|
+
// @ts-expect-error TS(7006) FIXME: Parameter 'siteId' implicitly has an 'any' type.
|
|
28
26
|
const provisionService = async function (siteId, api) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
27
|
+
const addonName = 'large-media';
|
|
28
|
+
if (!siteId) {
|
|
29
|
+
throw new Error('No site id found, please run inside a site folder or `netlify link`');
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
await api.createServiceInstance({
|
|
33
|
+
siteId,
|
|
34
|
+
addon: addonName,
|
|
35
|
+
body: {},
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (error_) {
|
|
39
|
+
// error is JSONHTTPError
|
|
40
|
+
// @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
|
|
41
|
+
throw new Error(error_.json.error);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
// @ts-expect-error TS(7006) FIXME: Parameter 'siteId' implicitly has an 'any' type.
|
|
46
45
|
const configureLFSURL = async function (siteId, api) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
46
|
+
const siteInfo = await api.getSite({ siteId });
|
|
47
|
+
const url = `https://${siteInfo.id_domain}/.netlify/large-media`;
|
|
48
|
+
// @ts-expect-error TS(7005) FIXME: Variable 'execa' implicitly has an 'any' type.
|
|
49
|
+
return execa('git', ['config', '-f', '.lfsconfig', 'lfs.url', url]);
|
|
50
|
+
};
|
|
53
51
|
/**
|
|
54
52
|
* The lm:setup command
|
|
55
53
|
* @param {import('commander').OptionValues} options
|
|
56
54
|
* @param {import('../base-command.mjs').default} command
|
|
57
55
|
*/
|
|
56
|
+
// @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
|
|
58
57
|
const lmSetup = async (options, command) => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
58
|
+
await command.authenticate();
|
|
59
|
+
const { api, site } = command.netlify;
|
|
60
|
+
let helperInstalled = false;
|
|
61
|
+
if (!options.skipInstall) {
|
|
62
|
+
try {
|
|
63
|
+
helperInstalled = await installHelperIfMissing({ force: options.forceInstall });
|
|
64
|
+
}
|
|
65
|
+
catch (error_) {
|
|
66
|
+
// @ts-expect-error TS(2345) FIXME: Argument of type 'unknown' is not assignable to pa... Remove this comment to see the full error message
|
|
67
|
+
error(error_);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const tasks = new Listr([
|
|
71
|
+
{
|
|
72
|
+
title: 'Provisioning Netlify Large Media',
|
|
73
|
+
async task() {
|
|
74
|
+
await provisionService(site.id, api);
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
title: 'Configuring Git LFS for this site',
|
|
79
|
+
async task() {
|
|
80
|
+
await configureLFSURL(site.id, api);
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
]);
|
|
84
|
+
await tasks.run().catch(() => { });
|
|
85
|
+
if (helperInstalled) {
|
|
86
|
+
printBanner(options.forceInstall);
|
|
69
87
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const tasks = new Listr([
|
|
73
|
-
{
|
|
74
|
-
title: 'Provisioning Netlify Large Media',
|
|
75
|
-
async task() {
|
|
76
|
-
await provisionService(site.id, api)
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
title: 'Configuring Git LFS for this site',
|
|
81
|
-
async task() {
|
|
82
|
-
await configureLFSURL(site.id, api)
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
])
|
|
86
|
-
await tasks.run().catch(() => {})
|
|
87
|
-
|
|
88
|
-
if (helperInstalled) {
|
|
89
|
-
printBanner(options.forceInstall)
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
88
|
+
};
|
|
93
89
|
/**
|
|
94
90
|
* Creates the `netlify lm:setup` command
|
|
95
91
|
* @param {import('../base-command.mjs').default} program
|
|
96
92
|
* @returns
|
|
97
93
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
95
|
+
export const createLmSetupCommand = (program) => program
|
|
100
96
|
.command('lm:setup', { hidden: true })
|
|
101
97
|
.description('Configures your site to use Netlify Large Media')
|
|
102
98
|
.option('-s, --skip-install', 'Skip the credentials helper installation check')
|
|
103
99
|
.option('-f, --force-install', 'Force the credentials helper installation')
|
|
104
100
|
.addHelpText('after', 'It runs the install command if you have not installed the dependencies yet.')
|
|
105
|
-
.action(lmSetup)
|
|
101
|
+
.action(lmSetup);
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
import { uninstall } from '../../utils/lm/install.mjs'
|
|
3
|
-
|
|
1
|
+
import { uninstall } from '../../utils/lm/install.mjs';
|
|
4
2
|
/**
|
|
5
3
|
* The lm:uninstall command
|
|
6
4
|
*/
|
|
7
5
|
const lmUninstall = async () => {
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
6
|
+
await uninstall();
|
|
7
|
+
};
|
|
11
8
|
/**
|
|
12
9
|
* Creates the `netlify lm:uninstall` command
|
|
13
10
|
* @param {import('../base-command.mjs').default} program
|
|
14
11
|
* @returns
|
|
15
12
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
14
|
+
export const createLmUninstallCommand = (program) => program
|
|
18
15
|
.command('lm:uninstall', { hidden: true })
|
|
19
16
|
.alias('lm:remove')
|
|
20
|
-
.description(
|
|
21
|
-
|
|
22
|
-
)
|
|
23
|
-
.action(lmUninstall)
|
|
17
|
+
.description('Uninstalls Netlify git credentials helper and cleans up any related configuration changes made by the install command.')
|
|
18
|
+
.action(lmUninstall);
|
package/src/commands/lm/lm.mjs
CHANGED
|
@@ -1,34 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { createLmUninstallCommand } from './lm-uninstall.mjs'
|
|
6
|
-
|
|
1
|
+
import { createLmInfoCommand } from './lm-info.mjs';
|
|
2
|
+
import { createLmInstallCommand } from './lm-install.mjs';
|
|
3
|
+
import { createLmSetupCommand } from './lm-setup.mjs';
|
|
4
|
+
import { createLmUninstallCommand } from './lm-uninstall.mjs';
|
|
7
5
|
/**
|
|
8
6
|
* The lm command
|
|
9
7
|
* @param {import('commander').OptionValues} options
|
|
10
8
|
* @param {import('../base-command.mjs').default} command
|
|
11
9
|
*/
|
|
10
|
+
// @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
|
|
12
11
|
const lm = (options, command) => {
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
12
|
+
command.help();
|
|
13
|
+
};
|
|
16
14
|
/**
|
|
17
15
|
* Creates the `netlify lm` command
|
|
18
16
|
* @param {import('../base-command.mjs').default} program
|
|
19
17
|
* @returns
|
|
20
18
|
*/
|
|
19
|
+
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
21
20
|
export const createLmCommand = (program) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.addExamples(['netlify lm:info', 'netlify lm:install', 'netlify lm:setup'])
|
|
33
|
-
.action(lm)
|
|
34
|
-
}
|
|
21
|
+
createLmInfoCommand(program);
|
|
22
|
+
createLmInstallCommand(program);
|
|
23
|
+
createLmSetupCommand(program);
|
|
24
|
+
createLmUninstallCommand(program);
|
|
25
|
+
program
|
|
26
|
+
.command('lm', { hidden: true })
|
|
27
|
+
.description('[Deprecated and will be removed from future versions] Handle Netlify Large Media operations\nThe lm command will help you manage large media for a site')
|
|
28
|
+
.addExamples(['netlify lm:info', 'netlify lm:install', 'netlify lm:setup'])
|
|
29
|
+
.action(lm);
|
|
30
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createLoginCommand, login } from './login.mjs'
|
|
1
|
+
export { createLoginCommand, login } from './login.mjs';
|
|
@@ -1,55 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { chalk, exit, getToken, log } from '../../utils/command-helpers.mjs';
|
|
2
|
+
// @ts-expect-error TS(7006) FIXME: Parameter 'location' implicitly has an 'any' type.
|
|
4
3
|
const msg = function (location) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
4
|
+
switch (location) {
|
|
5
|
+
case 'env':
|
|
6
|
+
return 'via process.env.NETLIFY_AUTH_TOKEN set in your terminal session';
|
|
7
|
+
case 'flag':
|
|
8
|
+
return 'via CLI --auth flag';
|
|
9
|
+
case 'config':
|
|
10
|
+
return 'via netlify config on your machine';
|
|
11
|
+
default:
|
|
12
|
+
return '';
|
|
13
|
+
}
|
|
14
|
+
};
|
|
17
15
|
/**
|
|
18
16
|
* The login command
|
|
19
17
|
* @param {import('commander').OptionValues} options
|
|
20
18
|
* @param {import('../base-command.mjs').default} command
|
|
21
19
|
*/
|
|
20
|
+
// @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
|
|
22
21
|
export const login = async (options, command) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
await command.expensivelyAuthenticate()
|
|
40
|
-
}
|
|
41
|
-
|
|
22
|
+
// @ts-expect-error TS(2554) FIXME: Expected 1 arguments, but got 0.
|
|
23
|
+
const [accessToken, location] = await getToken();
|
|
24
|
+
command.setAnalyticsPayload({ new: options.new });
|
|
25
|
+
if (accessToken && !options.new) {
|
|
26
|
+
log(`Already logged in ${msg(location)}`);
|
|
27
|
+
log();
|
|
28
|
+
log(`Run ${chalk.cyanBright('netlify status')} for account details`);
|
|
29
|
+
log();
|
|
30
|
+
log(`or run ${chalk.cyanBright('netlify switch')} to switch accounts`);
|
|
31
|
+
log();
|
|
32
|
+
log(`To see all available commands run: ${chalk.cyanBright('netlify help')}`);
|
|
33
|
+
log();
|
|
34
|
+
return exit();
|
|
35
|
+
}
|
|
36
|
+
await command.expensivelyAuthenticate();
|
|
37
|
+
};
|
|
42
38
|
/**
|
|
43
39
|
* Creates the `netlify login` command
|
|
44
40
|
* @param {import('../base-command.mjs').default} program
|
|
45
41
|
* @returns
|
|
46
42
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
44
|
+
export const createLoginCommand = (program) => program
|
|
49
45
|
.command('login')
|
|
50
|
-
.description(
|
|
51
|
-
|
|
52
|
-
Opens a web browser to acquire an OAuth token.`,
|
|
53
|
-
)
|
|
46
|
+
.description(`Login to your Netlify account
|
|
47
|
+
Opens a web browser to acquire an OAuth token.`)
|
|
54
48
|
.option('--new', 'Login to new Netlify account')
|
|
55
|
-
.action(login)
|
|
49
|
+
.action(login);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createLogoutCommand } from './logout.mjs'
|
|
1
|
+
export { createLogoutCommand } from './logout.mjs';
|
|
@@ -1,42 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { track } from '../../utils/telemetry/index.mjs'
|
|
4
|
-
|
|
1
|
+
import { exit, getToken, log } from '../../utils/command-helpers.mjs';
|
|
2
|
+
import { track } from '../../utils/telemetry/index.mjs';
|
|
5
3
|
/**
|
|
6
4
|
* The logout command
|
|
7
5
|
* @param {import('commander').OptionValues} options
|
|
8
6
|
* @param {import('../base-command.mjs').default} command
|
|
9
7
|
*/
|
|
8
|
+
// @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
|
|
10
9
|
const logout = async (options, command) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
log()
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
log(`Logging you out of Netlify. Come back soon!`)
|
|
34
|
-
}
|
|
35
|
-
|
|
10
|
+
// @ts-expect-error TS(2554) FIXME: Expected 1 arguments, but got 0.
|
|
11
|
+
const [accessToken, location] = await getToken();
|
|
12
|
+
if (!accessToken) {
|
|
13
|
+
log(`Already logged out`);
|
|
14
|
+
log();
|
|
15
|
+
log('To login run "netlify login"');
|
|
16
|
+
exit();
|
|
17
|
+
}
|
|
18
|
+
await track('user_logout');
|
|
19
|
+
// unset userID without deleting key
|
|
20
|
+
command.netlify.globalConfig.set('userId', null);
|
|
21
|
+
if (location === 'env') {
|
|
22
|
+
log('The "process.env.NETLIFY_AUTH_TOKEN" is still set in your terminal session');
|
|
23
|
+
log();
|
|
24
|
+
log('To logout completely, unset the environment variable');
|
|
25
|
+
log();
|
|
26
|
+
exit();
|
|
27
|
+
}
|
|
28
|
+
log(`Logging you out of Netlify. Come back soon!`);
|
|
29
|
+
};
|
|
36
30
|
/**
|
|
37
31
|
* Creates the `netlify logout` command
|
|
38
32
|
* @param {import('../base-command.mjs').default} program
|
|
39
33
|
* @returns
|
|
40
34
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
// @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
|
|
36
|
+
export const createLogoutCommand = (program) => program.command('logout', { hidden: true }).description('Logout of your Netlify account').action(logout);
|