Skip to content

Commit 604e190

Browse files
bump: [#4550] Add Node 18 and 20 support (#4726)
* Add Node 18 and 20 support * Fix CI and functional pipelines --------- Co-authored-by: JhontSouth <[email protected]>
1 parent 0f1dd7e commit 604e190

File tree

35 files changed

+1188
-248
lines changed

35 files changed

+1188
-248
lines changed

.github/workflows/depcheck.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v2
2323

24-
- name: use node 16.x
24+
- name: use node 20.x
2525
uses: actions/setup-node@v2-beta
2626
with:
27-
node-version: 16.x
27+
node-version: 20.x
2828

2929
- name: yarn cache dir
3030
id: yarn-cache-dir
@@ -33,7 +33,7 @@ jobs:
3333
- uses: actions/cache@v2
3434
with:
3535
path: ${{ steps.yarn-cache-dir.outputs.dir }}
36-
key: ${{ runner.os }}-node16.x-yarn-${{ hashFiles('**/yarn.lock') }}
36+
key: ${{ runner.os }}-node20.x-yarn-${{ hashFiles('**/yarn.lock') }}
3737

3838
- name: yarn
3939
run: yarn --frozen-lockfile

.github/workflows/lint.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v2
2323

24-
- name: use node 16.x
24+
- name: use node 20.x
2525
uses: actions/setup-node@v2-beta
2626
with:
27-
node-version: 16.x
27+
node-version: 20.x
2828

2929
- name: yarn cache dir
3030
id: yarn-cache-dir
@@ -33,7 +33,7 @@ jobs:
3333
- uses: actions/cache@v2
3434
with:
3535
path: ${{ steps.yarn-cache-dir.outputs.dir }}
36-
key: ${{ runner.os }}-node16.x-yarn-${{ hashFiles('**/yarn.lock') }}
36+
key: ${{ runner.os }}-node20.x-yarn-${{ hashFiles('**/yarn.lock') }}
3737

3838
- name: yarn
3939
run: yarn --frozen-lockfile

.github/workflows/test-compat.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v2
2323

24-
- name: use node 16.x
24+
- name: use node 20.x
2525
uses: actions/setup-node@v2-beta
2626
with:
27-
node-version: 16.x
27+
node-version: 20.x
2828

2929
- name: yarn cache dir
3030
id: yarn-cache-dir
@@ -33,7 +33,7 @@ jobs:
3333
- uses: actions/cache@v2
3434
with:
3535
path: ${{ steps.yarn-cache-dir.outputs.dir }}
36-
key: ${{ runner.os }}-node16.x-yarn-${{ hashFiles('**/yarn.lock') }}
36+
key: ${{ runner.os }}-node20.x-yarn-${{ hashFiles('**/yarn.lock') }}
3737

3838
- name: yarn
3939
run: yarn --frozen-lockfile

.github/workflows/test-consumer.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v2
2323

24-
- name: use node 16.x
24+
- name: use node 20.x
2525
uses: actions/setup-node@v2-beta
2626
with:
27-
node-version: 16.x
27+
node-version: 20.x
2828

2929
- name: yarn cache dir
3030
id: yarn-cache-dir
@@ -33,7 +33,7 @@ jobs:
3333
- uses: actions/cache@v2
3434
with:
3535
path: ${{ steps.yarn-cache-dir.outputs.dir }}
36-
key: ${{ runner.os }}-node16.x-yarn-${{ hashFiles('**/yarn.lock') }}
36+
key: ${{ runner.os }}-node20.x-yarn-${{ hashFiles('**/yarn.lock') }}
3737

3838
- name: yarn
3939
run: yarn --frozen-lockfile

.github/workflows/test-repoutils.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v2
2323

24-
- name: use node 16.x
24+
- name: use node 20.x
2525
uses: actions/setup-node@v2-beta
2626
with:
27-
node-version: 16.x
27+
node-version: 20.x
2828

2929
- name: yarn cache dir
3030
id: yarn-cache-dir
@@ -33,7 +33,7 @@ jobs:
3333
- uses: actions/cache@v2
3434
with:
3535
path: ${{ steps.yarn-cache-dir.outputs.dir }}
36-
key: ${{ runner.os }}-node16.x-yarn-${{ hashFiles('**/yarn.lock') }}
36+
key: ${{ runner.os }}-node20.x-yarn-${{ hashFiles('**/yarn.lock') }}
3737

3838
- name: yarn
3939
run: yarn --frozen-lockfile

.github/workflows/test-schemas.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v2
2323

24-
- name: use node 14.x
24+
- name: use node 20.x
2525
uses: actions/setup-node@v2-beta
2626
with:
27-
node-version: 14.x
27+
node-version: 20.x
2828

2929
- name: yarn cache dir
3030
id: yarn-cache-dir
@@ -33,7 +33,10 @@ jobs:
3333
- uses: actions/cache@v2
3434
with:
3535
path: ${{ steps.yarn-cache-dir.outputs.dir }}
36-
key: ${{ runner.os }}-node14.x-yarn-${{ hashFiles('**/yarn.lock') }}
36+
key: ${{ runner.os }}-node20.x-yarn-${{ hashFiles('**/yarn.lock') }}
37+
38+
- name: npm install @microsoft/botframework-cli@next --global
39+
run: npm install @microsoft/botframework-cli@next --global
3740

3841
- name: yarn
3942
run: yarn --frozen-lockfile

.github/workflows/tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
strategy:
2222
matrix:
2323
os: [ubuntu, windows]
24-
node-version: [14.x, 16.x]
24+
node-version: [18.x, 20.x]
2525

2626
steps:
2727
- uses: actions/checkout@v2
@@ -50,7 +50,7 @@ jobs:
5050
run: yarn test:github
5151

5252
- name: coveralls
53-
if: matrix.node-version == '16.x'
53+
if: matrix.node-version == '20.x'
5454
uses: coverallsapp/[email protected]
5555
with:
5656
github-token: ${{ secrets.GITHUB_TOKEN }}

build/yaml/botbuilder-js-daily.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pool:
66
vmImage: 'ubuntu-latest'
77

88
variables:
9-
NodeVersion: 16.x
9+
NodeVersion: 20.x
1010
Packaging.EnableSBOMSigning: true
1111
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn
1212
# SDK_JS_org_registry_Url: define this in Azure

libraries/adaptive-expressions/tests/expressionProperty.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as assert from 'assert';
1+
import assert from 'assert';
22
import {
33
ArrayExpression,
44
BoolExpression,

libraries/botbuilder-ai-orchestrator/package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"botbuilder-dialogs-adaptive": "4.1.6",
3636
"botbuilder-dialogs-adaptive-runtime-core": "4.1.6",
3737
"botbuilder-dialogs-declarative": "4.1.6",
38-
"@microsoft/orchestrator-core": "~4.14.4",
38+
"@microsoft/orchestrator-core": "~4.15.1",
3939
"uuid": "^8.3.2"
4040
},
4141
"scripts": {
@@ -47,8 +47,7 @@
4747
"lint": "eslint . --ext .js,.ts",
4848
"postbuild": "downlevel-dts lib _ts3.4/lib --checksum",
4949
"test": "yarn build && nyc mocha tests/",
50-
"test:compat": "api-extractor run --verbose",
51-
"postinstall": "npx rimraf node_modules/@microsoft/orchestrator-core/node_modules/@babel/traverse"
50+
"test:compat": "api-extractor run --verbose"
5251
},
5352
"files": [
5453
"_ts3.4",

libraries/botbuilder-ai/src/globals.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@ const window = require('./custom.window');
1717
* @returns {any} The fetch library.
1818
*/
1919
export function getFetch() {
20-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
21-
const env: Record<'fetch', any> = global ?? window;
22-
23-
if (!Object.hasOwnProperty.call(env, 'fetch')) {
24-
env.fetch = require('node-fetch');
20+
if (global) {
21+
return (global.fetch = require('node-fetch'));
2522
}
2623

27-
return env.fetch;
24+
return window?.fetch;
2825
}

libraries/botbuilder-dialogs-adaptive-testing/src/httpRequestMocks/httpRequestSequenceMock.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
*/
88

99
import { HttpMethod } from 'botbuilder-dialogs-adaptive';
10-
import * as nock from 'nock';
11-
import * as parse from 'url-parse';
10+
import nock from 'nock';
11+
import parse from 'url-parse';
1212
import { HttpRequestMock } from './httpRequestMock';
1313
import { HttpResponseMock } from './httpResponseMock';
1414
import { SequenceResponseManager } from './sequenceResponseManager';

libraries/botbuilder-dialogs-adaptive-testing/src/mocks/mockHttpRequestMiddleware.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import { Middleware, TurnContext } from 'botbuilder-core';
1010
import { HttpMethod } from 'botbuilder-dialogs-adaptive';
1111
import { ClientRequest } from 'http';
12-
import * as nock from 'nock';
13-
import * as parse from 'url-parse';
12+
import nock from 'nock';
13+
import parse from 'url-parse';
1414
import { HttpRequestMock } from '../httpRequestMocks/httpRequestMock';
1515
import { HttpRequestSequenceMock } from '../httpRequestMocks/httpRequestSequenceMock';
1616
import { HttpResponseMessage } from '../httpRequestMocks/httpResponseMock';

libraries/botbuilder-dialogs-declarative/tests/schemaMergeTest.js

+5-11
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,11 @@ describe('Schema Merge Tests', function () {
7171

7272
try {
7373
// Rerun merge command.
74-
await runCommand(
75-
[
76-
'npx -p @microsoft/botframework-cli@next', // invoke with npx to not alter repo dependencies
77-
...mergeCommand,
78-
].join(' '),
79-
{
80-
// When installing bf-cli, there is sometimes a prompt during install to allow telemetry.
81-
// We need to set an environment variable so the prompt doesn't appear and halt install, causing a timeout.
82-
BF_CLI_TELEMETRY: true,
83-
}
84-
);
74+
await runCommand(mergeCommand.join(' '), {
75+
// When installing bf-cli, there is sometimes a prompt during install to allow telemetry.
76+
// We need to set an environment variable so the prompt doesn't appear and halt install, causing a timeout.
77+
BF_CLI_TELEMETRY: true,
78+
});
8579
} catch (err2) {
8680
assert.fail(`Unable to merge schemas.\nFirst error:\n${err}\nSecond error:\n${err2}`);
8781
}

libraries/botbuilder-dialogs/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@
3434
"botbuilder-core": "4.1.6",
3535
"botbuilder-dialogs-adaptive-runtime-core": "4.1.6",
3636
"botframework-connector": "4.1.6",
37-
"globalize": "^1.4.2",
37+
"globalize": "^1.7.0",
3838
"lodash": "^4.17.21",
3939
"uuid": "^8.3.2",
4040
"zod": "^3.22.4"
4141
},
4242
"devDependencies": {
43-
"@types/globalize": "^1.5.0",
43+
"@types/globalize": "^1.5.5",
4444
"line-reader": "^0.4.0"
4545
},
4646
"scripts": {

libraries/botbuilder-dialogs/src/prompts/numberPrompt.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
* Copyright (c) Microsoft Corporation. All rights reserved.
66
* Licensed under the MIT License.
77
*/
8-
import * as Globalize from 'globalize';
9-
import * as Recognizers from '@microsoft/recognizers-text-number';
8+
9+
/* eslint-disable @typescript-eslint/no-var-requires */
10+
const Globalize = require('globalize');
11+
import Recognizers from '@microsoft/recognizers-text-number';
1012
import * as locales from '../i18n';
1113
import { InputHints, TurnContext } from 'botbuilder-core';
1214
import { Prompt, PromptOptions, PromptRecognizerResult, PromptValidator } from './prompt';

libraries/botbuilder/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
},
2929
"dependencies": {
3030
"@azure/core-http": "^3.0.2",
31-
"@azure/msal-node": "^1.18.4",
31+
"@azure/msal-node": "^2.13.0",
3232
"axios": "^1.7.2",
3333
"botbuilder-core": "4.1.6",
3434
"botbuilder-stdlib": "4.1.6",

libraries/botbuilder/src/eventFactory.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import {
1313
Transcript,
1414
TurnContext,
1515
} from 'botbuilder-core';
16-
import * as dayjs from 'dayjs';
17-
import * as timezone from 'dayjs/plugin/timezone';
16+
import dayjs from 'dayjs';
17+
import timezone from 'dayjs/plugin/timezone';
1818
dayjs.extend(timezone);
1919
import { HandoffEventNames } from './handoffEventNames';
2020

libraries/botbuilder/src/fileTranscriptStore.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import { join, parse } from 'path';
99
import { mkdirp, pathExists, readdir, readFile, remove, writeFile } from 'fs-extra';
1010
import { Activity, PagedResult, TranscriptInfo, TranscriptStore } from 'botbuilder-core';
11-
import * as filenamify from 'filenamify';
11+
import filenamify from 'filenamify';
1212

1313
/**
1414
* @private

libraries/botframework-config/src/encrypt.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Licensed under the MIT License.
66
*/
77

8-
import * as crypto from 'crypto';
8+
import crypto from 'crypto';
99

1010
/**
1111
* @private

libraries/botframework-config/tests/encryption.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('EncryptionTests', function () {
6565

6666
assert.throws(
6767
() => encrypt.decryptString(encrypted, encrypt.generateKey()),
68-
new Error('error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt')
68+
new Error('error:1C800064:Provider routines::bad decrypt')
6969
);
7070
});
7171
});

libraries/botframework-connector/babel.config.js

-27
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/* eslint-disable @typescript-eslint/no-var-requires */
2+
export const Buffer = require('buffer').Buffer;

0 commit comments

Comments
 (0)