-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add script for fixing changesets after stable release (#496)
- Loading branch information
1 parent
1e45cac
commit 0b8d7f4
Showing
3 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import fs from 'node:fs'; | ||
|
||
// Read files inside the `.changeset` directory | ||
const files = fs.readdirSync('.changeset'); | ||
|
||
// Filter out files that don't end with `.md` extension | ||
const changesets = files.filter( | ||
(file) => file.endsWith('.md') && file !== 'README.md' | ||
); | ||
|
||
// Read the contents of pre.json in the `.changeset` directory | ||
const preJson = fs.readFileSync('.changeset/pre.json', 'utf-8'); | ||
|
||
// Parse the contents of pre.json into a JavaScript object | ||
const pre = JSON.parse(preJson); | ||
|
||
// Write changeset file names (without file extension) to the `changesets` key | ||
pre.changesets = changesets.map((changeset) => changeset.replace('.md', '')); | ||
|
||
// Write the updated pre.json back to the `.changeset` directory | ||
fs.writeFileSync('.changeset/pre.json', JSON.stringify(pre, null, 2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters