Skip to content

Commit

Permalink
Apply feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ceciliaavila committed Dec 3, 2024
1 parent 55479c7 commit 7a27174
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/depcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node20.x-yarn-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-node22.x-yarn-${{ hashFiles('**/yarn.lock') }}

- name: yarn
run: yarn --frozen-lockfile
Expand Down
11 changes: 6 additions & 5 deletions libraries/botbuilder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@
"node-mocks-http": "^1.16.0"
},
"scripts": {
"build": "yarn prebuild && tsc -b",
"build": "tsc -b",
"build-docs": "typedoc --theme markdown --entryPoint botbuilder --excludePrivate --includeDeclarations --ignoreCompilerErrors --module amd --out ..\\..\\doc\\botbuilder .\\lib\\index.d.ts ..\\botbuilder-core\\lib\\index.d.ts ..\\botframework-schema\\lib\\index.d.ts --hideGenerator --name \"Bot Builder SDK\" --readme none",
"build:rollup": "yarn clean && yarn build && api-extractor run --verbose --local",
"clean": "rimraf _ts3.4 lib dist tsconfig.tsbuildinfo",
"clean": "rimraf _ts3.4 lib vendors tsconfig.tsbuildinfo",
"depcheck": "depcheck --config ../../.depcheckrc",
"lint": "eslint .",
"prebuild": "tsup ../../node_modules/filenamify/*.js --format cjs --dts --out-dir dist/filenamify --clean --sourcemap",
"prebuild": "tsup ./node_modules/filenamify/*.js --format cjs --dts --out-dir vendors/filenamify --clean --sourcemap",
"postbuild": "downlevel-dts lib _ts3.4/lib --checksum",
"test": "npm-run-all build test:mocha",
"test:compat": "api-extractor run --verbose",
Expand All @@ -70,6 +70,7 @@
"files": [
"_ts3.4",
"lib",
"src"
"src",
"vendors"
]
}
}
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 filenamify from '../dist/filenamify/index';
import filenamify from '../vendors/filenamify/index';

/**
* @private
Expand Down
6 changes: 2 additions & 4 deletions libraries/botframework-config/src/encrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export function decryptString(encryptedValue: string, secret: string): string {
* @param secret
*/
export function legacyDecrypt(encryptedValue: string, secret: string): string {
const UNSUPPORTED_VERSION = '22.0.0';
const UNSUPPORTED_VERSION = 'v22.0.0';
if (!isNodeCompatible(nodeVersion, UNSUPPORTED_VERSION)) {
throw new Error(`This method is not available for Node.js versions over ${UNSUPPORTED_VERSION}.`);
} else {
Expand All @@ -122,7 +122,5 @@ export function legacyDecrypt(encryptedValue: string, secret: string): string {
* @returns true if the current version of Node is lower than the unsupported version.
*/
function isNodeCompatible(currentVersion: string, minVersion: string): boolean {
const [currentMajor] = currentVersion.replace('v', '').split('.').map(Number);
const [minMajor] = minVersion.split('.').map(Number);
return currentMajor < minMajor;
return minVersion.localeCompare(currentVersion) > 0;
}
10 changes: 5 additions & 5 deletions libraries/botframework-config/tests/loadAndSave.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const testBotPath = require.resolve('./test.bot');
const govTestBotPath = require.resolve('./govTest.bot');
const legacyBotPath = require.resolve('./legacy.bot');
const saveBotPath = testBotPath.replace('test.bot', 'save.bot');
const [nodeVersion] = process.version.replace('v', '').split('.').map(Number);
const UNSUPPORTED_VERSION = 'v22.0.0';

describe('LoadAndSaveTests', function () {
it('DeserializeBotFile', async function () {
Expand Down Expand Up @@ -90,10 +90,10 @@ describe('LoadAndSaveTests', function () {
const config = await bf.BotConfiguration.load(testBotPath);
await config.saveAs(saveBotPath, secret);

if (nodeVersion >= 22) {
if (UNSUPPORTED_VERSION.localeCompare(process.version) < 1) {
await assert.rejects(
bf.BotConfiguration.load(saveBotPath),
new Error('This method is not available for Node.js versions over 22.0.0.'),
new Error(`This method is not available for Node.js versions over ${UNSUPPORTED_VERSION}.`),
);
} else {
await assert.rejects(
Expand Down Expand Up @@ -362,10 +362,10 @@ describe('LoadAndSaveTests', function () {
});

it('LegacyEncryption', async function () {
if (nodeVersion >= 22) {
if (!(UNSUPPORTED_VERSION.localeCompare(process.version) > 0)) {
await assert.rejects(
bf.BotConfiguration.load(legacyBotPath, 'password'),
new Error('This method is not available for Node.js versions over 22.0.0.'),
new Error(`This method is not available for Node.js versions over ${UNSUPPORTED_VERSION}.`),
);
} else {
let config = await bf.BotConfiguration.load(legacyBotPath, 'password');
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
"generators/generator-botbuilder/generators/app/templates/*"
],
"nohoist": [
"**/@types/selenium-webdriver"
"**/@types/selenium-webdriver",
"botbuilder/filenamify"
],
"nohoistComments": {
"**/@types/selenium-webdriver": "This package is excluded from the root @types folder as it requires ES2015+, whereas some BotBuilder libraries support ES5+."
"**/@types/selenium-webdriver": "This package is excluded from the root @types folder as it requires ES2015+, whereas some BotBuilder libraries support ES5+.",
"botbuilder/filenamify": "This package is excluded because it's compiled as CJS by tsup as it's ESM-only."
}
},
"scripts": {
Expand Down

0 comments on commit 7a27174

Please sign in to comment.