netlify-cli 17.13.2 → 17.14.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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
- "version": "17.13.2",
3
+ "version": "17.14.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "netlify-cli",
9
- "version": "17.13.2",
9
+ "version": "17.14.0",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
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.13.2",
4
+ "version": "17.14.0",
5
5
  "author": "Netlify Inc.",
6
6
  "type": "module",
7
7
  "engines": {
@@ -23,7 +23,6 @@ import { readRepoURL, validateRepoURL } from '../../utils/read-repo-url.js';
23
23
  const copyTemplateDir = promisify(copyTemplateDirOriginal);
24
24
  const require = createRequire(import.meta.url);
25
25
  const templatesDir = path.resolve(dirname(fileURLToPath(import.meta.url)), '../../functions-templates');
26
- const showRustTemplates = process.env.NETLIFY_EXPERIMENTAL_BUILD_RUST_SOURCE === 'true';
27
26
  /**
28
27
  * Ensure that there's a sub-directory in `src/functions-templates` named after
29
28
  * each `value` property in this list.
@@ -32,7 +31,7 @@ const languages = [
32
31
  { name: 'JavaScript', value: 'javascript' },
33
32
  { name: 'TypeScript', value: 'typescript' },
34
33
  { name: 'Go', value: 'go' },
35
- showRustTemplates && { name: 'Rust', value: 'rust' },
34
+ { name: 'Rust', value: 'rust' },
36
35
  ];
37
36
  /**
38
37
  * prompt for a name if name not supplied
@@ -153,11 +152,9 @@ const pickTemplate = async function ({ language: languageFromFlag }, funcType) {
153
152
  let language = languageFromFlag;
154
153
  if (language === undefined) {
155
154
  const langs = funcType === 'edge'
156
- ? // @ts-expect-error TS(2339) FIXME: Property 'value' does not exist on type 'false | {... Remove this comment to see the full error message
157
- languages.filter((lang) => lang.value === 'javascript' || lang.value === 'typescript')
155
+ ? languages.filter((lang) => lang.value === 'javascript' || lang.value === 'typescript')
158
156
  : languages.filter(Boolean);
159
157
  const { language: languageFromPrompt } = await inquirer.prompt({
160
- // @ts-expect-error
161
158
  choices: langs,
162
159
  message: 'Select the language of your function',
163
160
  name: 'language',
@@ -202,7 +199,7 @@ const DEFAULT_PRIORITY = 999;
202
199
  const selectTypeOfFunc = async () => {
203
200
  const functionTypes = [
204
201
  { name: 'Edge function (Deno)', value: 'edge' },
205
- { name: 'Serverless function (Node/Go)', value: 'serverless' },
202
+ { name: 'Serverless function (Node/Go/Rust)', value: 'serverless' },
206
203
  ];
207
204
  const { functionType } = await inquirer.prompt([
208
205
  {
@@ -468,6 +465,11 @@ const scaffoldFromTemplate = async function (command, options, argumentName, fun
468
465
  }
469
466
  await installAddons(command, addons, path.resolve(functionPath));
470
467
  await handleOnComplete({ command, onComplete });
468
+ log();
469
+ log(chalk.greenBright(`Function created!`));
470
+ if (lang == 'rust') {
471
+ log(chalk.green(`Please note that Rust functions require setting the NETLIFY_EXPERIMENTAL_BUILD_RUST_SOURCE environment variable to 'true' on your site.`));
472
+ }
471
473
  }
472
474
  };
473
475
  const TEMPLATE_PERMISSIONS = 0o777;
@@ -1,7 +1,7 @@
1
1
  use aws_lambda_events::event::apigw::{ApiGatewayProxyRequest, ApiGatewayProxyResponse};
2
2
  use aws_lambda_events::encodings::Body;
3
3
  use http::header::HeaderMap;
4
- use lambda_runtime::{handler_fn, Context, Error};
4
+ use lambda_runtime::{service_fn, Error, LambdaEvent};
5
5
  use log::LevelFilter;
6
6
  use simple_logger::SimpleLogger;
7
7
 
@@ -9,13 +9,13 @@ use simple_logger::SimpleLogger;
9
9
  async fn main() -> Result<(), Error> {
10
10
  SimpleLogger::new().with_utc_timestamps().with_level(LevelFilter::Info).init().unwrap();
11
11
 
12
- let func = handler_fn(my_handler);
12
+ let func = service_fn(my_handler);
13
13
  lambda_runtime::run(func).await?;
14
14
  Ok(())
15
15
  }
16
16
 
17
- pub(crate) async fn my_handler(event: ApiGatewayProxyRequest, _ctx: Context) -> Result<ApiGatewayProxyResponse, Error> {
18
- let path = event.path.unwrap();
17
+ pub(crate) async fn my_handler(event: LambdaEvent<ApiGatewayProxyRequest>) -> Result<ApiGatewayProxyResponse, Error> {
18
+ let path = event.payload.path.unwrap();
19
19
 
20
20
  let resp = ApiGatewayProxyResponse {
21
21
  status_code: 200,