Skip to content

Commit

Permalink
[#4009] Update samples to support latest Node version - TypeScript (#…
Browse files Browse the repository at this point in the history
…4011)

* Update default Node version to 20

* Upgrade restify version

* Fix issue async function & new version of restify

* Update default value for Stack en linux

* Update README files

* Update botbuilder version in TS samples

* Add esModuleInterop in the missing tsconfigs

---------

Co-authored-by: Ivan K Berlot <ivanberlot@gmail.com>
  • Loading branch information
ceciliaavila and iberlot authored Sep 25, 2024
1 parent 75fccfb commit e5b6d01
Show file tree
Hide file tree
Showing 48 changed files with 89 additions and 81 deletions.
2 changes: 1 addition & 1 deletion samples/typescript_nodejs/00.empty-bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This bot has been created using [Bot Framework](https://dev.botframework.com), i

## Prerequisites

- [Node.js](https://nodejs.org) version 10.14.1 or higher
- [Node.js](https://nodejs.org) version 18 or higher

```bash
# determine node version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
6 changes: 3 additions & 3 deletions samples/typescript_nodejs/00.empty-bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
"url": "https://github.com"
},
"dependencies": {
"botbuilder": "~4.22.1",
"botbuilder": "~4.23.0",
"replace": "~1.2.0",
"restify": "~8.6.0"
"restify": "~10.0.0"
},
"devDependencies": {
"@types/restify": "8.4.2",
"@types/restify": "8.5.12",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"eslint": "^8.57.0",
Expand Down
4 changes: 2 additions & 2 deletions samples/typescript_nodejs/00.empty-bot/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ adapter.onTurnError = async (context, error) => {
const myBot = new EmptyBot();

// Listen for incoming requests.
server.post('/api/messages', async (req, res) => {
server.post('/api/messages', (req, res, next) => {
// Route received a request to adapter for processing
await adapter.process(req, res, (context) => myBot.run(context));
adapter.process(req, res, async (context) => await myBot.run(context));
});
3 changes: 2 additions & 1 deletion samples/typescript_nodejs/00.empty-bot/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"rootDir": "./src",
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo"
"tsBuildInfoFile": "./lib/.tsbuildinfo",
"esModuleInterop": true
}
}
2 changes: 1 addition & 1 deletion samples/typescript_nodejs/01.console-echo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This bot has been created using [Bot Framework](https://dev.botframework.com), i

## Prerequisites

- [Node.js](https://nodejs.org) version 10.14.1 or higher
- [Node.js](https://nodejs.org) version 18 or higher

```bash
# determine node version
Expand Down
2 changes: 1 addition & 1 deletion samples/typescript_nodejs/01.console-echo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"watch": "nodemon --watch ./src -e ts --exec \"npm run start\""
},
"dependencies": {
"botbuilder": "~4.22.1",
"botbuilder": "~4.23.0",
"readline": "^1.3.0"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion samples/typescript_nodejs/01.console-echo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"sourceMap": true,
"strict": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo"
"tsBuildInfoFile": "./lib/.tsbuildinfo",
"esModuleInterop": true
}
}
2 changes: 1 addition & 1 deletion samples/typescript_nodejs/02.echo-bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This bot has been created using [Bot Framework](https://dev.botframework.com), i

## Prerequisites

- [Node.js](https://nodejs.org) version 10.14.1 or higher
- [Node.js](https://nodejs.org) version 18 or higher

```bash
# determine node version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
},
"linuxFxVersion": {
"type": "string",
"defaultValue": "NODE|16"
"defaultValue": "NODE|20-LTS"
},
"appId": {
"type": "string",
Expand Down Expand Up @@ -137,7 +137,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"linuxFxVersion": {
"type": "string",
"defaultValue": "NODE|16"
"defaultValue": "NODE|20-LTS"
},
"appId": {
"type": "string",
Expand Down Expand Up @@ -156,7 +156,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
6 changes: 3 additions & 3 deletions samples/typescript_nodejs/02.echo-bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"url": "https://github.com"
},
"dependencies": {
"botbuilder": "~4.22.1",
"botbuilder": "~4.23.0",
"dotenv": "^8.2.0",
"replace": "^1.2.0",
"restify": "~8.6.0"
"restify": "~10.0.0"
},
"devDependencies": {
"@types/dotenv": "6.1.1",
"@types/node": "^16.11.6",
"@types/restify": "8.4.2",
"@types/restify": "8.5.12",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"eslint": "^8.57.0",
Expand Down
4 changes: 2 additions & 2 deletions samples/typescript_nodejs/02.echo-bot/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ adapter.onTurnError = onTurnErrorHandler;
const myBot = new EchoBot();

// Listen for incoming requests.
server.post('/api/messages', async (req, res) => {
server.post('/api/messages', (req, res, next) => {
// Route received a request to adapter for processing
await adapter.process(req, res, (context) => myBot.run(context));
adapter.process(req, res, async (context) => await myBot.run(context));
});

// Listen for Upgrade requests for Streaming.
Expand Down
3 changes: 2 additions & 1 deletion samples/typescript_nodejs/02.echo-bot/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"rootDir": "./src",
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo"
"tsBuildInfoFile": "./lib/.tsbuildinfo",
"esModuleInterop": true
}
}
2 changes: 1 addition & 1 deletion samples/typescript_nodejs/03.welcome-users/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This bot has been created using [Bot Framework](https://dev.botframework.com), i

## Prerequisites

- [Node.js](https://nodejs.org) version 10.14.1 or higher
- [Node.js](https://nodejs.org) version 18 or higher

```bash
# determine node version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
6 changes: 3 additions & 3 deletions samples/typescript_nodejs/03.welcome-users/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
"url": "https://github.com"
},
"dependencies": {
"botbuilder": "~4.22.1",
"botbuilder": "~4.23.0",
"replace": "~1.2.0",
"restify": "~8.6.0"
"restify": "~10.0.0"
},
"devDependencies": {
"@types/restify": "8.4.2",
"@types/restify": "8.5.12",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"eslint": "^8.57.0",
Expand Down
4 changes: 2 additions & 2 deletions samples/typescript_nodejs/03.welcome-users/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const userState = new UserState(memoryStorage);
const myBot = new WelcomeBot(userState);

// Listen for incoming requests.
server.post('/api/messages', async (req, res) => {
server.post('/api/messages', (req, res, next) => {
// Route received a request to adapter for processing
await adapter.process(req, res, (context) => myBot.run(context));
adapter.process(req, res, async (context) => await myBot.run(context));
});
3 changes: 2 additions & 1 deletion samples/typescript_nodejs/03.welcome-users/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"rootDir": "./src",
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo"
"tsBuildInfoFile": "./lib/.tsbuildinfo",
"esModuleInterop": true
}
}
2 changes: 1 addition & 1 deletion samples/typescript_nodejs/05.multi-turn-prompt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This bot has been created using [Bot Framework](https://dev.botframework.com), i

## Prerequisites

- [Node.js](https://nodejs.org) version 10.14 or higher
- [Node.js](https://nodejs.org) version 18 or higher

```bash
# determine node version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
8 changes: 4 additions & 4 deletions samples/typescript_nodejs/05.multi-turn-prompt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
"url": "https://github.com"
},
"dependencies": {
"botbuilder": "~4.22.1",
"botbuilder-dialogs": "~4.22.1",
"botbuilder": "~4.23.0",
"botbuilder-dialogs": "~4.23.0",
"dotenv": "^8.2.0",
"replace": "~1.2.0",
"restify": "~8.6.0"
"restify": "~10.0.0"
},
"devDependencies": {
"@types/restify": "8.4.2",
"@types/restify": "8.5.12",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"eslint": "^8.57.0",
Expand Down
4 changes: 2 additions & 2 deletions samples/typescript_nodejs/05.multi-turn-prompt/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ server.listen(process.env.port || process.env.PORT || 3978, () => {
});

// Listen for incoming requests.
server.post('/api/messages', async (req, res) => {
server.post('/api/messages', (req, res, next) => {
// Route received a request to adapter for processing
await adapter.process(req, res, (context) => bot.run(context));
adapter.process(req, res, async (context) => await bot.run(context));
});
3 changes: 2 additions & 1 deletion samples/typescript_nodejs/05.multi-turn-prompt/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"rootDir": "./src",
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo"
"tsBuildInfoFile": "./lib/.tsbuildinfo",
"esModuleInterop": true
}
}
2 changes: 1 addition & 1 deletion samples/typescript_nodejs/06.using-cards/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This bot has been created using [Microsoft Bot Framework][1], it shows how to cr

## Prerequisites

- [Node.js](https://nodejs.org) version 10.14 or higher
- [Node.js](https://nodejs.org) version 18 or higher

```bash
# determine node version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
8 changes: 4 additions & 4 deletions samples/typescript_nodejs/06.using-cards/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
"url": "https://github.com"
},
"dependencies": {
"botbuilder": "~4.22.1",
"botbuilder-dialogs": "~4.22.1",
"botbuilder": "~4.23.0",
"botbuilder-dialogs": "~4.23.0",
"dotenv": "^8.2.0",
"replace": "~1.2.0",
"restify": "~8.6.0"
"restify": "~10.0.0"
},
"devDependencies": {
"@types/restify": "8.4.2",
"@types/restify": "8.5.12",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"eslint": "^8.57.0",
Expand Down
4 changes: 2 additions & 2 deletions samples/typescript_nodejs/06.using-cards/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ server.listen(process.env.port || process.env.PORT || 3978, () => {
});

// Listen for incoming activities and route them to your bot main dialog.
server.post('/api/messages', async (req, res) => {
server.post('/api/messages', (req, res, next) => {
// Route received a request to adapter for processing
await adapter.process(req, res, (context) => bot.run(context));
adapter.process(req, res, async (context) => await bot.run(context));
});
2 changes: 1 addition & 1 deletion samples/typescript_nodejs/13.core-bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This sample **requires** prerequisites in order to run.
### Overview
This bot uses [LUIS](https://www.luis.ai), an AI based cognitive service, to implement language understanding.

- [Node.js](https://nodejs.org) version 10.14 or higher
- [Node.js](https://nodejs.org) version 18 or higher

```bash
# determine node version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
Loading

0 comments on commit e5b6d01

Please sign in to comment.