diff --git a/.changeset/curvy-garlics-exercise.md b/.changeset/curvy-garlics-exercise.md new file mode 100644 index 0000000..9a321a0 --- /dev/null +++ b/.changeset/curvy-garlics-exercise.md @@ -0,0 +1,5 @@ +--- +"@manypkg/tools": patch +--- + +Replace `read-yaml-file` with `js-yaml` diff --git a/packages/tools/package.json b/packages/tools/package.json index ea51ada..057055c 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -11,10 +11,11 @@ "dependencies": { "globby": "^11.0.0", "jju": "^1.4.0", - "read-yaml-file": "^1.1.0" + "js-yaml": "^4.1.0" }, "devDependencies": { "@types/jju": "^1.4.2", + "@types/js-yaml": "^4.0.9", "jest-fixtures": "^0.6.0" }, "engines": { diff --git a/packages/tools/src/PnpmTool.ts b/packages/tools/src/PnpmTool.ts index fcfd749..a542a75 100644 --- a/packages/tools/src/PnpmTool.ts +++ b/packages/tools/src/PnpmTool.ts @@ -1,5 +1,7 @@ import path from "path"; -import readYamlFile, { sync as readYamlFileSync } from "read-yaml-file"; +import yaml from "js-yaml"; +import fs from "fs"; +import fsp from "fs/promises"; import { Tool, @@ -13,6 +15,13 @@ import { } from "./expandPackageGlobs"; import { readJson, readJsonSync } from "./utils"; +async function readYamlFile(path: string): Promise { + return fsp.readFile(path, 'utf8').then(data => yaml.load(data)) as Promise; +} +function readYamlFileSync(path: string): T { + return yaml.load(fs.readFileSync(path, 'utf8')) as T; +} + export interface PnpmWorkspaceYaml { packages?: string[]; } diff --git a/yarn.lock b/yarn.lock index 6216fb1..e374e42 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2094,6 +2094,11 @@ resolved "https://registry.yarnpkg.com/@types/jju/-/jju-1.4.2.tgz#cb31d10d9e23a1b2786a9842c584b53f6f1b9086" integrity sha512-fbvsM6TrP3QN6791tiF6wAkmlNRwf1VARZ7sXyc5kmbfTDFhECaiS5ZFvpaciud0BoKBBFWA8hE3utOLf5XB1w== +"@types/js-yaml@^4.0.9": + version "4.0.9" + resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.9.tgz#cd82382c4f902fed9691a2ed79ec68c5898af4c2" + integrity sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg== + "@types/json-schema@^7.0.3": version "7.0.3" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.3.tgz#bdfd69d61e464dcc81b25159c270d75a73c1a636" @@ -2657,6 +2662,11 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + aria-query@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-3.0.0.tgz#65b3fcc1ca1155a8c9ae64d6eee297f15d5133cc" @@ -9158,6 +9168,13 @@ js-yaml@^3.10.0, js-yaml@^3.11.0, js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.5 argparse "^1.0.7" esprima "^4.0.0" +js-yaml@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + dependencies: + argparse "^2.0.1" + jsesc@^2.5.1: version "2.5.2" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4"