netlify-cli 17.10.0 → 17.10.2

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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
- "version": "17.10.0",
3
+ "version": "17.10.2",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "netlify-cli",
9
- "version": "17.10.0",
9
+ "version": "17.10.2",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
@@ -82,7 +82,6 @@
82
82
  "lodash": "4.17.21",
83
83
  "log-symbols": "5.1.0",
84
84
  "log-update": "5.0.1",
85
- "minimist": "1.2.8",
86
85
  "multiparty": "4.2.3",
87
86
  "netlify": "13.1.11",
88
87
  "netlify-headers-parser": "7.1.2",
@@ -5037,9 +5036,9 @@
5037
5036
  }
5038
5037
  },
5039
5038
  "node_modules/@sindresorhus/slugify": {
5040
- "version": "2.1.1",
5041
- "resolved": "https://registry.npmjs.org/@sindresorhus/slugify/-/slugify-2.1.1.tgz",
5042
- "integrity": "sha512-XokPHZ+q6FtQGEi1hnfvARVJJVPEhwHQTPHPPuNHaN6zcHjzYNynhhHMopa1wNPqLAFOwpsbintunEqWecXJMg==",
5039
+ "version": "2.2.1",
5040
+ "resolved": "https://registry.npmjs.org/@sindresorhus/slugify/-/slugify-2.2.1.tgz",
5041
+ "integrity": "sha512-MkngSCRZ8JdSOCHRaYd+D01XhvU3Hjy6MGl06zhOk614hp9EOAp5gIkBeQg7wtmxpitU6eAL4kdiRMcJa2dlrw==",
5043
5042
  "dependencies": {
5044
5043
  "@sindresorhus/transliterate": "^1.0.0",
5045
5044
  "escape-string-regexp": "^5.0.0"
@@ -19675,9 +19674,9 @@
19675
19674
  }
19676
19675
  },
19677
19676
  "@sindresorhus/slugify": {
19678
- "version": "2.1.1",
19679
- "resolved": "https://registry.npmjs.org/@sindresorhus/slugify/-/slugify-2.1.1.tgz",
19680
- "integrity": "sha512-XokPHZ+q6FtQGEi1hnfvARVJJVPEhwHQTPHPPuNHaN6zcHjzYNynhhHMopa1wNPqLAFOwpsbintunEqWecXJMg==",
19677
+ "version": "2.2.1",
19678
+ "resolved": "https://registry.npmjs.org/@sindresorhus/slugify/-/slugify-2.2.1.tgz",
19679
+ "integrity": "sha512-MkngSCRZ8JdSOCHRaYd+D01XhvU3Hjy6MGl06zhOk614hp9EOAp5gIkBeQg7wtmxpitU6eAL4kdiRMcJa2dlrw==",
19681
19680
  "requires": {
19682
19681
  "@sindresorhus/transliterate": "^1.0.0",
19683
19682
  "escape-string-regexp": "^5.0.0"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
3
  "description": "Netlify command line tool",
4
- "version": "17.10.0",
4
+ "version": "17.10.2",
5
5
  "author": "Netlify Inc.",
6
6
  "type": "module",
7
7
  "engines": {
@@ -115,7 +115,6 @@
115
115
  "lodash": "4.17.21",
116
116
  "log-symbols": "5.1.0",
117
117
  "log-update": "5.0.1",
118
- "minimist": "1.2.8",
119
118
  "multiparty": "4.2.3",
120
119
  "netlify": "13.1.11",
121
120
  "netlify-headers-parser": "7.1.2",
@@ -1,3 +1,15 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _BaseCommand_noBaseOptions;
1
13
  import { existsSync } from 'fs';
2
14
  import { join, relative, resolve } from 'path';
3
15
  import process from 'process';
@@ -41,33 +53,22 @@ const HELP_SEPARATOR_WIDTH = 5;
41
53
  * workspace aware.
42
54
  */
43
55
  const COMMANDS_WITHOUT_WORKSPACE_OPTIONS = new Set(['api', 'recipes', 'completion', 'status', 'switch', 'login', 'lm']);
44
- /**
45
- * Formats a help list correctly with the correct indent
46
- * @param {string[]} textArray
47
- * @returns
48
- */
49
- // @ts-expect-error TS(7006) FIXME: Parameter 'textArray' implicitly has an 'any' type... Remove this comment to see the full error message
56
+ /** Formats a help list correctly with the correct indent */
50
57
  const formatHelpList = (textArray) => textArray.join('\n').replace(/^/gm, ' '.repeat(HELP_INDENT_WIDTH));
51
- /**
52
- * Get the duration between a start time and the current time
53
- * @param {bigint} startTime
54
- * @returns
55
- */
56
- // @ts-expect-error TS(7006) FIXME: Parameter 'startTime' implicitly has an 'any' type... Remove this comment to see the full error message
57
- const getDuration = function (startTime) {
58
+ /** Get the duration between a start time and the current time */
59
+ const getDuration = (startTime) => {
58
60
  const durationNs = process.hrtime.bigint() - startTime;
59
61
  return Math.round(Number(durationNs / BigInt(NANO_SECS_TO_MSECS)));
60
62
  };
61
63
  /**
62
64
  * Retrieves a workspace package based of the filter flag that is provided.
63
65
  * If the filter flag does not match a workspace package or is not defined then it will prompt with an autocomplete to select a package
64
- * @param {Project} project
65
- * @param {string=} filter
66
- * @returns {Promise<string>}
67
66
  */
68
- // @ts-expect-error TS(7006) FIXME: Parameter 'project' implicitly has an 'any' type.
69
67
  async function selectWorkspace(project, filter) {
70
- // @ts-expect-error TS(7006) FIXME: Parameter 'pkg' implicitly has an 'any' type.
68
+ // don't show prompt for workspace selection if there is only one package
69
+ if (project.workspace?.packages && project.workspace.packages.length === 1) {
70
+ return project.workspace.packages[0].path;
71
+ }
71
72
  const selected = project.workspace?.packages.find((pkg) => {
72
73
  if (project.relativeBaseDirectory &&
73
74
  project.relativeBaseDirectory.length !== 0 &&
@@ -86,9 +87,7 @@ async function selectWorkspace(project, filter) {
86
87
  message: 'Select the site you want to work with',
87
88
  // @ts-expect-error TS(7006) FIXME: Parameter '_' implicitly has an 'any' type.
88
89
  source: (/** @type {string} */ _, input = '') => (project.workspace?.packages || [])
89
- // @ts-expect-error TS(7006) FIXME: Parameter 'pkg' implicitly has an 'any' type.
90
90
  .filter((pkg) => pkg.path.includes(input))
91
- // @ts-expect-error TS(7006) FIXME: Parameter 'pkg' implicitly has an 'any' type.
92
91
  .map((pkg) => ({
93
92
  name: `${pkg.name ? `${chalk.bold(pkg.name)} ` : ''}${pkg.path} ${chalk.dim(`--filter ${pkg.name || pkg.path}`)}`,
94
93
  value: pkg.path,
@@ -105,10 +104,9 @@ async function getRepositoryRoot(cwd) {
105
104
  }
106
105
  }
107
106
  /** Base command class that provides tracking and config initialization */
108
- export default class BaseCommand extends Command {
107
+ class BaseCommand extends Command {
109
108
  constructor() {
110
109
  super(...arguments);
111
- /** @type {{ startTime: bigint, payload?: any}} */
112
110
  this.analytics = { startTime: process.hrtime.bigint() };
113
111
  /**
114
112
  * The working directory that is used for reading the `netlify.toml` file and storing the state.
@@ -118,18 +116,16 @@ export default class BaseCommand extends Command {
118
116
  // here we actually want to disable the lint rule as its value is set
119
117
  // eslint-disable-next-line workspace/no-process-cwd
120
118
  this.workingDir = process.cwd();
121
- /** @private */
122
- this.noBaseOptions = false;
123
- /** @type {string[]} The examples list for the command (used inside doc generation and help page) */
119
+ _BaseCommand_noBaseOptions.set(this, false
120
+ /** don't show help options on command overview (mostly used on top commands like `addons` where options only apply on children) */
121
+ );
122
+ /** The examples list for the command (used inside doc generation and help page) */
124
123
  this.examples = [];
125
124
  }
126
125
  /**
127
126
  * IMPORTANT this function will be called for each command!
128
127
  * Don't do anything expensive in there.
129
- * @param {string} name The command name
130
- * @returns
131
128
  */
132
- // @ts-expect-error TS(7006) FIXME: Parameter 'name' implicitly has an 'any' type.
133
129
  createCommand(name) {
134
130
  const base = new BaseCommand(name)
135
131
  // If --silent or --json flag passed disable logger
@@ -167,22 +163,15 @@ export default class BaseCommand extends Command {
167
163
  }
168
164
  /** don't show help options on command overview (mostly used on top commands like `addons` where options only apply on children) */
169
165
  noHelpOptions() {
170
- this.noBaseOptions = true;
166
+ __classPrivateFieldSet(this, _BaseCommand_noBaseOptions, true, "f");
171
167
  return this;
172
168
  }
173
- /**
174
- * Set examples for the command
175
- * @param {string[]} examples
176
- */
177
- // @ts-expect-error TS(7006) FIXME: Parameter 'examples' implicitly has an 'any' type.
169
+ /** Set examples for the command */
178
170
  addExamples(examples) {
179
171
  this.examples = examples;
180
172
  return this;
181
173
  }
182
- /**
183
- * Overrides the help output of commander with custom styling
184
- * @returns {import('commander').Help}
185
- */
174
+ /** Overrides the help output of commander with custom styling */
186
175
  createHelp() {
187
176
  const help = super.createHelp();
188
177
  help.commandUsage = (command) => {
@@ -209,12 +198,7 @@ export default class BaseCommand extends Command {
209
198
  .sort((a, b) => a.name().localeCompare(b.name())) || []);
210
199
  };
211
200
  help.longestSubcommandTermLength = (command) => getCommands(command).reduce((max, cmd) => Math.max(max, cmd.name().length), 0);
212
- /**
213
- * override the longestOptionTermLength to react on hide options flag
214
- * @param {BaseCommand} command
215
- * @param {import('commander').Help} helper
216
- * @returns {number}
217
- */
201
+ /** override the longestOptionTermLength to react on hide options flag */
218
202
  help.longestOptionTermLength = (command, helper) =>
219
203
  // @ts-expect-error TS(2551) FIXME: Property 'noBaseOptions' does not exist on type 'C... Remove this comment to see the full error message
220
204
  (command.noBaseOptions === false &&
@@ -224,14 +208,7 @@ export default class BaseCommand extends Command {
224
208
  const parentCommand = this.name() === 'netlify' ? command : command.parent;
225
209
  const termWidth = helper.padWidth(command, helper);
226
210
  const helpWidth = helper.helpWidth || FALLBACK_HELP_CMD_WIDTH;
227
- /**
228
- * formats a term correctly
229
- * @param {string} term
230
- * @param {string} [description]
231
- * @param {boolean} [isCommand]
232
- * @returns {string}
233
- */
234
- // @ts-expect-error TS(7006) FIXME: Parameter 'term' implicitly has an 'any' type.
211
+ // formats a term correctly
235
212
  const formatItem = (term, description, isCommand = false) => {
236
213
  const bang = isCommand ? `${HELP_$} ` : '';
237
214
  if (description) {
@@ -241,22 +218,17 @@ export default class BaseCommand extends Command {
241
218
  }
242
219
  return `${bang}${term}`;
243
220
  };
244
- /** @type {string[]} */
245
- // @ts-expect-error TS(7034) FIXME: Variable 'output' implicitly has type 'any[]' in s... Remove this comment to see the full error message
246
221
  let output = [];
247
222
  // Description
248
223
  const [topDescription, ...commandDescription] = (helper.commandDescription(command) || '').split('\n');
249
224
  if (topDescription.length !== 0) {
250
- // @ts-expect-error TS(7005) FIXME: Variable 'output' implicitly has an 'any[]' type.
251
225
  output = [...output, topDescription, ''];
252
226
  }
253
227
  // on the parent help command the version should be displayed
254
228
  if (this.name() === 'netlify') {
255
- // @ts-expect-error TS(7005) FIXME: Variable 'output' implicitly has an 'any[]' type.
256
229
  output = [...output, chalk.bold('VERSION'), formatHelpList([formatItem(USER_AGENT)]), ''];
257
230
  }
258
231
  // Usage
259
- // @ts-expect-error TS(7005) FIXME: Variable 'output' implicitly has an 'any[]' type.
260
232
  output = [...output, chalk.bold('USAGE'), helper.commandUsage(command), ''];
261
233
  // Arguments
262
234
  const argumentList = helper
@@ -265,7 +237,7 @@ export default class BaseCommand extends Command {
265
237
  if (argumentList.length !== 0) {
266
238
  output = [...output, chalk.bold('ARGUMENTS'), formatHelpList(argumentList), ''];
267
239
  }
268
- if (command.noBaseOptions === false) {
240
+ if (__classPrivateFieldGet(command, _BaseCommand_noBaseOptions, "f") === false) {
269
241
  // Options
270
242
  const optionList = helper
271
243
  .visibleOptions(command)
@@ -302,14 +274,9 @@ export default class BaseCommand extends Command {
302
274
  };
303
275
  return help;
304
276
  }
305
- /**
306
- * Will be called on the end of an action to track the metrics
307
- * @param {*} [error_]
308
- */
309
- // @ts-expect-error TS(7006) FIXME: Parameter 'error_' implicitly has an 'any' type.
277
+ /** Will be called on the end of an action to track the metrics */
310
278
  async onEnd(error_) {
311
- // @ts-expect-error TS(2339) FIXME: Property 'payload' does not exist on type '{ start... Remove this comment to see the full error message
312
- const { payload, startTime } = this.analytics;
279
+ const { payload = {}, startTime } = this.analytics;
313
280
  const duration = getDuration(startTime);
314
281
  const status = error_ === undefined ? 'success' : 'error';
315
282
  const command = Array.isArray(this.args) ? this.args[0] : this.name();
@@ -324,7 +291,6 @@ export default class BaseCommand extends Command {
324
291
  }
325
292
  catch { }
326
293
  if (error_ !== undefined) {
327
- // @ts-expect-error TS(2345) FIXME: Argument of type 'string | Error' is not assignabl... Remove this comment to see the full error message
328
294
  error(error_ instanceof Error ? error_ : format(error_), { exit: false });
329
295
  exit(1);
330
296
  }
@@ -387,23 +353,16 @@ export default class BaseCommand extends Command {
387
353
  log();
388
354
  return accessToken;
389
355
  }
390
- /**
391
- * Adds some data to the analytics payload
392
- * @param {Record<string, unknown>} payload
393
- */
394
- // @ts-expect-error TS(7006) FIXME: Parameter 'payload' implicitly has an 'any' type.
356
+ /** Adds some data to the analytics payload */
395
357
  setAnalyticsPayload(payload) {
396
- // @ts-expect-error TS(2339) FIXME: Property 'payload' does not exist on type '{ start... Remove this comment to see the full error message
397
- const newPayload = { ...this.analytics.payload, ...payload };
398
- // @ts-expect-error TS(2322) FIXME: Type '{ payload: any; startTime: bigint; }' is not... Remove this comment to see the full error message
399
- this.analytics = { ...this.analytics, payload: newPayload };
358
+ this.analytics = {
359
+ ...this.analytics,
360
+ payload: { ...this.analytics.payload, ...payload },
361
+ };
400
362
  }
401
363
  /**
402
364
  * Initializes the options and parses the configuration needs to be called on start of a command function
403
- * @param {BaseCommand} actionCommand The command of the action that is run (`this.` gets the parent command)
404
- * @private
405
365
  */
406
- // @ts-expect-error TS(7006) FIXME: Parameter 'actionCommand' implicitly has an 'any' ... Remove this comment to see the full error message
407
366
  async init(actionCommand) {
408
367
  debug(`${actionCommand.name()}:init`)('start');
409
368
  const flags = actionCommand.opts();
@@ -431,7 +390,6 @@ export default class BaseCommand extends Command {
431
390
  });
432
391
  });
433
392
  const frameworks = await this.project.detectFrameworks();
434
- /** @type { string|undefined} */
435
393
  let packageConfig = flags.config ? resolve(flags.config) : undefined;
436
394
  // check if we have detected multiple projects inside which one we have to perform our operations.
437
395
  // only ask to select one if on the workspace root
@@ -457,11 +415,8 @@ export default class BaseCommand extends Command {
457
415
  };
458
416
  if (process.env.NETLIFY_API_URL) {
459
417
  const apiUrl = new URL(process.env.NETLIFY_API_URL);
460
- // @ts-expect-error TS(2339) FIXME: Property 'scheme' does not exist on type '{ userAg... Remove this comment to see the full error message
461
418
  apiUrlOpts.scheme = apiUrl.protocol.slice(0, -1);
462
- // @ts-expect-error TS(2339) FIXME: Property 'host' does not exist on type '{ userAgen... Remove this comment to see the full error message
463
419
  apiUrlOpts.host = apiUrl.host;
464
- // @ts-expect-error TS(2339) FIXME: Property 'pathPrefix' does not exist on type '{ us... Remove this comment to see the full error message
465
420
  apiUrlOpts.pathPrefix =
466
421
  process.env.NETLIFY_API_URL === `${apiUrl.protocol}//${apiUrl.host}` ? '/api/v1' : apiUrl.pathname;
467
422
  }
@@ -486,6 +441,7 @@ export default class BaseCommand extends Command {
486
441
  certificateFile: flags.httpProxyCertificateFilename,
487
442
  });
488
443
  const apiOpts = { ...apiUrlOpts, agent };
444
+ // TODO: remove typecast once we have proper types for the API
489
445
  const api = new NetlifyAPI(token || '', apiOpts);
490
446
  // If a user passes a site name as an option instead of a site ID to options.site, the siteInfo object
491
447
  // will only have the property siteInfo.id. Checking for one of the other properties ensures that we can do
@@ -501,7 +457,6 @@ export default class BaseCommand extends Command {
501
457
  // ==================================================
502
458
  // Perform analytics reporting
503
459
  // ==================================================
504
- // @ts-expect-error TS(7006) FIXME: Parameter 'framework' implicitly has an 'any' type... Remove this comment to see the full error message
505
460
  const frameworkIDs = frameworks?.map((framework) => framework.id);
506
461
  if (frameworkIDs?.length !== 0) {
507
462
  this.setAnalyticsPayload({ frameworks: frameworkIDs });
@@ -509,7 +464,6 @@ export default class BaseCommand extends Command {
509
464
  this.setAnalyticsPayload({
510
465
  monorepo: Boolean(this.project.workspace),
511
466
  packageManager: this.project.packageManager?.name,
512
- // @ts-expect-error TS(7031) FIXME: Binding element 'id' implicitly has an 'any' type.
513
467
  buildSystem: this.project.buildSystems.map(({ id }) => id),
514
468
  });
515
469
  // set the project and the netlify api object on the command,
@@ -553,22 +507,7 @@ export default class BaseCommand extends Command {
553
507
  };
554
508
  debug(`${this.name()}:init`)('end');
555
509
  }
556
- /**
557
- * Find and resolve the Netlify configuration
558
- * @param {object} config
559
- * @param {string} config.cwd
560
- * @param {string|null=} config.token
561
- * @param {*} config.state
562
- * @param {boolean=} config.offline
563
- * @param {string=} config.configFilePath An optional path to the netlify configuration file e.g. netlify.toml
564
- * @param {string=} config.packagePath
565
- * @param {string=} config.repositoryRoot
566
- * @param {string=} config.host
567
- * @param {string=} config.pathPrefix
568
- * @param {string=} config.scheme
569
- * @returns {ReturnType<typeof resolveConfig>}
570
- */
571
- // @ts-expect-error TS(7023) FIXME: 'getConfig' implicitly has return type 'any' becau... Remove this comment to see the full error message
510
+ /** Find and resolve the Netlify configuration */
572
511
  async getConfig(config) {
573
512
  // the flags that are passed to the command like `--debug` or `--offline`
574
513
  const flags = this.opts();
@@ -617,10 +556,16 @@ export default class BaseCommand extends Command {
617
556
  * Returns the context that should be used in case one hasn't been explicitly
618
557
  * set. The default context is `dev` most of the time, but some commands may
619
558
  * wish to override that.
620
- *
621
- * @returns {'production' | 'dev'}
622
559
  */
623
560
  getDefaultContext() {
624
561
  return this.name() === 'serve' ? 'production' : 'dev';
625
562
  }
563
+ /**
564
+ * Retrieve feature flags for this site
565
+ */
566
+ getFeatureFlag(flagName) {
567
+ return this.netlify.siteInfo.feature_flags?.[flagName] || null;
568
+ }
626
569
  }
570
+ _BaseCommand_noBaseOptions = new WeakMap();
571
+ export default BaseCommand;
@@ -65,7 +65,6 @@ export const dev = async (options, command) => {
65
65
  const { api, cachedConfig, config, repositoryRoot, site, siteInfo, state } = command.netlify;
66
66
  config.dev = { ...config.dev };
67
67
  config.build = { ...config.build };
68
- /** @type {import('./types.js').DevConfig} */
69
68
  const devConfig = {
70
69
  framework: '#auto',
71
70
  autoLaunch: Boolean(options.open),
@@ -18,7 +18,6 @@ import { fileExistsAsync } from '../../lib/fs.js';
18
18
  import { getAddons, getCurrentAddon, getSiteData } from '../../utils/addons/prepare.js';
19
19
  import { NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, chalk, error, log } from '../../utils/command-helpers.js';
20
20
  import { getDotEnvVariables, injectEnvVariables } from '../../utils/dev.js';
21
- // @ts-expect-error TS(7034) FIXME: Variable 'execa' implicitly has type 'any' in some... Remove this comment to see the full error message
22
21
  import execa from '../../utils/execa.js';
23
22
  import { readRepoURL, validateRepoURL } from '../../utils/read-repo-url.js';
24
23
  const copyTemplateDir = promisify(copyTemplateDirOriginal);
@@ -364,7 +363,6 @@ const installDeps = async ({ functionPackageJson, functionPath, functionsDir })
364
363
  // of keeping that file in the function directory and running `npm install`
365
364
  // from there.
366
365
  if (!sitePackageJson) {
367
- // @ts-expect-error TS(7005) FIXME: Variable 'execa' implicitly has an 'any' type.
368
366
  await execa('npm', ['i', ...npmInstallFlags], { cwd: functionPath });
369
367
  return;
370
368
  }
@@ -373,11 +371,9 @@ const installDeps = async ({ functionPackageJson, functionPath, functionsDir })
373
371
  const devDependencies = getNpmInstallPackages(siteDevDependencies, functionDevDependencies);
374
372
  const npmInstallPath = path.dirname(sitePackageJson);
375
373
  if (dependencies.length !== 0) {
376
- // @ts-expect-error TS(7005) FIXME: Variable 'execa' implicitly has an 'any' type.
377
374
  await execa('npm', ['i', ...dependencies, '--save', ...npmInstallFlags], { cwd: npmInstallPath });
378
375
  }
379
376
  if (devDependencies.length !== 0) {
380
- // @ts-expect-error TS(7005) FIXME: Variable 'execa' implicitly has an 'any' type.
381
377
  await execa('npm', ['i', ...devDependencies, '--save-dev', ...npmInstallFlags], { cwd: npmInstallPath });
382
378
  }
383
379
  // We installed the function's dependencies in the site-level `package.json`,
@@ -193,7 +193,6 @@ or run ${chalk.cyanBright('netlify sites:create')} to create a site.`);
193
193
  catch (error_) {
194
194
  // @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
195
195
  if (error_.status === 404) {
196
- // @ts-expect-error TS(2345) FIXME: Argument of type 'Error' is not assignable to para... Remove this comment to see the full error message
197
196
  error(new Error(`Site ID '${siteId}' not found`));
198
197
  }
199
198
  else {
@@ -207,7 +206,6 @@ or run ${chalk.cyanBright('netlify sites:create')} to create a site.`);
207
206
  return;
208
207
  }
209
208
  if (!site) {
210
- // @ts-expect-error TS(2345) FIXME: Argument of type 'Error' is not assignable to para... Remove this comment to see the full error message
211
209
  error(new Error(`No site found`));
212
210
  }
213
211
  // Save site ID to config
@@ -253,7 +251,6 @@ export const link = async (options, command) => {
253
251
  catch (error_) {
254
252
  // @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
255
253
  if (error_.status === 404) {
256
- // @ts-expect-error TS(2345) FIXME: Argument of type 'Error' is not assignable to para... Remove this comment to see the full error message
257
254
  error(new Error(`Site id ${options.id} not found`));
258
255
  }
259
256
  else {
@@ -284,7 +281,6 @@ export const link = async (options, command) => {
284
281
  catch (error_) {
285
282
  // @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
286
283
  if (error_.status === 404) {
287
- // @ts-expect-error TS(2345) FIXME: Argument of type 'Error' is not assignable to para... Remove this comment to see the full error message
288
284
  error(new Error(`${options.name} not found`));
289
285
  }
290
286
  else {
@@ -293,7 +289,6 @@ export const link = async (options, command) => {
293
289
  }
294
290
  }
295
291
  if (results.length === 0) {
296
- // @ts-expect-error TS(2345) FIXME: Argument of type 'Error' is not assignable to para... Remove this comment to see the full error message
297
292
  error(new Error(`No sites found named ${options.name}`));
298
293
  }
299
294
  const [firstSiteData] = results;
@@ -1,6 +1,5 @@
1
1
  import { Listr } from 'listr2';
2
2
  import { error } from '../../utils/command-helpers.js';
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
3
  import execa from '../../utils/execa.js';
5
4
  import { installPlatform } from '../../utils/lm/install.js';
6
5
  import { checkHelperVersion } from '../../utils/lm/requirements.js';
@@ -45,7 +44,6 @@ const provisionService = async function (siteId, api) {
45
44
  const configureLFSURL = async function (siteId, api) {
46
45
  const siteInfo = await api.getSite({ siteId });
47
46
  const url = `https://${siteInfo.id_domain}/.netlify/large-media`;
48
- // @ts-expect-error TS(7005) FIXME: Variable 'execa' implicitly has an 'any' type.
49
47
  return execa('git', ['config', '-f', '.lfsconfig', 'lfs.url', url]);
50
48
  };
51
49
  export const lmSetup = async (options, command) => {
@@ -5,7 +5,6 @@ import envinfo from 'envinfo';
5
5
  import { closest } from 'fastest-levenshtein';
6
6
  import inquirer from 'inquirer';
7
7
  import { BANG, chalk, error, exit, log, NETLIFY_CYAN, USER_AGENT, warn } from '../utils/command-helpers.js';
8
- // @ts-expect-error TS(7034) FIXME: Variable 'execa' implicitly has type 'any' in some... Remove this comment to see the full error message
9
8
  import execa from '../utils/execa.js';
10
9
  import getGlobalConfig from '../utils/get-global-config.js';
11
10
  import getPackageJson from '../utils/get-package-json.js';
@@ -138,7 +137,6 @@ const mainCommand = async function (options, command) {
138
137
  if (!applySuggestion) {
139
138
  error(`Run ${NETLIFY_CYAN(`${command.name()} help`)} for a list of available commands.`);
140
139
  }
141
- // @ts-expect-error TS(7005) FIXME: Variable 'execa' implicitly has an 'any' type.
142
140
  await execa(process.argv[0], [process.argv[1], suggestion], { stdio: 'inherit' });
143
141
  };
144
142
  /**
@@ -16,7 +16,6 @@ export const serve = async (options, command) => {
16
16
  const { api, cachedConfig, config, repositoryRoot, site, siteInfo, state } = command.netlify;
17
17
  config.dev = { ...config.dev };
18
18
  config.build = { ...config.build };
19
- /** @type {import('../dev/types').DevConfig} */
20
19
  const devConfig = {
21
20
  ...(config.functionsDirectory && { functions: config.functionsDirectory }),
22
21
  ...(config.build.publish && { publish: config.build.publish }),
@@ -4,7 +4,6 @@ import pick from 'lodash/pick.js';
4
4
  import parseGitHubUrl from 'parse-github-url';
5
5
  import { render } from 'prettyjson';
6
6
  import { chalk, error, getTerminalLink, log, logJson, warn } from '../../utils/command-helpers.js';
7
- // @ts-expect-error TS(7034) FIXME: Variable 'execa' implicitly has type 'any' in some... Remove this comment to see the full error message
8
7
  import execa from '../../utils/execa.js';
9
8
  import getRepoData from '../../utils/get-repo-data.js';
10
9
  import { getGitHubToken } from '../../utils/init/config-github.js';
@@ -166,9 +165,7 @@ export const sitesCreateTemplate = async (repository, options, command) => {
166
165
  });
167
166
  if (cloneConfirm) {
168
167
  log();
169
- // @ts-expect-error TS(7005) FIXME: Variable 'execa' implicitly has an 'any' type.
170
168
  await execa('git', ['clone', repoResp.clone_url, `${repoResp.name}`]);
171
- // @ts-expect-error TS(2532) FIXME: Object is possibly 'undefined'.
172
169
  log(`🚀 Repository cloned successfully. You can find it under the ${chalk.magenta(repoResp.name)} folder`);
173
170
  }
174
171
  if (options.withCi) {
@@ -4,7 +4,6 @@ import { fetchLatest, fetchVersion, newerVersion, updateAvailable } from 'gh-rel
4
4
  // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'isex... Remove this comment to see the full error message
5
5
  import isExe from 'isexe';
6
6
  import { NETLIFYDEVWARN, error, getTerminalLink, log } from '../utils/command-helpers.js';
7
- // @ts-expect-error TS(7034) FIXME: Variable 'execa' implicitly has type 'any' in some... Remove this comment to see the full error message
8
7
  import execa from '../utils/execa.js';
9
8
  const isWindows = () => process.platform === 'win32';
10
9
  // @ts-expect-error TS(7031) FIXME: Binding element 'packageName' implicitly has an 'a... Remove this comment to see the full error message
@@ -47,7 +46,6 @@ pattern, }) => {
47
46
  if (!exists) {
48
47
  return true;
49
48
  }
50
- // @ts-expect-error TS(7005) FIXME: Variable 'execa' implicitly has an 'any' type.
51
49
  const { stdout } = await execa(execPath, execArgs);
52
50
  if (!stdout) {
53
51
  return false;
@@ -1,7 +1,6 @@
1
1
  import { stdout } from 'process';
2
2
  // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module '@net... Remove this comment to see the full error message
3
3
  import { getBinaryPath as getFunctionsProxyPath } from '@netlify/local-functions-proxy';
4
- // @ts-expect-error TS(7034) FIXME: Variable 'execa' implicitly has type 'any' in some... Remove this comment to see the full error message
5
4
  import execa from '../../utils/execa.js';
6
5
  // @ts-expect-error TS(7031) FIXME: Binding element 'binaryPath' implicitly has an 'an... Remove this comment to see the full error message
7
6
  export const runFunctionsProxy = ({ binaryPath, context, directory, event, name, timeout }) => {
@@ -34,8 +33,7 @@ export const runFunctionsProxy = ({ binaryPath, context, directory, event, name,
34
33
  '--timeout',
35
34
  `${timeout}s`,
36
35
  ];
37
- // @ts-expect-error TS(7005) FIXME: Variable 'execa' implicitly has an 'any' type.
38
36
  const proxyProcess = execa(functionsProxyPath, parameters);
39
- proxyProcess.stderr.pipe(stdout);
37
+ proxyProcess.stderr?.pipe(stdout);
40
38
  return proxyProcess;
41
39
  };
@@ -81,7 +81,7 @@ export default class NetlifyFunction {
81
81
  return '.mts';
82
82
  }
83
83
  if (extension === '.js') {
84
- return '.js';
84
+ return '.mjs';
85
85
  }
86
86
  }
87
87
  hasValidName() {
@@ -1,7 +1,6 @@
1
1
  import { dirname, extname } from 'path';
2
2
  import { platform } from 'process';
3
3
  import { temporaryFile } from 'tempy';
4
- // @ts-expect-error TS(7034) FIXME: Variable 'execa' implicitly has type 'any' in some... Remove this comment to see the full error message
5
4
  import execa from '../../../../utils/execa.js';
6
5
  import { runFunctionsProxy } from '../../local-proxy.js';
7
6
  const isWindows = platform === 'win32';
@@ -9,7 +8,6 @@ export const name = 'go';
9
8
  // @ts-expect-error TS(7031) FIXME: Binding element 'binaryPath' implicitly has an 'an... Remove this comment to see the full error message
10
9
  const build = async ({ binaryPath, functionDirectory }) => {
11
10
  try {
12
- // @ts-expect-error TS(7005) FIXME: Variable 'execa' implicitly has an 'any' type.
13
11
  await execa('go', ['build', '-o', binaryPath], { cwd: functionDirectory });
14
12
  return { binaryPath, srcFiles: [functionDirectory] };
15
13
  }
@@ -24,7 +22,6 @@ const build = async ({ binaryPath, functionDirectory }) => {
24
22
  // @ts-expect-error TS(7031) FIXME: Binding element 'cwd' implicitly has an 'any' type... Remove this comment to see the full error message
25
23
  const checkGoInstallation = async ({ cwd }) => {
26
24
  try {
27
- // @ts-expect-error TS(7005) FIXME: Variable 'execa' implicitly has an 'any' type.
28
25
  await execa('go', ['version'], { cwd });
29
26
  return true;
30
27
  }
@@ -1,7 +1,6 @@
1
1
  import { readFile } from 'fs/promises';
2
2
  import { resolve } from 'path';
3
- import minimist from 'minimist';
4
- // @ts-expect-error TS(7034) FIXME: Variable 'execa' implicitly has type 'any' in some... Remove this comment to see the full error message
3
+ import { program } from 'commander';
5
4
  import execa from '../../../../../utils/execa.js';
6
5
  import { fileExistsAsync } from '../../../../fs.js';
7
6
  import { memoizedBuild } from '../../../memoized-build.js';
@@ -15,18 +14,19 @@ export const detectNetlifyLambda = async function ({ packageJson } = {}) {
15
14
  const matchingScripts = Object.entries(scripts).filter(([, script]) => script.match(/netlify-lambda\s+build/));
16
15
  for (const [key, script] of matchingScripts) {
17
16
  // E.g. ["netlify-lambda", "build", "functions/folder"]
18
- // @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
19
- const match = minimist(script.split(' '), {
20
- // these are all valid options for netlify-lambda
21
- boolean: ['s', 'static'],
22
- string: ['c', 'config', 'p', 'port', 'b', 'babelrc', 't', 'timeout'],
23
- });
17
+ // these are all valid options for netlify-lambda
18
+ program
19
+ .option('-s, --static')
20
+ .option('-c, --config [file]')
21
+ .option('-p, --port [number]')
22
+ .option('-b, --babelrc [file]')
23
+ .option('-t, --timeout [delay]');
24
+ program.parse(script.split(' ') ?? []);
24
25
  // We are not interested in 'netlify-lambda' and 'build' commands
25
- const functionDirectories = match._.slice(2);
26
+ const functionDirectories = program.args.filter((arg) => !['netlify-lambda', 'build'].includes(arg));
26
27
  if (functionDirectories.length === 1) {
27
28
  const srcFiles = [resolve(functionDirectories[0])];
28
29
  const yarnExists = await fileExistsAsync('yarn.lock');
29
- // @ts-expect-error TS(7005) FIXME: Variable 'execa' implicitly has an 'any' type.
30
30
  const buildCommand = () => execa(yarnExists ? 'yarn' : 'npm', ['run', key]);
31
31
  return {
32
32
  build: async ({ cache = {} } = {}) => {