netlify-cli 17.37.1 → 17.38.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.js +4 -2
- package/dist/commands/addons/addons-config.d.ts.map +1 -1
- package/dist/commands/addons/addons-config.js +0 -1
- package/dist/commands/addons/addons-create.d.ts.map +1 -1
- package/dist/commands/addons/addons-create.js +0 -1
- package/dist/commands/addons/addons-delete.d.ts.map +1 -1
- package/dist/commands/addons/addons-delete.js +0 -1
- package/dist/commands/addons/addons.d.ts.map +1 -1
- package/dist/commands/addons/addons.js +0 -1
- package/dist/commands/api/api.d.ts.map +1 -1
- package/dist/commands/api/api.js +0 -1
- package/dist/commands/base-command.d.ts +2 -2
- package/dist/commands/base-command.d.ts.map +1 -1
- package/dist/commands/base-command.js +2 -2
- 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/build/build.d.ts.map +1 -1
- package/dist/commands/build/build.js +0 -1
- package/dist/commands/completion/completion.d.ts.map +1 -1
- package/dist/commands/completion/completion.js +35 -2
- package/dist/commands/deploy/deploy.d.ts.map +1 -1
- package/dist/commands/deploy/deploy.js +3 -5
- 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/functions/functions-create.d.ts.map +1 -1
- package/dist/commands/functions/functions-create.js +2 -5
- package/dist/commands/functions/functions-invoke.d.ts.map +1 -1
- package/dist/commands/functions/functions-invoke.js +0 -1
- 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 +13 -24
- package/dist/commands/link/link.d.ts.map +1 -1
- package/dist/commands/link/link.js +8 -21
- package/dist/commands/lm/lm-setup.d.ts.map +1 -1
- package/dist/commands/lm/lm-setup.js +0 -1
- package/dist/commands/login/login.d.ts.map +1 -1
- package/dist/commands/login/login.js +0 -2
- package/dist/commands/logout/logout.d.ts.map +1 -1
- package/dist/commands/logout/logout.js +0 -1
- package/dist/commands/logs/build.d.ts.map +1 -1
- package/dist/commands/logs/build.js +4 -0
- 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 -2
- package/dist/commands/sites/sites-create-template.d.ts.map +1 -1
- package/dist/commands/sites/sites-create-template.js +113 -101
- package/dist/commands/sites/sites-create.d.ts +2 -2
- package/dist/commands/sites/sites-create.d.ts.map +1 -1
- package/dist/commands/sites/sites-create.js +1 -9
- package/dist/commands/sites/sites-delete.d.ts.map +1 -1
- package/dist/commands/sites/sites-delete.js +3 -3
- package/dist/commands/sites/sites-list.d.ts.map +1 -1
- package/dist/commands/sites/sites-list.js +1 -5
- package/dist/commands/sites/sites.d.ts.map +1 -1
- package/dist/commands/sites/sites.js +0 -1
- package/dist/commands/status/status.js +3 -2
- package/dist/commands/unlink/unlink.js +2 -2
- package/dist/commands/watch/watch.d.ts.map +1 -1
- package/dist/commands/watch/watch.js +0 -1
- package/dist/lib/api.d.ts +2 -1
- package/dist/lib/api.d.ts.map +1 -1
- package/dist/lib/exec-fetcher.d.ts.map +1 -1
- package/dist/lib/exec-fetcher.js +0 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/addons/prepare.d.ts.map +1 -1
- package/dist/utils/addons/prepare.js +1 -5
- package/dist/utils/command-helpers.d.ts +37 -6
- package/dist/utils/command-helpers.d.ts.map +1 -1
- package/dist/utils/command-helpers.js +21 -9
- package/dist/utils/dev.d.ts.map +1 -1
- package/dist/utils/dev.js +0 -2
- package/dist/utils/framework-server.d.ts.map +1 -1
- package/dist/utils/framework-server.js +2 -3
- package/dist/utils/get-repo-data.d.ts +2 -2
- package/dist/utils/get-repo-data.d.ts.map +1 -1
- package/dist/utils/get-repo-data.js +0 -1
- package/dist/utils/get-site.d.ts.map +1 -1
- package/dist/utils/get-site.js +7 -2
- package/dist/utils/gh-auth.js +1 -1
- package/dist/utils/hooks/requires-site-info.d.ts.map +1 -1
- package/dist/utils/hooks/requires-site-info.js +0 -3
- 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/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 -5
- package/dist/utils/sites/utils.d.ts.map +1 -1
- package/dist/utils/sites/utils.js +23 -11
- 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 +137 -0
- 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 +181 -252
- package/package.json +9 -9
- 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
|
@@ -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) => {
|
|
@@ -321,7 +312,6 @@ export const getConfiguration = (workingDir) => {
|
|
|
321
312
|
export const deploy = async (options, command) => {
|
|
322
313
|
const { api, cachedConfig, site, siteInfo } = command.netlify;
|
|
323
314
|
const { id: siteId } = site;
|
|
324
|
-
// @ts-expect-error TS(2554) FIXME: Expected 1 arguments, but got 0.
|
|
325
315
|
const [token] = await getToken();
|
|
326
316
|
const workingDir = resolve(command.workingDir);
|
|
327
317
|
const buildOptions = await getBuildOptions({
|
|
@@ -334,8 +324,9 @@ export const deploy = async (options, command) => {
|
|
|
334
324
|
});
|
|
335
325
|
// Confirm that a site is linked and that the user is logged in
|
|
336
326
|
checkOptions(buildOptions);
|
|
337
|
-
const { description,
|
|
338
|
-
const localIntegrationConfig = { name, description, scopes, slug
|
|
327
|
+
const { description, name, scopes, slug } = await getConfiguration(command.workingDir);
|
|
328
|
+
const localIntegrationConfig = { name, description, scopes, slug };
|
|
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({
|
|
341
332
|
api,
|
|
@@ -343,9 +334,7 @@ export const deploy = async (options, command) => {
|
|
|
343
334
|
siteInfo,
|
|
344
335
|
});
|
|
345
336
|
const { body: registeredIntegration, statusCode } = await fetch(`${getIntegrationAPIUrl()}/${accountId}/integrations?site_id=${siteId}`, {
|
|
346
|
-
headers
|
|
347
|
-
'netlify-token': token,
|
|
348
|
-
},
|
|
337
|
+
headers,
|
|
349
338
|
}).then(async (res) => {
|
|
350
339
|
const body = await res.json();
|
|
351
340
|
return { body, statusCode: res.status };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/commands/link/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/commands/link/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAUxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAyO5C,eAAO,MAAM,IAAI,YAAmB,YAAY,WAAW,WAAW,iBAqFrE,CAAA"}
|
|
@@ -48,9 +48,7 @@ const linkPrompt = async (command, options) => {
|
|
|
48
48
|
if (sites.length === 0) {
|
|
49
49
|
error(`You don't have any sites yet. Run ${chalk.cyanBright('netlify sites:create')} to create a site.`);
|
|
50
50
|
}
|
|
51
|
-
const matchingSites = sites.filter(
|
|
52
|
-
// @ts-expect-error TS(2339) FIXME: Property 'repo_url' does not exist on type '{}'.
|
|
53
|
-
({ build_settings: buildSettings = {} }) => repoData.httpsUrl === buildSettings.repo_url);
|
|
51
|
+
const matchingSites = sites.filter(({ build_settings: buildSettings = {} }) => repoData.httpsUrl === buildSettings.repo_url);
|
|
54
52
|
// If no remote matches. Throw error
|
|
55
53
|
if (matchingSites.length === 0) {
|
|
56
54
|
log(chalk.redBright.bold.underline(`No Matching Site Found`));
|
|
@@ -76,7 +74,6 @@ Run ${chalk.cyanBright('git remote -v')} to see a list of your git remotes.`);
|
|
|
76
74
|
type: 'list',
|
|
77
75
|
name: 'selectedSite',
|
|
78
76
|
message: 'Which site do you want to link?',
|
|
79
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'matchingSite' implicitly has an 'any' t... Remove this comment to see the full error message
|
|
80
77
|
choices: matchingSites.map((matchingSite) => ({
|
|
81
78
|
name: `${matchingSite.name} - ${matchingSite.ssl_url}`,
|
|
82
79
|
value: matchingSite,
|
|
@@ -101,7 +98,7 @@ Run ${chalk.cyanBright('git remote -v')} to see a list of your git remotes.`);
|
|
|
101
98
|
]);
|
|
102
99
|
log(`Looking for sites with names containing '${searchTerm}'...`);
|
|
103
100
|
log();
|
|
104
|
-
let matchingSites;
|
|
101
|
+
let matchingSites = [];
|
|
105
102
|
try {
|
|
106
103
|
matchingSites = await listSites({
|
|
107
104
|
api,
|
|
@@ -109,12 +106,10 @@ Run ${chalk.cyanBright('git remote -v')} to see a list of your git remotes.`);
|
|
|
109
106
|
});
|
|
110
107
|
}
|
|
111
108
|
catch (error_) {
|
|
112
|
-
// @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
|
|
113
109
|
if (error_.status === 404) {
|
|
114
110
|
error(`'${searchTerm}' not found`);
|
|
115
111
|
}
|
|
116
112
|
else {
|
|
117
|
-
// @ts-expect-error TS(2345) FIXME: Argument of type 'unknown' is not assignable to pa... Remove this comment to see the full error message
|
|
118
113
|
error(error_);
|
|
119
114
|
}
|
|
120
115
|
}
|
|
@@ -132,7 +127,6 @@ or run ${chalk.cyanBright('netlify sites:create')} to create a site.`);
|
|
|
132
127
|
name: 'selectedSite',
|
|
133
128
|
message: 'Which site do you want to link?',
|
|
134
129
|
paginated: true,
|
|
135
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'matchingSite' implicitly has an 'any' t... Remove this comment to see the full error message
|
|
136
130
|
choices: matchingSites.map((matchingSite) => ({ name: matchingSite.name, value: matchingSite })),
|
|
137
131
|
},
|
|
138
132
|
]);
|
|
@@ -156,7 +150,6 @@ or run ${chalk.cyanBright('netlify sites:create')} to create a site.`);
|
|
|
156
150
|
sites = await listSites({ api, options: { maxPages: 1, filter: 'all' } });
|
|
157
151
|
}
|
|
158
152
|
catch (error_) {
|
|
159
|
-
// @ts-expect-error TS(2345) FIXME: Argument of type 'unknown' is not assignable to pa... Remove this comment to see the full error message
|
|
160
153
|
error(error_);
|
|
161
154
|
}
|
|
162
155
|
if (!sites || sites.length === 0) {
|
|
@@ -191,12 +184,10 @@ or run ${chalk.cyanBright('netlify sites:create')} to create a site.`);
|
|
|
191
184
|
site = await api.getSite({ siteId });
|
|
192
185
|
}
|
|
193
186
|
catch (error_) {
|
|
194
|
-
// @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
|
|
195
187
|
if (error_.status === 404) {
|
|
196
|
-
error(
|
|
188
|
+
error(`Site ID '${siteId}' not found`);
|
|
197
189
|
}
|
|
198
190
|
else {
|
|
199
|
-
// @ts-expect-error TS(2345) FIXME: Argument of type 'unknown' is not assignable to pa... Remove this comment to see the full error message
|
|
200
191
|
error(error_);
|
|
201
192
|
}
|
|
202
193
|
}
|
|
@@ -249,12 +240,10 @@ export const link = async (options, command) => {
|
|
|
249
240
|
siteData = await api.getSite({ site_id: options.id });
|
|
250
241
|
}
|
|
251
242
|
catch (error_) {
|
|
252
|
-
// @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
|
|
253
243
|
if (error_.status === 404) {
|
|
254
244
|
error(new Error(`Site id ${options.id} not found`));
|
|
255
245
|
}
|
|
256
246
|
else {
|
|
257
|
-
// @ts-expect-error TS(2345) FIXME: Argument of type 'unknown' is not assignable to pa... Remove this comment to see the full error message
|
|
258
247
|
error(error_);
|
|
259
248
|
}
|
|
260
249
|
}
|
|
@@ -268,7 +257,7 @@ export const link = async (options, command) => {
|
|
|
268
257
|
});
|
|
269
258
|
}
|
|
270
259
|
else if (options.name) {
|
|
271
|
-
let results;
|
|
260
|
+
let results = [];
|
|
272
261
|
try {
|
|
273
262
|
results = await listSites({
|
|
274
263
|
api,
|
|
@@ -279,23 +268,21 @@ export const link = async (options, command) => {
|
|
|
279
268
|
});
|
|
280
269
|
}
|
|
281
270
|
catch (error_) {
|
|
282
|
-
// @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
|
|
283
271
|
if (error_.status === 404) {
|
|
284
272
|
error(new Error(`${options.name} not found`));
|
|
285
273
|
}
|
|
286
274
|
else {
|
|
287
|
-
// @ts-expect-error TS(2345) FIXME: Argument of type 'unknown' is not assignable to pa... Remove this comment to see the full error message
|
|
288
275
|
error(error_);
|
|
289
276
|
}
|
|
290
277
|
}
|
|
291
278
|
if (results.length === 0) {
|
|
292
279
|
error(new Error(`No sites found named ${options.name}`));
|
|
293
280
|
}
|
|
294
|
-
const
|
|
295
|
-
state.set('siteId',
|
|
296
|
-
log(`Linked to ${
|
|
281
|
+
const matchingSiteData = results.find((site) => site.name === options.name) || results[0];
|
|
282
|
+
state.set('siteId', matchingSiteData.id);
|
|
283
|
+
log(`Linked to ${matchingSiteData.name}`);
|
|
297
284
|
await track('sites_linked', {
|
|
298
|
-
siteId: (
|
|
285
|
+
siteId: (matchingSiteData && matchingSiteData.id) || siteId,
|
|
299
286
|
linkType: 'manual',
|
|
300
287
|
kind: 'byName',
|
|
301
288
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lm-setup.d.ts","sourceRoot":"","sources":["../../../src/commands/lm/lm-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAQxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAiD5C,eAAO,MAAM,OAAO,YAAmB,YAAY,WAAW,WAAW,
|
|
1
|
+
{"version":3,"file":"lm-setup.d.ts","sourceRoot":"","sources":["../../../src/commands/lm/lm-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAQxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAiD5C,eAAO,MAAM,OAAO,YAAmB,YAAY,WAAW,WAAW,kBAiCxE,CAAA"}
|
|
@@ -55,7 +55,6 @@ export const lmSetup = async (options, command) => {
|
|
|
55
55
|
helperInstalled = await installHelperIfMissing({ force: options.forceInstall });
|
|
56
56
|
}
|
|
57
57
|
catch (error_) {
|
|
58
|
-
// @ts-expect-error TS(2345) FIXME: Argument of type 'unknown' is not assignable to pa... Remove this comment to see the full error message
|
|
59
58
|
error(error_);
|
|
60
59
|
}
|
|
61
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/login/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/login/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAIxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAe5C,eAAO,MAAM,KAAK,YAAmB,YAAY,WAAW,WAAW,uBAkBtE,CAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { chalk, exit, getToken, log } from '../../utils/command-helpers.js';
|
|
2
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'location' implicitly has an 'any' type.
|
|
3
2
|
const msg = function (location) {
|
|
4
3
|
switch (location) {
|
|
5
4
|
case 'env':
|
|
@@ -13,7 +12,6 @@ const msg = function (location) {
|
|
|
13
12
|
}
|
|
14
13
|
};
|
|
15
14
|
export const login = async (options, command) => {
|
|
16
|
-
// @ts-expect-error TS(2554) FIXME: Expected 1 arguments, but got 0.
|
|
17
15
|
const [accessToken, location] = await getToken();
|
|
18
16
|
command.setAnalyticsPayload({ new: options.new });
|
|
19
17
|
if (accessToken && !options.new) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/commands/logout/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAIxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAE5C,eAAO,MAAM,MAAM,YAAmB,YAAY,WAAW,WAAW,
|
|
1
|
+
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/commands/logout/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAIxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAE5C,eAAO,MAAM,MAAM,YAAmB,YAAY,WAAW,WAAW,kBAwBvE,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { exit, getToken, log } from '../../utils/command-helpers.js';
|
|
2
2
|
import { track } from '../../utils/telemetry/index.js';
|
|
3
3
|
export const logout = async (options, command) => {
|
|
4
|
-
// @ts-expect-error TS(2554) FIXME: Expected 1 arguments, but got 0.
|
|
5
4
|
const [accessToken, location] = await getToken();
|
|
6
5
|
if (!accessToken) {
|
|
7
6
|
log(`Already logged out`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/commands/logs/build.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAK7C,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAA;AAEjD,wBAAgB,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,GAAG,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,UAyB1E;AAED,eAAO,MAAM,SAAS,YAAmB,YAAY,WAAW,WAAW,
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/commands/logs/build.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAK7C,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAA;AAEjD,wBAAgB,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,GAAG,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,UAyB1E;AAED,eAAO,MAAM,SAAS,YAAmB,YAAY,WAAW,WAAW,kBAuD1E,CAAA"}
|
|
@@ -30,6 +30,10 @@ export const logsBuild = async (options, command) => {
|
|
|
30
30
|
const { site } = command.netlify;
|
|
31
31
|
const { id: siteId } = site;
|
|
32
32
|
const userId = command.netlify.globalConfig.get('userId');
|
|
33
|
+
if (!siteId) {
|
|
34
|
+
log('You must link a site before attempting to view deploy logs');
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
33
37
|
const deploys = await client.listSiteDeploys({ siteId, state: 'building' });
|
|
34
38
|
if (deploys.length === 0) {
|
|
35
39
|
log('No active builds');
|
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,5 +1,5 @@
|
|
|
1
1
|
import { OptionValues } from 'commander';
|
|
2
|
+
import { SiteInfo } from '../../utils/types.js';
|
|
2
3
|
import BaseCommand from '../base-command.js';
|
|
3
|
-
export declare const
|
|
4
|
-
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>;
|
|
5
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"}
|