@changesets/read
Advanced tools
+9
-0
| # @changesets/read | ||
| ## 0.6.5 | ||
| ### Patch Changes | ||
| - [#1636](https://github.com/changesets/changesets/pull/1636) [`f73f84a`](https://github.com/changesets/changesets/commit/f73f84ac2d84d3ccf5ff55c0fc78aaaf3f3da20d) Thanks [@Netail](https://github.com/Netail)! - Correctly resolve new changesets with `since` option when the `.changeset` directory is not directly in the git root | ||
| - Updated dependencies [[`f73f84a`](https://github.com/changesets/changesets/commit/f73f84ac2d84d3ccf5ff55c0fc78aaaf3f3da20d)]: | ||
| - @changesets/git@3.0.4 | ||
| ## 0.6.4 | ||
@@ -4,0 +13,0 @@ |
@@ -127,3 +127,3 @@ 'use strict'; | ||
| }); | ||
| const newHashes = newChangesets.map(c => c.split("/")[1]); | ||
| const newHashes = newChangesets.map(c => c.split("/").pop()); | ||
| return changesets.filter(dir => newHashes.includes(dir)); | ||
@@ -130,0 +130,0 @@ } |
@@ -97,3 +97,3 @@ import * as fs from 'fs-extra'; | ||
| }); | ||
| const newHashes = newChangesets.map(c => c.split("/")[1]); | ||
| const newHashes = newChangesets.map(c => c.split("/").pop()); | ||
| return changesets.filter(dir => newHashes.includes(dir)); | ||
@@ -100,0 +100,0 @@ } |
+3
-2
| { | ||
| "name": "@changesets/read", | ||
| "version": "0.6.4", | ||
| "version": "0.6.5", | ||
| "description": "Read changesets from disc, and return the information as JSON", | ||
@@ -22,3 +22,3 @@ "main": "dist/changesets-read.cjs.js", | ||
| "dependencies": { | ||
| "@changesets/git": "^3.0.3", | ||
| "@changesets/git": "^3.0.4", | ||
| "@changesets/logger": "^0.1.1", | ||
@@ -33,4 +33,5 @@ "@changesets/parse": "^0.4.1", | ||
| "@changesets/test-utils": "*", | ||
| "@changesets/write": "*", | ||
| "outdent": "^0.5.0" | ||
| } | ||
| } |
+39
-2
| import fs from "fs-extra"; | ||
| import path from "path"; | ||
| import path from "node:path"; | ||
| import outdent from "outdent"; | ||
| import read from "./"; | ||
| import { silenceLogsInBlock, testdir } from "@changesets/test-utils"; | ||
| import { gitdir, silenceLogsInBlock, testdir } from "@changesets/test-utils"; | ||
| import writeChangeset from "@changesets/write"; | ||
| import { add } from "@changesets/git"; | ||
@@ -219,2 +221,37 @@ silenceLogsInBlock(); | ||
| }); | ||
| it("should read a nested changeset relative to git root", async () => { | ||
| const cwd = await gitdir({ | ||
| "library/package.json": JSON.stringify({ | ||
| private: true, | ||
| workspaces: ["packages/*"], | ||
| }), | ||
| "library/packages/pkg-a/package.json": JSON.stringify({ | ||
| name: "pkg-a", | ||
| }), | ||
| "library/.changeset/config.json": JSON.stringify({}), | ||
| }); | ||
| const changesetId = await writeChangeset( | ||
| { | ||
| releases: [ | ||
| { | ||
| name: "pkg-a", | ||
| type: "minor", | ||
| }, | ||
| ], | ||
| summary: "Awesome summary", | ||
| }, | ||
| path.join(cwd, "library") | ||
| ); | ||
| await add("library/.changeset", cwd); | ||
| const changesets = await read(path.join(cwd, "library"), "main"); | ||
| expect(changesets).toEqual([ | ||
| { | ||
| releases: [{ name: "pkg-a", type: "minor" }], | ||
| summary: "Awesome summary", | ||
| id: changesetId, | ||
| }, | ||
| ]); | ||
| }); | ||
| }); |
+1
-1
@@ -17,3 +17,3 @@ import fs from "fs-extra"; | ||
| }); | ||
| const newHashes = newChangesets.map((c) => c.split("/")[1]); | ||
| const newHashes = newChangesets.map((c) => c.split("/").pop()); | ||
@@ -20,0 +20,0 @@ return changesets.filter((dir) => newHashes.includes(dir)); |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
36739
4.48%605
6.14%3
50%Updated