Skip to content

Commit

Permalink
remove six yaml-related dependencies (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Aug 9, 2024
1 parent c0a5e5d commit 18c0ce3
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/curvy-garlics-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@manypkg/tools": patch
---

Replace `read-yaml-file` with `js-yaml`
3 changes: 2 additions & 1 deletion packages/tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
11 changes: 10 additions & 1 deletion packages/tools/src/PnpmTool.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -13,6 +15,13 @@ import {
} from "./expandPackageGlobs";
import { readJson, readJsonSync } from "./utils";

async function readYamlFile<T = unknown>(path: string): Promise<T> {
return fsp.readFile(path, 'utf8').then(data => yaml.load(data)) as Promise<T>;
}
function readYamlFileSync<T = unknown>(path: string): T {
return yaml.load(fs.readFileSync(path, 'utf8')) as T;
}

export interface PnpmWorkspaceYaml {
packages?: string[];
}
Expand Down
17 changes: 17 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 18c0ce3

Please sign in to comment.