Skip to content

Commit

Permalink
fix: [microsoft#4525] Replace read-text-file package to avoid using L…
Browse files Browse the repository at this point in the history
…GPL (microsoft#4534)

* remove read-text-file package

* include rule disabling

* make async function

---------

Co-authored-by: JhontSouth <[email protected]>
  • Loading branch information
ceciliaavila and JhontSouth authored Sep 8, 2023
1 parent 3685e5e commit cbb187d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 19 deletions.
1 change: 0 additions & 1 deletion libraries/botframework-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
},
"dependencies": {
"fs-extra": "^7.0.1",
"read-text-file": "^1.1.0",
"uuid": "^8.3.2"
},
"devDependencies": {
Expand Down
8 changes: 5 additions & 3 deletions libraries/botframework-config/src/botConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* Licensed under the MIT License.
*/
import * as fsx from 'fs-extra';
import * as fs from 'fs';
import * as path from 'path';
import * as process from 'process';
import * as txtfile from 'read-text-file';
import { v4 as uuidv4 } from 'uuid';
import { BotConfigurationBase } from './botConfigurationBase';
import * as encrypt from './encrypt';
Expand Down Expand Up @@ -106,7 +106,8 @@ export class BotConfiguration extends BotConfigurationBase {
* @returns A Promise with the new BotConfiguration instance.
*/
static async load(botpath: string, secret?: string): Promise<BotConfiguration> {
const json: string = await txtfile.read(botpath);
// eslint-disable-next-line security/detect-non-literal-fs-filename
const json: string = await fs.promises.readFile(botpath, 'utf8');
const bot: BotConfiguration = BotConfiguration.internalLoad(json, secret);
bot.internal.location = botpath;

Expand All @@ -121,7 +122,8 @@ export class BotConfiguration extends BotConfigurationBase {
* @returns A new BotConfiguration instance.
*/
static loadSync(botpath: string, secret?: string): BotConfiguration {
const json: string = txtfile.readSync(botpath);
// eslint-disable-next-line security/detect-non-literal-fs-filename
const json: string = fs.readFileSync(botpath, 'utf8');
const bot: BotConfiguration = BotConfiguration.internalLoad(json, secret);
bot.internal.location = botpath;

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
"npm-run-all": "^4.1.5",
"nyc": "^15.1.0",
"prettier": "^2.1.2",
"read-text-file": "^1.1.0",
"replace-in-file": "^4.1.0",
"rimraf": "^3.0.2",
"shx": "^0.3.3",
Expand Down
15 changes: 1 addition & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7380,7 +7380,7 @@ hyperlinker@^1.0.0:
resolved "https://registry.yarnpkg.com/hyperlinker/-/hyperlinker-1.0.0.tgz#23dc9e38a206b208ee49bc2d6c8ef47027df0c0e"
integrity sha512-Ty8UblRWFEcfSuIaajM34LdPXIhbs1ajEX/BBPv24J+enSVaEVY63xQ6lTO9VRYS5LAoghIG0IDJ+p+IPzKUQQ==

[email protected], iconv-lite@^0.4.17:
[email protected]:
version "0.4.24"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==
Expand Down Expand Up @@ -8148,11 +8148,6 @@ jsbn@~0.1.0:
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM=

jschardet@^1.4.2:
version "1.6.0"
resolved "https://registry.yarnpkg.com/jschardet/-/jschardet-1.6.0.tgz#c7d1a71edcff2839db2f9ec30fc5d5ebd3c1a678"
integrity sha512-xYuhvQ7I9PDJIGBWev9xm0+SMSed3ZDBAmvVjbFR1ZRLAF+vlXcQu6cRI9uAlj81rzikElRVteehwV7DuX2ZmQ==

jsdoctypeparser@^9.0.0:
version "9.0.0"
resolved "https://registry.yarnpkg.com/jsdoctypeparser/-/jsdoctypeparser-9.0.0.tgz#8c97e2fb69315eb274b0f01377eaa5c940bd7b26"
Expand Down Expand Up @@ -10995,14 +10990,6 @@ read-pkg@^3.0.0:
normalize-package-data "^2.3.2"
path-type "^3.0.0"

read-text-file@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/read-text-file/-/read-text-file-1.1.0.tgz#d0c3f18768828f9107d61bb0b368ee7b90f71893"
integrity sha1-0MPxh2iCj5EH1huws2jue5D3GJM=
dependencies:
iconv-lite "^0.4.17"
jschardet "^1.4.2"

"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.6, readable-stream@~2.3.6:
version "2.3.7"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57"
Expand Down

0 comments on commit cbb187d

Please sign in to comment.