Skip to content

Commit

Permalink
Bump platformVersion to 2023.2 (#19)
Browse files Browse the repository at this point in the history
* Bump to platformVersion 2023.2

* Bump node runtime to 18

* Use async/await

* Remove runtime and version

* Update example functions to use async

---------

Co-authored-by: Camden Phalen <[email protected]>
Co-authored-by: Hugh McDonald <[email protected]>
  • Loading branch information
3 people authored Nov 21, 2023
1 parent ff115c3 commit 4e5dd8e
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 26 deletions.
8 changes: 2 additions & 6 deletions components/example-app/app.functions/example-function.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
exports.main = (context = {}, sendResponse) => {
exports.main = async (context = {}) => {
const { text } = context.parameters;

const response = `This is coming from a serverless function! You entered: ${text}`;

try {
sendResponse(response);
} catch (error) {
sendResponse(error);
}
return response;
};
2 changes: 0 additions & 2 deletions components/example-app/app.functions/serverless.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"runtime": "nodejs16.x",
"version": "1.0",
"appFunctions": {
"myFunc": {
"file": "example-function.js",
Expand Down
7 changes: 3 additions & 4 deletions components/example-app/extensions/Example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ const Extension = ({ context, runServerless, sendAlert }) => {

// Call serverless function to execute with parameters.
// The `myFunc` function name is configured inside `serverless.json`
const handleClick = () => {
runServerless({ name: "myFunc", parameters: { text: text } }).then((resp) =>
sendAlert({ message: resp.response })
);
const handleClick = async () => {
const { response } = await runServerless({ name: "myFunc", parameters: { text: text } });
sendAlert({ message: response });
};

return (
Expand Down
2 changes: 1 addition & 1 deletion projects/getting-started-template/hsproject.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Get Started Project",
"srcDir": "src",
"platformVersion": "2023.1"
"platformVersion": "2023.2"
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
exports.main = (context = {}, sendResponse) => {
exports.main = async (context = {}) => {
const { text } = context.parameters;

const response = `This is coming from a serverless function! You entered: ${text}`;

try {
sendResponse(response);
} catch (error) {
sendResponse(error);
}
return response;
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"runtime": "nodejs16.x",
"version": "1.0",
"appFunctions": {
"myFunc": {
"file": "example-function.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ const Extension = ({ context, runServerless, sendAlert }) => {

// Call serverless function to execute with parameters.
// The `myFunc` function name is configured inside `serverless.json`
const handleClick = () => {
runServerless({ name: "myFunc", parameters: { text: text } }).then((resp) =>
sendAlert({ message: resp.response })
);
const handleClick = async () => {
const { response } = await runServerless({ name: "myFunc", parameters: { text: text } });
sendAlert({ message: response });
};

return (
Expand Down
2 changes: 1 addition & 1 deletion projects/no-template/hsproject.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Empty Project",
"srcDir": "src",
"platformVersion": "2023.1"
"platformVersion": "2023.2"
}

0 comments on commit 4e5dd8e

Please sign in to comment.