@@ -205,42 +205,66 @@ npm run release:notes
205205
206206### Generating Changesets Locally
207207
208- You can generate changesets locally for previously merged PRs using the ` generate-changeset .js` script directly:
208+ You can generate changesets locally for previously merged PRs using either the npm script or the Node .js script directly:
209209
210210``` bash
211- # Basic usage
212- node scripts/ generate-changeset.js --pr=123 --title=" feat: Add new feature" --author=" username"
211+ # Using the npm script (note the -- before the arguments)
212+ npm run changeset: generate -- --pr=123 --title=" feat: Add new feature" --author=" username"
213213
214214# With a detailed body
215- node scripts/ generate-changeset.js \
215+ npm run changeset: generate -- \
216216 --pr=123 \
217217 --title=" feat: Add new feature" \
218218 --author=" username" \
219219 --body=" Detailed description of the changes"
220220
221221# For a breaking change
222- node scripts/ generate-changeset.js \
222+ npm run changeset: generate -- \
223223 --pr=123 \
224224 --title=" feat!: Breaking change" \
225225 --author=" username" \
226226 --breaking=true
227+
228+ # Or using Node directly
229+ node scripts/generate-changeset.js \
230+ --pr=123 \
231+ --title=" feat: Add new feature" \
232+ --author=" username"
227233```
228234
229235You can also use the GitHub API to fetch PR information automatically:
230236
231237``` bash
238+ # Set your GitHub token
239+ export GITHUB_TOKEN=" your_token_here"
240+
232241# Fetch PR info and generate changeset
233242PR_NUMBER=123
234243PR_DATA=$( curl -s -H " Authorization: token $GITHUB_TOKEN " \
235- " https://api.github.com/repos/OWNER/REPO/pulls/$PR_NUMBER " )
244+ " https://api.github.com/repos/$ OWNER /$ REPO /pulls/$PR_NUMBER " )
236245
246+ # Using npm script
247+ npm run changeset:generate -- \
248+ --pr=" $PR_NUMBER " \
249+ --title=" $( echo " $PR_DATA " | jq -r ' .title' ) " \
250+ --author=" $( echo " $PR_DATA " | jq -r ' .user.login' ) " \
251+ --body=" $( echo " $PR_DATA " | jq -r ' .body' ) "
252+
253+ # Or using Node directly
237254node scripts/generate-changeset.js \
238255 --pr=" $PR_NUMBER " \
239256 --title=" $( echo " $PR_DATA " | jq -r ' .title' ) " \
240257 --author=" $( echo " $PR_DATA " | jq -r ' .user.login' ) " \
241258 --body=" $( echo " $PR_DATA " | jq -r ' .body' ) "
242259```
243260
261+ Available options:
262+ - ` --pr ` : (required) The PR number
263+ - ` --title ` : (required) The PR title
264+ - ` --author ` : (required) The PR author's username
265+ - ` --body ` : (optional) The PR description
266+ - ` --breaking ` : (optional) Whether this is a breaking change [ default: false]
267+
244268After generating the changeset:
2452691 . Commit the new changeset file in the ` .changesets ` directory
2462702 . Push the changes to the develop branch
0 commit comments