netlify-cli 17.37.2 → 17.38.1
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.js +4 -2
- package/dist/commands/addons/addons.d.ts.map +1 -1
- package/dist/commands/addons/addons.js +0 -1
- package/dist/commands/base-command.d.ts.map +1 -1
- package/dist/commands/base-command.js +2 -1
- package/dist/commands/blobs/blobs-delete.d.ts.map +1 -1
- package/dist/commands/blobs/blobs-delete.js +7 -1
- package/dist/commands/blobs/blobs-set.d.ts +1 -0
- package/dist/commands/blobs/blobs-set.d.ts.map +1 -1
- package/dist/commands/blobs/blobs-set.js +10 -2
- package/dist/commands/deploy/deploy.js +2 -2
- package/dist/commands/deploy/index.d.ts.map +1 -1
- package/dist/commands/deploy/index.js +4 -3
- package/dist/commands/env/env-clone.d.ts.map +1 -1
- package/dist/commands/env/env-clone.js +12 -3
- package/dist/commands/env/env-set.d.ts.map +1 -1
- package/dist/commands/env/env-set.js +8 -3
- package/dist/commands/env/env-unset.d.ts.map +1 -1
- package/dist/commands/env/env-unset.js +7 -3
- package/dist/commands/init/index.d.ts.map +1 -1
- package/dist/commands/init/index.js +0 -1
- package/dist/commands/integration/deploy.d.ts.map +1 -1
- package/dist/commands/integration/deploy.js +11 -20
- package/dist/commands/main.d.ts +34 -0
- package/dist/commands/main.d.ts.map +1 -1
- package/dist/commands/main.js +36 -6
- package/dist/commands/sites/sites-create-template.d.ts +2 -3
- package/dist/commands/sites/sites-create-template.d.ts.map +1 -1
- package/dist/commands/sites/sites-create-template.js +113 -92
- package/dist/commands/sites/sites-create.d.ts.map +1 -1
- package/dist/commands/sites/sites.d.ts.map +1 -1
- package/dist/commands/sites/sites.js +0 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/command-helpers.d.ts +16 -0
- package/dist/utils/command-helpers.d.ts.map +1 -1
- package/dist/utils/command-helpers.js +7 -0
- package/dist/utils/framework-server.d.ts.map +1 -1
- package/dist/utils/framework-server.js +2 -2
- package/dist/utils/gh-auth.js +1 -1
- package/dist/utils/headers.js +1 -1
- package/dist/utils/prompts/blob-delete-prompts.d.ts +2 -0
- package/dist/utils/prompts/blob-delete-prompts.d.ts.map +1 -0
- package/dist/utils/prompts/blob-delete-prompts.js +11 -0
- package/dist/utils/prompts/blob-set-prompt.d.ts +2 -0
- package/dist/utils/prompts/blob-set-prompt.d.ts.map +1 -0
- package/dist/utils/prompts/blob-set-prompt.js +11 -0
- package/dist/utils/prompts/confirm-prompt.d.ts +2 -0
- package/dist/utils/prompts/confirm-prompt.d.ts.map +1 -0
- package/dist/utils/prompts/confirm-prompt.js +20 -0
- package/dist/utils/prompts/env-clone-prompt.d.ts +11 -0
- package/dist/utils/prompts/env-clone-prompt.d.ts.map +1 -0
- package/dist/utils/prompts/env-clone-prompt.js +27 -0
- package/dist/utils/prompts/env-set-prompts.d.ts +2 -0
- package/dist/utils/prompts/env-set-prompts.d.ts.map +1 -0
- package/dist/utils/prompts/env-set-prompts.js +11 -0
- package/dist/utils/prompts/env-unset-prompts.d.ts +8 -0
- package/dist/utils/prompts/env-unset-prompts.d.ts.map +1 -0
- package/dist/utils/prompts/env-unset-prompts.js +17 -0
- package/dist/utils/prompts/prompt-messages.d.ts +25 -0
- package/dist/utils/prompts/prompt-messages.d.ts.map +1 -0
- package/dist/utils/prompts/prompt-messages.js +25 -0
- package/dist/utils/redirects.js +1 -1
- package/dist/utils/run-build.d.ts +2 -0
- package/dist/utils/run-build.d.ts.map +1 -1
- package/dist/utils/run-program.d.ts +3 -0
- package/dist/utils/run-program.d.ts.map +1 -0
- package/dist/utils/run-program.js +12 -0
- package/dist/utils/scripted-commands.d.ts +3 -0
- package/dist/utils/scripted-commands.d.ts.map +1 -0
- package/dist/utils/scripted-commands.js +17 -0
- package/dist/utils/sites/create-template.d.ts +14 -0
- package/dist/utils/sites/create-template.d.ts.map +1 -0
- package/dist/utils/sites/create-template.js +46 -0
- package/dist/utils/sites/utils.d.ts +8 -6
- package/dist/utils/sites/utils.d.ts.map +1 -1
- package/dist/utils/sites/utils.js +10 -4
- package/dist/utils/static-server.d.ts +3 -1
- package/dist/utils/static-server.d.ts.map +1 -1
- package/dist/utils/static-server.js +2 -0
- package/dist/utils/types.d.ts +14 -1
- package/dist/utils/types.d.ts.map +1 -1
- package/functions-templates/javascript/hello-world/{{name}}.mjs +13 -0
- package/functions-templates/javascript/scheduled-function/{{name}}.mjs +11 -0
- package/functions-templates/rust/hello-world/Cargo.toml +1 -1
- package/functions-templates/typescript/hello-world/package-lock.json +15 -15
- package/functions-templates/typescript/hello-world/package.json +1 -1
- package/functions-templates/typescript/hello-world/{{name}}.mts +14 -0
- package/functions-templates/typescript/scheduled-function/package.json +1 -1
- package/functions-templates/typescript/scheduled-function/{{name}}.mts +11 -0
- package/npm-shrinkwrap.json +849 -626
- package/package.json +14 -14
- package/functions-templates/javascript/hello-world/{{name}}.js +0 -17
- package/functions-templates/javascript/identity-signup/.netlify-function-template.mjs +0 -5
- package/functions-templates/javascript/identity-signup/{{name}}.js +0 -29
- package/functions-templates/javascript/sanity-create/.netlify-function-template.mjs +0 -5
- package/functions-templates/javascript/sanity-create/package.json +0 -20
- package/functions-templates/javascript/sanity-create/{{name}}.js +0 -72
- package/functions-templates/javascript/sanity-groq/.netlify-function-template.mjs +0 -5
- package/functions-templates/javascript/sanity-groq/package.json +0 -21
- package/functions-templates/javascript/sanity-groq/{{name}}.js +0 -56
- package/functions-templates/javascript/scheduled-function/{{name}}.js +0 -12
- package/functions-templates/javascript/submission-created/.netlify-function-template.mjs +0 -5
- package/functions-templates/javascript/submission-created/package.json +0 -19
- package/functions-templates/javascript/submission-created/{{name}}.js +0 -29
- package/functions-templates/typescript/hello-world/{{name}}.ts +0 -12
- package/functions-templates/typescript/scheduled-function/{{name}}.ts +0 -12
package/bin/run.js
CHANGED
|
@@ -3,9 +3,10 @@ import { argv } from 'process'
|
|
|
3
3
|
|
|
4
4
|
import updateNotifier from 'update-notifier'
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { runProgram } from '../dist/utils/run-program.js'
|
|
7
7
|
import { error } from '../dist/utils/command-helpers.js'
|
|
8
8
|
import getPackageJson from '../dist/utils/get-package-json.js'
|
|
9
|
+
import { createMainCommand } from '../dist/commands/main.js'
|
|
9
10
|
|
|
10
11
|
// 12 hours
|
|
11
12
|
const UPDATE_CHECK_INTERVAL = 432e5
|
|
@@ -24,7 +25,8 @@ try {
|
|
|
24
25
|
const program = createMainCommand()
|
|
25
26
|
|
|
26
27
|
try {
|
|
27
|
-
await program
|
|
28
|
+
await runProgram(program, argv)
|
|
29
|
+
|
|
28
30
|
program.onEnd()
|
|
29
31
|
} catch (error_) {
|
|
30
32
|
program.onEnd(error_)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addons.d.ts","sourceRoot":"","sources":["../../../src/commands/addons/addons.ts"],"names":[],"mappings":"AAEA,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAM5C,eAAO,MAAM,mBAAmB,YAAa,WAAW,
|
|
1
|
+
{"version":3,"file":"addons.d.ts","sourceRoot":"","sources":["../../../src/commands/addons/addons.ts"],"names":[],"mappings":"AAEA,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAM5C,eAAO,MAAM,mBAAmB,YAAa,WAAW,gBAwEvD,CAAA"}
|
|
@@ -39,7 +39,6 @@ Add-ons are a way to extend the functionality of your Netlify site`)
|
|
|
39
39
|
.alias('addon:delete')
|
|
40
40
|
.argument('<name>', 'Add-on namespace')
|
|
41
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
42
|
.action(async (addonName, options, command) => {
|
|
44
43
|
const { addonsDelete } = await import('./addons-delete.js');
|
|
45
44
|
await addonsDelete(addonName, options, command);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-command.d.ts","sourceRoot":"","sources":["../../src/commands/base-command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base-command.d.ts","sourceRoot":"","sources":["../../src/commands/base-command.ts"],"names":[],"mappings":"AAKA,OAAO,EAAiB,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAU,MAAM,WAAW,CAAA;AA0BjD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAQxD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD,KAAK,SAAS,GAAG;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC,CAAA;AAuGD,0EAA0E;AAC1E,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,OAAO;;IAC9C,4DAA4D;IAE5D,OAAO,EAAE,cAAc,CAAA;IACvB,SAAS,EAAE,SAAS,CAAyC;IAE7D,OAAO,EAAE,OAAO,CAAA;IAEhB;;;;OAIG;IAGH,UAAU,SAAgB;IAE1B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAEzB,YAAY,EAAE,YAAY,CAAK;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW;IAsDxC,mIAAmI;IACnI,aAAa;IAKb,mFAAmF;IACnF,QAAQ,EAAE,MAAM,EAAE,CAAK;IACvB,oCAAoC;IACpC,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE;IAK9B,iEAAiE;IACjE,UAAU,IAAI,IAAI;IAgIlB,kEAAkE;IAC5D,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO;IAwBtB,YAAY,CAAC,aAAa,CAAC,EAAE,MAAM;IAQnC,uBAAuB;IA4D7B,8CAA8C;IAC9C,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAOpD;;OAEG;YACW,IAAI;IAkMlB,iDAAiD;IAC3C,SAAS,CAAC,MAAM,EAAE;QACtB,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACrB,OAAO,CAAC,EAAE,OAAO,CAAA;QACjB,2EAA2E;QAC3E,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC;IAgDpC;;OAEG;IACH,gBAAgB,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;IAI5C;;;;OAIG;IACH,iBAAiB,IAAI,YAAY,GAAG,KAAK;IAIzC;;OAEG;IACH,cAAc,CAAC,CAAC,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC;CAGjE"}
|
|
@@ -10,7 +10,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _BaseCommand_noBaseOptions;
|
|
13
|
-
import { isCI } from 'ci-info';
|
|
14
13
|
import { existsSync } from 'fs';
|
|
15
14
|
import { join, relative, resolve } from 'path';
|
|
16
15
|
import process from 'process';
|
|
@@ -18,6 +17,7 @@ import { format } from 'util';
|
|
|
18
17
|
import { DefaultLogger, Project } from '@netlify/build-info';
|
|
19
18
|
import { NodeFS, NoopLogger } from '@netlify/build-info/node';
|
|
20
19
|
import { resolveConfig } from '@netlify/config';
|
|
20
|
+
import { isCI } from 'ci-info';
|
|
21
21
|
import { Command, Option } from 'commander';
|
|
22
22
|
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'debu... Remove this comment to see the full error message
|
|
23
23
|
import debug from 'debug';
|
|
@@ -140,6 +140,7 @@ class BaseCommand extends Command {
|
|
|
140
140
|
createCommand(name) {
|
|
141
141
|
const base = new BaseCommand(name)
|
|
142
142
|
// If --silent or --json flag passed disable logger
|
|
143
|
+
// .addOption(new Option('--force', 'Force command to run. Bypasses prompts for certain destructive commands.'))
|
|
143
144
|
.addOption(new Option('--json', 'Output return values as JSON').hideHelp(true))
|
|
144
145
|
.addOption(new Option('--silent', 'Silence CLI output').hideHelp(true))
|
|
145
146
|
.addOption(new Option('--cwd <cwd>').hideHelp(true))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blobs-delete.d.ts","sourceRoot":"","sources":["../../../src/commands/blobs/blobs-delete.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"blobs-delete.d.ts","sourceRoot":"","sources":["../../../src/commands/blobs/blobs-delete.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,WAAW,cAAqB,MAAM,OAAO,MAAM,YAAY,OAAO,MAAM,EAAE,OAAO,CAAC,WAAW,GAAG,kBAsBhH,CAAA"}
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { getStore } from '@netlify/blobs';
|
|
2
|
-
import { chalk, error as printError } from '../../utils/command-helpers.js';
|
|
2
|
+
import { chalk, error as printError, log } from '../../utils/command-helpers.js';
|
|
3
|
+
import { promptBlobDelete } from '../../utils/prompts/blob-delete-prompts.js';
|
|
3
4
|
/**
|
|
4
5
|
* The blobs:delete command
|
|
5
6
|
*/
|
|
6
7
|
export const blobsDelete = async (storeName, key, _options, command) => {
|
|
7
8
|
const { api, siteInfo } = command.netlify;
|
|
9
|
+
const { force } = _options;
|
|
8
10
|
const store = getStore({
|
|
9
11
|
apiURL: `${api.scheme}://${api.host}`,
|
|
10
12
|
name: storeName,
|
|
11
13
|
siteID: siteInfo.id ?? '',
|
|
12
14
|
token: api.accessToken ?? '',
|
|
13
15
|
});
|
|
16
|
+
if (force === undefined) {
|
|
17
|
+
await promptBlobDelete(key, storeName);
|
|
18
|
+
}
|
|
14
19
|
try {
|
|
15
20
|
await store.delete(key);
|
|
21
|
+
log(`${chalk.greenBright('Success')}: Blob ${chalk.yellow(key)} deleted from store ${chalk.yellow(storeName)}`);
|
|
16
22
|
}
|
|
17
23
|
catch {
|
|
18
24
|
return printError(`Could not delete blob ${chalk.yellow(key)} from store ${chalk.yellow(storeName)}`);
|
|
@@ -2,6 +2,7 @@ import { OptionValues } from 'commander';
|
|
|
2
2
|
import BaseCommand from '../base-command.js';
|
|
3
3
|
interface Options extends OptionValues {
|
|
4
4
|
input?: string;
|
|
5
|
+
force?: string | boolean;
|
|
5
6
|
}
|
|
6
7
|
export declare const blobsSet: (storeName: string, key: string, valueParts: string[], options: Options, command: BaseCommand) => Promise<void>;
|
|
7
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blobs-set.d.ts","sourceRoot":"","sources":["../../../src/commands/blobs/blobs-set.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"blobs-set.d.ts","sourceRoot":"","sources":["../../../src/commands/blobs/blobs-set.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAIxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAE5C,UAAU,OAAQ,SAAQ,YAAY;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACzB;AAED,eAAO,MAAM,QAAQ,cACR,MAAM,OACZ,MAAM,cACC,MAAM,EAAE,WACX,OAAO,WACP,WAAW,kBAqDrB,CAAA"}
|
|
@@ -1,10 +1,11 @@
|
|
|
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.js';
|
|
4
|
+
import { chalk, error as printError, isNodeError, log } from '../../utils/command-helpers.js';
|
|
5
|
+
import { promptBlobSetOverwrite } from '../../utils/prompts/blob-set-prompt.js';
|
|
5
6
|
export const blobsSet = async (storeName, key, valueParts, options, command) => {
|
|
6
7
|
const { api, siteInfo } = command.netlify;
|
|
7
|
-
const { input } = options;
|
|
8
|
+
const { force, input } = options;
|
|
8
9
|
const store = getStore({
|
|
9
10
|
apiURL: `${api.scheme}://${api.host}`,
|
|
10
11
|
name: storeName,
|
|
@@ -30,8 +31,15 @@ export const blobsSet = async (storeName, key, valueParts, options, command) =>
|
|
|
30
31
|
else if (!value) {
|
|
31
32
|
return printError(`You must provide a value as a command-line parameter (e.g. 'netlify blobs:set my-store my-key my value') or specify the path to a file from where the value should be read (e.g. 'netlify blobs:set my-store my-key --input ./my-file.txt')`);
|
|
32
33
|
}
|
|
34
|
+
if (force === undefined) {
|
|
35
|
+
const existingValue = await store.get(key);
|
|
36
|
+
if (existingValue) {
|
|
37
|
+
await promptBlobSetOverwrite(key, storeName);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
33
40
|
try {
|
|
34
41
|
await store.set(key, value);
|
|
42
|
+
log(`${chalk.greenBright('Success')}: Blob ${chalk.yellow(key)} set in store ${chalk.yellow(storeName)}`);
|
|
35
43
|
}
|
|
36
44
|
catch {
|
|
37
45
|
return printError(`Could not set blob ${chalk.yellow(key)} in store ${chalk.yellow(storeName)}`);
|
|
@@ -4,8 +4,8 @@ import { runCoreSteps } from '@netlify/build';
|
|
|
4
4
|
import inquirer from 'inquirer';
|
|
5
5
|
import isEmpty from 'lodash/isEmpty.js';
|
|
6
6
|
import isObject from 'lodash/isObject.js';
|
|
7
|
-
import { parseAllHeaders } from 'netlify
|
|
8
|
-
import { parseAllRedirects } from 'netlify
|
|
7
|
+
import { parseAllHeaders } from '@netlify/headers-parser';
|
|
8
|
+
import { parseAllRedirects } from '@netlify/redirect-parser';
|
|
9
9
|
import prettyjson from 'prettyjson';
|
|
10
10
|
import { cancelDeploy } from '../../lib/api.js';
|
|
11
11
|
import { getBuildOptions, runBuild } from '../../lib/build.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/deploy/index.ts"],"names":[],"mappings":"AAIA,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAE5C,eAAO,MAAM,mBAAmB,YAAa,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/deploy/index.ts"],"names":[],"mappings":"AAIA,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAE5C,eAAO,MAAM,mBAAmB,YAAa,WAAW,gBAgIlD,CAAA"}
|
|
@@ -72,10 +72,11 @@ functions/
|
|
|
72
72
|
Support for package.json's main field, and intrinsic index.js entrypoints are coming soon.`)
|
|
73
73
|
.option('-d, --dir <path>', 'Specify a folder to deploy')
|
|
74
74
|
.option('-f, --functions <folder>', 'Specify a functions folder to deploy')
|
|
75
|
-
.
|
|
75
|
+
.addOption(new Option('-p, --prod', 'Deploy to production').default(false).conflicts(['alias', 'branch', 'prodIfUnlocked']))
|
|
76
76
|
.addOption(new Option('--prodIfUnlocked', 'Old, prefer --prod-if-unlocked. Deploy to production if unlocked, create a draft otherwise')
|
|
77
77
|
.default(false)
|
|
78
|
-
.hideHelp(true)
|
|
78
|
+
.hideHelp(true)
|
|
79
|
+
.conflicts(['alias', 'branch', 'prod']))
|
|
79
80
|
.option('--prod-if-unlocked', 'Deploy to production if unlocked, create a draft otherwise', false)
|
|
80
81
|
.option('--alias <name>', 'Specifies the alias for deployment, the string at the beginning of the deploy subdomain. Useful for creating predictable deployment URLs. Avoid setting an alias string to the same value as a deployed branch. `alias` doesn’t create a branch deploy and can’t be used in conjunction with the branch subdomain feature. Maximum 37 characters.')
|
|
81
82
|
.option('-b, --branch <name>', 'Serves the same functionality as --alias. Deprecated and will be removed in future versions')
|
|
@@ -85,7 +86,7 @@ Support for package.json's main field, and intrinsic index.js entrypoints are co
|
|
|
85
86
|
.option('-s, --site <name-or-id>', 'A site name or ID to deploy to', env.NETLIFY_SITE_ID)
|
|
86
87
|
.option('--json', 'Output deployment data as JSON')
|
|
87
88
|
.option('--timeout <number>', 'Timeout to wait for deployment to finish', (value) => Number.parseInt(value))
|
|
88
|
-
.
|
|
89
|
+
.addOption(new Option('--trigger', 'Trigger a new build of your site on Netlify without uploading local files').conflicts('build'))
|
|
89
90
|
.option('--build', 'Run build command before deploying')
|
|
90
91
|
.option('--context <context>', 'Context to use when resolving build configuration')
|
|
91
92
|
.option('--skip-functions-cache', 'Ignore any functions created as part of a previous `build` or `deploy` commands, forcing them to be bundled again as part of the deployment', false)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-clone.d.ts","sourceRoot":"","sources":["../../../src/commands/env/env-clone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"env-clone.d.ts","sourceRoot":"","sources":["../../../src/commands/env/env-clone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAIxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAqD5C,eAAO,MAAM,QAAQ,YAAmB,YAAY,WAAW,WAAW,qBAgDzE,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { chalk, log, error as logError } from '../../utils/command-helpers.js';
|
|
2
|
+
import { promptEnvCloneOverwrite } from '../../utils/prompts/env-clone-prompt.js';
|
|
2
3
|
// @ts-expect-error TS(7006) FIXME: Parameter 'api' implicitly has an 'any' type.
|
|
3
4
|
const safeGetSite = async (api, siteId) => {
|
|
4
5
|
try {
|
|
@@ -14,7 +15,7 @@ const safeGetSite = async (api, siteId) => {
|
|
|
14
15
|
* @returns {Promise<boolean>}
|
|
15
16
|
*/
|
|
16
17
|
// @ts-expect-error TS(7031) FIXME: Binding element 'api' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
17
|
-
const cloneEnvVars = async ({ api, siteFrom, siteTo }) => {
|
|
18
|
+
const cloneEnvVars = async ({ api, force, siteFrom, siteTo }) => {
|
|
18
19
|
const [envelopeFrom, envelopeTo] = await Promise.all([
|
|
19
20
|
api.getEnvVars({ accountId: siteFrom.account_slug, siteId: siteFrom.id }),
|
|
20
21
|
api.getEnvVars({ accountId: siteTo.account_slug, siteId: siteTo.id }),
|
|
@@ -29,6 +30,9 @@ const cloneEnvVars = async ({ api, siteFrom, siteTo }) => {
|
|
|
29
30
|
const siteId = siteTo.id;
|
|
30
31
|
// @ts-expect-error TS(7031) FIXME: Binding element 'key' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
31
32
|
const envVarsToDelete = envelopeTo.filter(({ key }) => keysFrom.includes(key));
|
|
33
|
+
if (envVarsToDelete.length !== 0 && Boolean(force) === false) {
|
|
34
|
+
await promptEnvCloneOverwrite(siteTo.id, envVarsToDelete);
|
|
35
|
+
}
|
|
32
36
|
// delete marked env vars in parallel
|
|
33
37
|
// @ts-expect-error TS(7031) FIXME: Binding element 'key' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
34
38
|
await Promise.all(envVarsToDelete.map(({ key }) => api.deleteEnvVar({ accountId, siteId, key })));
|
|
@@ -44,12 +48,17 @@ const cloneEnvVars = async ({ api, siteFrom, siteTo }) => {
|
|
|
44
48
|
};
|
|
45
49
|
export const envClone = async (options, command) => {
|
|
46
50
|
const { api, site } = command.netlify;
|
|
51
|
+
const { force } = options;
|
|
47
52
|
if (!site.id && !options.from) {
|
|
48
53
|
log('Please include the source site Id as the `--from` option, or run `netlify link` to link this folder to a Netlify site');
|
|
49
54
|
return false;
|
|
50
55
|
}
|
|
56
|
+
const sourceId = options.from || site.id;
|
|
57
|
+
if (!sourceId) {
|
|
58
|
+
log('Please include the source site Id as the `--from` option, or run `netlify link` to link this folder to a Netlify site');
|
|
59
|
+
}
|
|
51
60
|
const siteId = {
|
|
52
|
-
from:
|
|
61
|
+
from: sourceId,
|
|
53
62
|
to: options.to,
|
|
54
63
|
};
|
|
55
64
|
const [{ data: siteFrom, error: errorFrom }, { data: siteTo, error: errorTo }] = await Promise.all([
|
|
@@ -64,7 +73,7 @@ export const envClone = async (options, command) => {
|
|
|
64
73
|
logError(`Can't find site with id ${chalk.bold(siteId.to)}. Please make sure the site exists.`);
|
|
65
74
|
return false;
|
|
66
75
|
}
|
|
67
|
-
const success = await cloneEnvVars({ api, siteFrom, siteTo });
|
|
76
|
+
const success = await cloneEnvVars({ api, siteFrom, siteTo, force });
|
|
68
77
|
if (!success) {
|
|
69
78
|
return false;
|
|
70
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-set.d.ts","sourceRoot":"","sources":["../../../src/commands/env/env-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"env-set.d.ts","sourceRoot":"","sources":["../../../src/commands/env/env-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAKxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AA6G5C,eAAO,MAAM,MAAM,QAAe,MAAM,SAAS,MAAM,WAAW,YAAY,WAAW,WAAW,+BA+BnG,CAAA"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { chalk, error, log, logJson } from '../../utils/command-helpers.js';
|
|
2
2
|
import { AVAILABLE_CONTEXTS, AVAILABLE_SCOPES, translateFromEnvelopeToMongo } from '../../utils/env/index.js';
|
|
3
|
+
import { promptOverwriteEnvVariable } from '../../utils/prompts/env-set-prompts.js';
|
|
3
4
|
/**
|
|
4
5
|
* Updates the env for a site configured with Envelope with a new key/value pair
|
|
5
6
|
* @returns {Promise<object | boolean>}
|
|
6
7
|
*/
|
|
7
8
|
// @ts-expect-error TS(7031) FIXME: Binding element 'api' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
8
|
-
const setInEnvelope = async ({ api, context, key, scope, secret, siteInfo, value }) => {
|
|
9
|
+
const setInEnvelope = async ({ api, context, force, key, scope, secret, siteInfo, value }) => {
|
|
9
10
|
const accountId = siteInfo.account_slug;
|
|
10
11
|
const siteId = siteInfo.id;
|
|
11
12
|
// secret values may not be used in the post-processing scope
|
|
@@ -33,6 +34,10 @@ const setInEnvelope = async ({ api, context, key, scope, secret, siteInfo, value
|
|
|
33
34
|
let values = contexts.map((ctx) => AVAILABLE_CONTEXTS.includes(ctx) ? { context: ctx, value } : { context: 'branch', context_parameter: ctx, value });
|
|
34
35
|
// @ts-expect-error TS(7006) FIXME: Parameter 'envVar' implicitly has an 'any' type.
|
|
35
36
|
const existing = envelopeVariables.find((envVar) => envVar.key === key);
|
|
37
|
+
// Checks if --force is passed and if it is an existing variaible, then we need to prompt the user
|
|
38
|
+
if (Boolean(force) === false && existing) {
|
|
39
|
+
await promptOverwriteEnvVariable(key);
|
|
40
|
+
}
|
|
36
41
|
const params = { accountId, siteId, key };
|
|
37
42
|
try {
|
|
38
43
|
if (existing) {
|
|
@@ -92,7 +97,7 @@ const setInEnvelope = async ({ api, context, key, scope, secret, siteInfo, value
|
|
|
92
97
|
};
|
|
93
98
|
};
|
|
94
99
|
export const envSet = async (key, value, options, command) => {
|
|
95
|
-
const { context, scope, secret } = options;
|
|
100
|
+
const { context, force, scope, secret } = options;
|
|
96
101
|
const { api, cachedConfig, site } = command.netlify;
|
|
97
102
|
const siteId = site.id;
|
|
98
103
|
if (!siteId) {
|
|
@@ -101,7 +106,7 @@ export const envSet = async (key, value, options, command) => {
|
|
|
101
106
|
}
|
|
102
107
|
const { siteInfo } = cachedConfig;
|
|
103
108
|
// Get current environment variables set in the UI
|
|
104
|
-
const finalEnv = await setInEnvelope({ api, siteInfo, key, value, context, scope, secret });
|
|
109
|
+
const finalEnv = await setInEnvelope({ api, siteInfo, force, key, value, context, scope, secret });
|
|
105
110
|
if (!finalEnv) {
|
|
106
111
|
return false;
|
|
107
112
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-unset.d.ts","sourceRoot":"","sources":["../../../src/commands/env/env-unset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"env-unset.d.ts","sourceRoot":"","sources":["../../../src/commands/env/env-unset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAKxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAgE5C,eAAO,MAAM,QAAQ,QAAe,MAAM,WAAW,YAAY,WAAW,WAAW,+BAsBtF,CAAA"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { chalk, log, logJson } from '../../utils/command-helpers.js';
|
|
2
2
|
import { AVAILABLE_CONTEXTS, translateFromEnvelopeToMongo } from '../../utils/env/index.js';
|
|
3
|
+
import { promptOverwriteEnvVariable } from '../../utils/prompts/env-unset-prompts.js';
|
|
3
4
|
/**
|
|
4
5
|
* Deletes a given key from the env of a site configured with Envelope
|
|
5
6
|
* @returns {Promise<object>}
|
|
6
7
|
*/
|
|
7
8
|
// @ts-expect-error TS(7031) FIXME: Binding element 'api' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
8
|
-
const unsetInEnvelope = async ({ api, context, key, siteInfo }) => {
|
|
9
|
+
const unsetInEnvelope = async ({ api, context, force, key, siteInfo }) => {
|
|
9
10
|
const accountId = siteInfo.account_slug;
|
|
10
11
|
const siteId = siteInfo.id;
|
|
11
12
|
// fetch envelope env vars
|
|
@@ -19,6 +20,9 @@ const unsetInEnvelope = async ({ api, context, key, siteInfo }) => {
|
|
|
19
20
|
// if not, no need to call delete; return early
|
|
20
21
|
return env;
|
|
21
22
|
}
|
|
23
|
+
if (Boolean(force) === false) {
|
|
24
|
+
await promptOverwriteEnvVariable(key);
|
|
25
|
+
}
|
|
22
26
|
const params = { accountId, siteId, key };
|
|
23
27
|
try {
|
|
24
28
|
if (context) {
|
|
@@ -52,7 +56,7 @@ const unsetInEnvelope = async ({ api, context, key, siteInfo }) => {
|
|
|
52
56
|
return env;
|
|
53
57
|
};
|
|
54
58
|
export const envUnset = async (key, options, command) => {
|
|
55
|
-
const { context } = options;
|
|
59
|
+
const { context, force } = options;
|
|
56
60
|
const { api, cachedConfig, site } = command.netlify;
|
|
57
61
|
const siteId = site.id;
|
|
58
62
|
if (!siteId) {
|
|
@@ -60,7 +64,7 @@ export const envUnset = async (key, options, command) => {
|
|
|
60
64
|
return false;
|
|
61
65
|
}
|
|
62
66
|
const { siteInfo } = cachedConfig;
|
|
63
|
-
const finalEnv = await unsetInEnvelope({ api, context, siteInfo, key });
|
|
67
|
+
const finalEnv = await unsetInEnvelope({ api, context, force, siteInfo, key });
|
|
64
68
|
// Return new environment variables of site if using json flag
|
|
65
69
|
if (options.json) {
|
|
66
70
|
logJson(finalEnv);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAEA,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAE5C,eAAO,MAAM,iBAAiB,YAAa,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAEA,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAE5C,eAAO,MAAM,iBAAiB,YAAa,WAAW,gBAiBhD,CAAA"}
|
|
@@ -3,7 +3,6 @@ export const createInitCommand = (program) => program
|
|
|
3
3
|
.command('init')
|
|
4
4
|
.description('Configure continuous deployment for a new or existing site. To create a new site without continuous deployment, use `netlify sites:create`')
|
|
5
5
|
.option('-m, --manual', 'Manually configure a git remote for CI')
|
|
6
|
-
.option('--force', 'Reinitialize CI hooks if the linked site is already configured to use CI')
|
|
7
6
|
.addOption(new Option('--gitRemoteName <name>', 'Old, prefer --git-remote-name. Name of Git remote to use. e.g. "origin"').hideHelp(true))
|
|
8
7
|
.option('--git-remote-name <name>', 'Name of Git remote to use. e.g. "origin"')
|
|
9
8
|
.action(async (options, command) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/integration/deploy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/integration/deploy.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAUxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAS5C,wBAAgB,cAAc,CAAC,WAAW,KAAA,EAAE,YAAY,KAAA,OAOvD;AAuFD,wBAAsB,mBAAmB,CAAC,UAAU,KAAA,EAAE,MAAM,KAAA,EAAE,SAAS,KAAA,EAAE,sBAAsB,KAAA,EAAE,KAAK,KAAA,iBAyErG;AAED,wBAAsB,iBAAiB,CAErC,UAAU,KAAA,EAEV,OAAO,KAAA,EAEP,MAAM,KAAA,EAEN,SAAS,KAAA,EAET,sBAAsB,KAAA,EAEtB,KAAK,KAAA,EAEL,qBAAqB,KAAA,iBAsHtB;AA2BD,eAAO,MAAM,gBAAgB,0BA6B5B,CAAA;AAED,eAAO,MAAM,MAAM,YAAmB,YAAY,WAAW,WAAW,kBAgEvE,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
|
+
import process from 'process';
|
|
2
3
|
import { resolve } from 'path';
|
|
3
|
-
import {
|
|
4
|
+
import { exit } from 'process';
|
|
4
5
|
import inquirer from 'inquirer';
|
|
5
6
|
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'js-y... Remove this comment to see the full error message
|
|
6
7
|
import yaml from 'js-yaml';
|
|
@@ -12,7 +13,7 @@ import { getSiteInformation } from '../../utils/dev.js';
|
|
|
12
13
|
import { checkOptions } from '../build/build.js';
|
|
13
14
|
import { deploy as siteDeploy } from '../deploy/deploy.js';
|
|
14
15
|
function getIntegrationAPIUrl() {
|
|
15
|
-
return env.INTEGRATION_URL || 'https://api.netlifysdk.com';
|
|
16
|
+
return process.env.INTEGRATION_URL || 'https://api.netlifysdk.com';
|
|
16
17
|
}
|
|
17
18
|
// @ts-expect-error TS(7006) FIXME: Parameter 'localScopes' implicitly has an 'any' ty... Remove this comment to see the full error message
|
|
18
19
|
export function areScopesEqual(localScopes, remoteScopes) {
|
|
@@ -74,7 +75,7 @@ function formatScopesForRemote(scopes) {
|
|
|
74
75
|
return scopesToWrite.join(',');
|
|
75
76
|
}
|
|
76
77
|
// @ts-expect-error TS(7006) FIXME: Parameter 'name' implicitly has an 'any' type.
|
|
77
|
-
function verifyRequiredFieldsAreInConfig(name, description, scopes
|
|
78
|
+
function verifyRequiredFieldsAreInConfig(name, description, scopes) {
|
|
78
79
|
const missingFields = [];
|
|
79
80
|
if (!name) {
|
|
80
81
|
missingFields.push('name');
|
|
@@ -85,9 +86,6 @@ function verifyRequiredFieldsAreInConfig(name, description, scopes, integrationL
|
|
|
85
86
|
if (!scopes) {
|
|
86
87
|
missingFields.push('scopes');
|
|
87
88
|
}
|
|
88
|
-
if (!integrationLevel) {
|
|
89
|
-
missingFields.push('integrationLevel');
|
|
90
|
-
}
|
|
91
89
|
if (missingFields.length !== 0) {
|
|
92
90
|
log(chalk.yellow(`You are missing the following fields for the integration to be deployed: ${missingFields.join(', ')}. Please add a these fields as an entry to the integration.yaml file and try again.`));
|
|
93
91
|
log(chalk.yellow('For more information on the required fields, please see the documentation: https://ntl.fyi/create-private-integration'));
|
|
@@ -97,7 +95,7 @@ function verifyRequiredFieldsAreInConfig(name, description, scopes, integrationL
|
|
|
97
95
|
}
|
|
98
96
|
// @ts-expect-error TS(7006) FIXME: Parameter 'workingDir' implicitly has an 'any' typ... Remove this comment to see the full error message
|
|
99
97
|
export async function registerIntegration(workingDir, siteId, accountId, localIntegrationConfig, token) {
|
|
100
|
-
const { description,
|
|
98
|
+
const { description, name, scopes, slug } = localIntegrationConfig;
|
|
101
99
|
log(chalk.yellow(`An integration associated with the site ID ${siteId} is not registered.`));
|
|
102
100
|
const registerPrompt = await inquirer.prompt([
|
|
103
101
|
{
|
|
@@ -112,7 +110,7 @@ export async function registerIntegration(workingDir, siteId, accountId, localIn
|
|
|
112
110
|
log(chalk.white("You can also register the integration through the Netlify UI on the 'Integrations' > 'Create private integration' page"));
|
|
113
111
|
exit(1);
|
|
114
112
|
}
|
|
115
|
-
if (!verifyRequiredFieldsAreInConfig(name, description, scopes
|
|
113
|
+
if (!verifyRequiredFieldsAreInConfig(name, description, scopes)) {
|
|
116
114
|
exit(1);
|
|
117
115
|
}
|
|
118
116
|
log(chalk.white('Registering the integration...'));
|
|
@@ -127,7 +125,6 @@ export async function registerIntegration(workingDir, siteId, accountId, localIn
|
|
|
127
125
|
description,
|
|
128
126
|
hostSiteId: siteId,
|
|
129
127
|
scopes: formatScopesForRemote(scopes),
|
|
130
|
-
integrationLevel,
|
|
131
128
|
}),
|
|
132
129
|
}).then(async (res) => {
|
|
133
130
|
const response = await res.json();
|
|
@@ -148,7 +145,7 @@ export async function registerIntegration(workingDir, siteId, accountId, localIn
|
|
|
148
145
|
log(chalk.green(`Successfully registered the integration with the slug: ${body.slug}`));
|
|
149
146
|
const updatedIntegrationConfig = yaml.dump({
|
|
150
147
|
// @ts-expect-error TS(18046) - 'body' is of type 'unknown'
|
|
151
|
-
config: { name, description, slug: body.slug, scopes
|
|
148
|
+
config: { name, description, slug: body.slug, scopes },
|
|
152
149
|
});
|
|
153
150
|
const filePath = resolve(workingDir, 'integration.yaml');
|
|
154
151
|
await fs.promises.writeFile(filePath, updatedIntegrationConfig);
|
|
@@ -169,7 +166,7 @@ localIntegrationConfig,
|
|
|
169
166
|
token,
|
|
170
167
|
// @ts-expect-error TS(7006) FIXME: Parameter 'registeredIntegration' implicitly has a... Remove this comment to see the full error message
|
|
171
168
|
registeredIntegration) {
|
|
172
|
-
let { description,
|
|
169
|
+
let { description, name, scopes, slug } = localIntegrationConfig;
|
|
173
170
|
let integrationSlug = slug;
|
|
174
171
|
if (slug !== registeredIntegration.slug) {
|
|
175
172
|
// Update the project's integration.yaml file with the remote slug since that will
|
|
@@ -186,10 +183,6 @@ registeredIntegration) {
|
|
|
186
183
|
// eslint-disable-next-line prefer-destructuring
|
|
187
184
|
description = registeredIntegration.description;
|
|
188
185
|
}
|
|
189
|
-
if (!integrationLevel) {
|
|
190
|
-
// eslint-disable-next-line prefer-destructuring
|
|
191
|
-
integrationLevel = registeredIntegration.integrationLevel;
|
|
192
|
-
}
|
|
193
186
|
// This is returned as a comma separated string and will be easier to manage here as an array
|
|
194
187
|
const registeredIntegrationScopes = registeredIntegration.scopes.split(',');
|
|
195
188
|
const scopeResources = Object.keys(scopes);
|
|
@@ -234,7 +227,6 @@ registeredIntegration) {
|
|
|
234
227
|
hostSiteId: siteId,
|
|
235
228
|
// @ts-expect-error TS(7005) FIXME: Variable 'localScopes' implicitly has an 'any[]' t... Remove this comment to see the full error message
|
|
236
229
|
scopes: localScopes.join(','),
|
|
237
|
-
integrationLevel,
|
|
238
230
|
}),
|
|
239
231
|
}).then(async (res) => {
|
|
240
232
|
const response = await res.json();
|
|
@@ -265,7 +257,7 @@ registeredIntegration) {
|
|
|
265
257
|
}
|
|
266
258
|
}
|
|
267
259
|
const updatedIntegrationConfig = yaml.dump({
|
|
268
|
-
config: { name, description, slug: integrationSlug, scopes: scopesToWrite
|
|
260
|
+
config: { name, description, slug: integrationSlug, scopes: scopesToWrite },
|
|
269
261
|
});
|
|
270
262
|
const filePath = resolve(workingDir, 'integration.yaml');
|
|
271
263
|
await fs.promises.writeFile(filePath, updatedIntegrationConfig);
|
|
@@ -285,7 +277,6 @@ const IntegrationConfigurationSchema = z.object({
|
|
|
285
277
|
user: z.array(z.enum(['read', 'write'])).optional(),
|
|
286
278
|
})
|
|
287
279
|
.optional(),
|
|
288
|
-
integrationLevel: z.enum(['site', 'team', 'team-and-site']).optional(),
|
|
289
280
|
});
|
|
290
281
|
// @ts-expect-error TS(7006) FIXME: Parameter 'workingDir' implicitly has an 'any' typ... Remove this comment to see the full error message
|
|
291
282
|
const getConfigurationFile = (workingDir) => {
|
|
@@ -333,8 +324,8 @@ export const deploy = async (options, command) => {
|
|
|
333
324
|
});
|
|
334
325
|
// Confirm that a site is linked and that the user is logged in
|
|
335
326
|
checkOptions(buildOptions);
|
|
336
|
-
const { description,
|
|
337
|
-
const localIntegrationConfig = { name, description, scopes, slug
|
|
327
|
+
const { description, name, scopes, slug } = await getConfiguration(command.workingDir);
|
|
328
|
+
const localIntegrationConfig = { name, description, scopes, slug };
|
|
338
329
|
const headers = token ? { 'netlify-token': token } : undefined;
|
|
339
330
|
// @ts-expect-error TS(2345) FIXME: Argument of type '{ api: any; site: any; siteInfo:... Remove this comment to see the full error message
|
|
340
331
|
const { accountId } = await getSiteInformation({
|
package/dist/commands/main.d.ts
CHANGED
|
@@ -1,4 +1,38 @@
|
|
|
1
1
|
import BaseCommand from './base-command.js';
|
|
2
|
+
export declare const CI_FORCED_COMMANDS: {
|
|
3
|
+
'env:set': {
|
|
4
|
+
options: string;
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
'env:unset': {
|
|
8
|
+
options: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
'env:clone': {
|
|
12
|
+
options: string;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
'blobs:set': {
|
|
16
|
+
options: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
'blobs:delete': {
|
|
20
|
+
options: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
'addons:delete': {
|
|
24
|
+
options: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
init: {
|
|
28
|
+
options: string;
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
'sites:delete': {
|
|
32
|
+
options: string;
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
2
36
|
/**
|
|
3
37
|
* Creates the `netlify-cli` command
|
|
4
38
|
* Promise is needed as the envinfo is a promise
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/commands/main.ts"],"names":[],"mappings":"AAgBA,OAAO,WAAW,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/commands/main.ts"],"names":[],"mappings":"AAgBA,OAAO,WAAW,MAAM,mBAAmB,CAAA;AA2B3C,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAS9B,CAAA;AA0JD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,mBAuD7B,CAAA"}
|
package/dist/commands/main.js
CHANGED
|
@@ -35,13 +35,36 @@ import { createSwitchCommand } from './switch/index.js';
|
|
|
35
35
|
import { createUnlinkCommand } from './unlink/index.js';
|
|
36
36
|
import { createWatchCommand } from './watch/index.js';
|
|
37
37
|
const SUGGESTION_TIMEOUT = 1e4;
|
|
38
|
+
// These commands run with the --force flag in non-interactive and CI environments
|
|
39
|
+
export const CI_FORCED_COMMANDS = {
|
|
40
|
+
'env:set': { options: '--force', description: 'Bypasses prompts & Force the command to run.' },
|
|
41
|
+
'env:unset': { options: '--force', description: 'Bypasses prompts & Force the command to run.' },
|
|
42
|
+
'env:clone': { options: '--force', description: 'Bypasses prompts & Force the command to run.' },
|
|
43
|
+
'blobs:set': { options: '--force', description: 'Bypasses prompts & Force the command to run.' },
|
|
44
|
+
'blobs:delete': { options: '--force', description: 'Bypasses prompts & Force the command to run.' },
|
|
45
|
+
'addons:delete': { options: '-f, --force', description: 'Delete without prompting (useful for CI)' },
|
|
46
|
+
init: { options: '--force', description: 'Reinitialize CI hooks if the linked site is already configured to use CI' },
|
|
47
|
+
'sites:delete': { options: '-f, --force', description: 'Delete without prompting (useful for CI).' },
|
|
48
|
+
};
|
|
38
49
|
process.on('uncaughtException', async (err) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
if ('code' in err && err.code === 'EADDRINUSE') {
|
|
51
|
+
error(`${chalk.red(`Port ${err.port} is already in use`)}\n\n` +
|
|
52
|
+
`Your serverless functions might be initializing a server\n` +
|
|
53
|
+
`to listen on specific port without properly closing it.\n\n` +
|
|
54
|
+
`This behavior is generally not advised\n` +
|
|
55
|
+
`To resolve this issue, try the following:\n` +
|
|
56
|
+
`1. If you NEED your serverless function to listen on a specific port,\n` +
|
|
57
|
+
`use a randomly assigned port as we do not officially support this.\n` +
|
|
58
|
+
`2. Review your serverless functions for lingering server connections, close them\n` +
|
|
59
|
+
`3. Check if any other applications are using port ${err.port}\n`, { exit: false });
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
error(`${chalk.red('Netlify CLI has terminated unexpectedly')}\nThis is a problem with the Netlify CLI, not with your application.\nIf you recently updated the CLI, consider reverting to an older version by running:\n\n${chalk.bold('npm install -g netlify-cli@VERSION')}\n\nYou can use any version from ${chalk.underline('https://ntl.fyi/cli-versions')}.\n\nPlease report this problem at ${chalk.underline('https://ntl.fyi/cli-error')} including the error details below.\n`, { exit: false });
|
|
63
|
+
const systemInfo = await getSystemInfo();
|
|
64
|
+
console.log(chalk.dim(err.stack || err));
|
|
65
|
+
console.log(chalk.dim(systemInfo));
|
|
66
|
+
reportError(err, { severity: 'error' });
|
|
67
|
+
}
|
|
45
68
|
process.exit(1);
|
|
46
69
|
});
|
|
47
70
|
const getSystemInfo = () => envinfo.run({
|
|
@@ -188,5 +211,12 @@ export const createMainCommand = () => {
|
|
|
188
211
|
},
|
|
189
212
|
})
|
|
190
213
|
.action(mainCommand);
|
|
214
|
+
program.commands.forEach((cmd) => {
|
|
215
|
+
const cmdName = cmd.name();
|
|
216
|
+
if (cmdName in CI_FORCED_COMMANDS) {
|
|
217
|
+
const { options, description } = CI_FORCED_COMMANDS[cmdName];
|
|
218
|
+
cmd.option(options, description);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
191
221
|
return program;
|
|
192
222
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { OptionValues } from 'commander';
|
|
2
|
+
import { SiteInfo } from '../../utils/types.js';
|
|
2
3
|
import BaseCommand from '../base-command.js';
|
|
3
|
-
|
|
4
|
-
export declare const fetchTemplates: (token: string) => Promise<Template[]>;
|
|
5
|
-
export declare const sitesCreateTemplate: (repository: string, options: OptionValues, command: BaseCommand) => Promise<undefined>;
|
|
4
|
+
export declare const sitesCreateTemplate: (repository: string, options: OptionValues, command: BaseCommand) => Promise<SiteInfo | undefined>;
|
|
6
5
|
//# sourceMappingURL=sites-create-template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sites-create-template.d.ts","sourceRoot":"","sources":["../../../src/commands/sites/sites-create-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"sites-create-template.d.ts","sourceRoot":"","sources":["../../../src/commands/sites/sites-create-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AA0BxC,OAAO,EAAW,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAI5C,eAAO,MAAM,mBAAmB,eAAsB,MAAM,WAAW,YAAY,WAAW,WAAW,kCA8PxG,CAAA"}
|