Skip to content

Commit

Permalink
bump: [#4550] Add Node 18 and 20 support (#4726)
Browse files Browse the repository at this point in the history
* Add Node 18 and 20 support

* Fix CI and functional pipelines

---------

Co-authored-by: JhontSouth <[email protected]>
  • Loading branch information
sw-joelmut and JhontSouth authored Aug 26, 2024
1 parent 0f1dd7e commit 604e190
Show file tree
Hide file tree
Showing 35 changed files with 1,188 additions and 248 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/depcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: use node 16.x
- name: use node 20.x
uses: actions/setup-node@v2-beta
with:
node-version: 16.x
node-version: 20.x

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

- name: yarn
run: yarn --frozen-lockfile
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: use node 16.x
- name: use node 20.x
uses: actions/setup-node@v2-beta
with:
node-version: 16.x
node-version: 20.x

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

- name: yarn
run: yarn --frozen-lockfile
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-compat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: use node 16.x
- name: use node 20.x
uses: actions/setup-node@v2-beta
with:
node-version: 16.x
node-version: 20.x

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

- name: yarn
run: yarn --frozen-lockfile
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-consumer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: use node 16.x
- name: use node 20.x
uses: actions/setup-node@v2-beta
with:
node-version: 16.x
node-version: 20.x

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

- name: yarn
run: yarn --frozen-lockfile
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-repoutils.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: use node 16.x
- name: use node 20.x
uses: actions/setup-node@v2-beta
with:
node-version: 16.x
node-version: 20.x

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

- name: yarn
run: yarn --frozen-lockfile
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/test-schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: use node 14.x
- name: use node 20.x
uses: actions/setup-node@v2-beta
with:
node-version: 14.x
node-version: 20.x

- name: yarn cache dir
id: yarn-cache-dir
Expand All @@ -33,7 +33,10 @@ jobs:
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node14.x-yarn-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-node20.x-yarn-${{ hashFiles('**/yarn.lock') }}

- name: npm install @microsoft/botframework-cli@next --global
run: npm install @microsoft/botframework-cli@next --global

- name: yarn
run: yarn --frozen-lockfile
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
matrix:
os: [ubuntu, windows]
node-version: [14.x, 16.x]
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
run: yarn test:github

- name: coveralls
if: matrix.node-version == '16.x'
if: matrix.node-version == '20.x'
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion build/yaml/botbuilder-js-daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pool:
vmImage: 'ubuntu-latest'

variables:
NodeVersion: 16.x
NodeVersion: 20.x
Packaging.EnableSBOMSigning: true
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn
# SDK_JS_org_registry_Url: define this in Azure
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as assert from 'assert';
import assert from 'assert';
import {
ArrayExpression,
BoolExpression,
Expand Down
5 changes: 2 additions & 3 deletions libraries/botbuilder-ai-orchestrator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"botbuilder-dialogs-adaptive": "4.1.6",
"botbuilder-dialogs-adaptive-runtime-core": "4.1.6",
"botbuilder-dialogs-declarative": "4.1.6",
"@microsoft/orchestrator-core": "~4.14.4",
"@microsoft/orchestrator-core": "~4.15.1",
"uuid": "^8.3.2"
},
"scripts": {
Expand All @@ -47,8 +47,7 @@
"lint": "eslint . --ext .js,.ts",
"postbuild": "downlevel-dts lib _ts3.4/lib --checksum",
"test": "yarn build && nyc mocha tests/",
"test:compat": "api-extractor run --verbose",
"postinstall": "npx rimraf node_modules/@microsoft/orchestrator-core/node_modules/@babel/traverse"
"test:compat": "api-extractor run --verbose"
},
"files": [
"_ts3.4",
Expand Down
9 changes: 3 additions & 6 deletions libraries/botbuilder-ai/src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ const window = require('./custom.window');
* @returns {any} The fetch library.
*/
export function getFetch() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const env: Record<'fetch', any> = global ?? window;

if (!Object.hasOwnProperty.call(env, 'fetch')) {
env.fetch = require('node-fetch');
if (global) {
return (global.fetch = require('node-fetch'));
}

return env.fetch;
return window?.fetch;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
*/

import { HttpMethod } from 'botbuilder-dialogs-adaptive';
import * as nock from 'nock';
import * as parse from 'url-parse';
import nock from 'nock';
import parse from 'url-parse';
import { HttpRequestMock } from './httpRequestMock';
import { HttpResponseMock } from './httpResponseMock';
import { SequenceResponseManager } from './sequenceResponseManager';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import { Middleware, TurnContext } from 'botbuilder-core';
import { HttpMethod } from 'botbuilder-dialogs-adaptive';
import { ClientRequest } from 'http';
import * as nock from 'nock';
import * as parse from 'url-parse';
import nock from 'nock';
import parse from 'url-parse';
import { HttpRequestMock } from '../httpRequestMocks/httpRequestMock';
import { HttpRequestSequenceMock } from '../httpRequestMocks/httpRequestSequenceMock';
import { HttpResponseMessage } from '../httpRequestMocks/httpResponseMock';
Expand Down
16 changes: 5 additions & 11 deletions libraries/botbuilder-dialogs-declarative/tests/schemaMergeTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,11 @@ describe('Schema Merge Tests', function () {

try {
// Rerun merge command.
await runCommand(
[
'npx -p @microsoft/botframework-cli@next', // invoke with npx to not alter repo dependencies
...mergeCommand,
].join(' '),
{
// When installing bf-cli, there is sometimes a prompt during install to allow telemetry.
// We need to set an environment variable so the prompt doesn't appear and halt install, causing a timeout.
BF_CLI_TELEMETRY: true,
}
);
await runCommand(mergeCommand.join(' '), {
// When installing bf-cli, there is sometimes a prompt during install to allow telemetry.
// We need to set an environment variable so the prompt doesn't appear and halt install, causing a timeout.
BF_CLI_TELEMETRY: true,
});
} catch (err2) {
assert.fail(`Unable to merge schemas.\nFirst error:\n${err}\nSecond error:\n${err2}`);
}
Expand Down
4 changes: 2 additions & 2 deletions libraries/botbuilder-dialogs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
"botbuilder-core": "4.1.6",
"botbuilder-dialogs-adaptive-runtime-core": "4.1.6",
"botframework-connector": "4.1.6",
"globalize": "^1.4.2",
"globalize": "^1.7.0",
"lodash": "^4.17.21",
"uuid": "^8.3.2",
"zod": "^3.22.4"
},
"devDependencies": {
"@types/globalize": "^1.5.0",
"@types/globalize": "^1.5.5",
"line-reader": "^0.4.0"
},
"scripts": {
Expand Down
6 changes: 4 additions & 2 deletions libraries/botbuilder-dialogs/src/prompts/numberPrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import * as Globalize from 'globalize';
import * as Recognizers from '@microsoft/recognizers-text-number';

/* eslint-disable @typescript-eslint/no-var-requires */
const Globalize = require('globalize');
import Recognizers from '@microsoft/recognizers-text-number';
import * as locales from '../i18n';
import { InputHints, TurnContext } from 'botbuilder-core';
import { Prompt, PromptOptions, PromptRecognizerResult, PromptValidator } from './prompt';
Expand Down
2 changes: 1 addition & 1 deletion libraries/botbuilder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"dependencies": {
"@azure/core-http": "^3.0.2",
"@azure/msal-node": "^1.18.4",
"@azure/msal-node": "^2.13.0",
"axios": "^1.7.2",
"botbuilder-core": "4.1.6",
"botbuilder-stdlib": "4.1.6",
Expand Down
4 changes: 2 additions & 2 deletions libraries/botbuilder/src/eventFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
Transcript,
TurnContext,
} from 'botbuilder-core';
import * as dayjs from 'dayjs';
import * as timezone from 'dayjs/plugin/timezone';
import dayjs from 'dayjs';
import timezone from 'dayjs/plugin/timezone';
dayjs.extend(timezone);
import { HandoffEventNames } from './handoffEventNames';

Expand Down
2 changes: 1 addition & 1 deletion libraries/botbuilder/src/fileTranscriptStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { join, parse } from 'path';
import { mkdirp, pathExists, readdir, readFile, remove, writeFile } from 'fs-extra';
import { Activity, PagedResult, TranscriptInfo, TranscriptStore } from 'botbuilder-core';
import * as filenamify from 'filenamify';
import filenamify from 'filenamify';

/**
* @private
Expand Down
2 changes: 1 addition & 1 deletion libraries/botframework-config/src/encrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Licensed under the MIT License.
*/

import * as crypto from 'crypto';
import crypto from 'crypto';

/**
* @private
Expand Down
2 changes: 1 addition & 1 deletion libraries/botframework-config/tests/encryption.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('EncryptionTests', function () {

assert.throws(
() => encrypt.decryptString(encrypted, encrypt.generateKey()),
new Error('error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt')
new Error('error:1C800064:Provider routines::bad decrypt')
);
});
});
27 changes: 0 additions & 27 deletions libraries/botframework-connector/babel.config.js

This file was deleted.

2 changes: 2 additions & 0 deletions libraries/botframework-connector/esbuild.inject.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/* eslint-disable @typescript-eslint/no-var-requires */
export const Buffer = require('buffer').Buffer;
Loading

0 comments on commit 604e190

Please sign in to comment.