-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Automate NPM package releases #1119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,8 @@ | ||
| # Changesets | ||
|
|
||
| Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works | ||
| with multi-package repos, or single-package repos to help you version and publish your code. You can | ||
| find the full documentation for it [in our repository](https://github.com/changesets/changesets) | ||
|
|
||
| We have a quick list of common questions to get you started engaging with this project in | ||
| [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) |
This file contains hidden or 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,11 @@ | ||
| { | ||
| "$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
| "changelog": "@changesets/cli/changelog", | ||
| "commit": false, | ||
| "fixed": [], | ||
| "linked": [], | ||
| "access": "public", | ||
| "baseBranch": "master", | ||
| "updateInternalDependencies": "patch", | ||
| "ignore": [] | ||
| } |
This file contains hidden or 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,13 @@ | ||
| { | ||
| "mode": "pre", | ||
| "tag": "alpha", | ||
| "initialVersions": { | ||
| "rrdom": "0.1.7", | ||
| "rrdom-nodejs": "0.1.7", | ||
| "rrweb": "2.0.0-alpha.4", | ||
| "rrweb-player": "1.0.0-alpha.4", | ||
| "rrweb-snapshot": "2.0.0-alpha.4", | ||
| "@rrweb/types": "2.0.0-alpha.4" | ||
| }, | ||
| "changesets": [] | ||
| } |
This file contains hidden or 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,38 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
|
|
||
| concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Release | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Setup Node.js lts/* | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: lts/* | ||
|
|
||
| - name: Install Dependencies | ||
| run: yarn | ||
|
|
||
| - name: Create Release Pull Request or Publish to npm | ||
| id: changesets | ||
| uses: changesets/action@v1 | ||
| with: | ||
| publish: yarn run release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
|
||
| # - name: Send a Slack notification if a publish happens | ||
| # if: steps.changesets.outputs.published == 'true' | ||
| # # You can do something when a publish happens. | ||
| # run: my-slack-bot send-notification --message "A new version of ${GITHUB_REPOSITORY} was published!" | ||
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -36,15 +36,16 @@ export class RRWindow { | |
|
|
||
| export class RRDocument | ||
| extends BaseRRDocumentImpl(RRNode) | ||
| implements IRRDocument { | ||
| implements IRRDocument | ||
| { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are formatting changes unrelated to changesets? |
||
| readonly nodeName: '#document' = '#document'; | ||
| private _nwsapi: NWSAPI; | ||
| get nwsapi() { | ||
| if (!this._nwsapi) { | ||
| // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call | ||
| this._nwsapi = nwsapi({ | ||
| document: (this as unknown) as Document, | ||
| DOMException: (null as unknown) as new ( | ||
| document: this as unknown as Document, | ||
| DOMException: null as unknown as new ( | ||
| message?: string, | ||
| name?: string, | ||
| ) => DOMException, | ||
|
|
@@ -97,7 +98,7 @@ export class RRDocument | |
| } | ||
|
|
||
| querySelectorAll(selectors: string): RRNode[] { | ||
| return (this.nwsapi.select(selectors) as unknown) as RRNode[]; | ||
| return this.nwsapi.select(selectors) as unknown as RRNode[]; | ||
| } | ||
|
|
||
| getElementsByTagName(tagName: string): RRElement[] { | ||
|
|
@@ -220,7 +221,7 @@ export class RRElement extends BaseRRElementImpl(RRNode) { | |
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore | ||
| get style() { | ||
| return (this._style as unknown) as CSSStyleDeclaration; | ||
| return this._style as unknown as CSSStyleDeclaration; | ||
| } | ||
|
|
||
| attachShadow(_init: ShadowRootInit): RRElement { | ||
|
|
@@ -268,14 +269,14 @@ export class RRElement extends BaseRRElementImpl(RRNode) { | |
| querySelectorAll(selectors: string): RRNode[] { | ||
| const result: RRElement[] = []; | ||
| if (this.ownerDocument !== null) { | ||
| ((this.ownerDocument as RRDocument).nwsapi.select( | ||
| (this.ownerDocument as RRDocument).nwsapi.select( | ||
| selectors, | ||
| (this as unknown) as Element, | ||
| this as unknown as Element, | ||
| (element) => { | ||
| if (((element as unknown) as RRElement) !== this) | ||
| result.push((element as unknown) as RRElement); | ||
| if ((element as unknown as RRElement) !== this) | ||
| result.push(element as unknown as RRElement); | ||
| }, | ||
| ) as unknown) as RRNode[]; | ||
| ) as unknown as RRNode[]; | ||
| } | ||
| return result; | ||
| } | ||
|
|
@@ -393,6 +394,5 @@ interface RRElementTagNameMap { | |
| video: RRMediaElement; | ||
| } | ||
|
|
||
| type RRElementType< | ||
| K extends keyof HTMLElementTagNameMap | ||
| > = K extends keyof RRElementTagNameMap ? RRElementTagNameMap[K] : RRElement; | ||
| type RRElementType<K extends keyof HTMLElementTagNameMap> = | ||
| K extends keyof RRElementTagNameMap ? RRElementTagNameMap[K] : RRElement; | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just want to make sure this command will publish the package directly or create a pull request first?
I feel that it's safer to create a pull request first rather than directly publish packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will create a PR first, once that PR is accepted it will publish the packages on NPM. Also if a PR already exists and more code is added to master the release command will update the PR with the new changes.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw Matt's youtube video and I found that he only build the package here rather than publishing them. So I'm guessing ChangeSets will execute changesets publish for us rather than we manually do it?

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that myself on https://github.com/Juice10/rrweb and it didn’t work. Also looking at the changesets documentation and some projects using changesets this seems like the way to go. Looks like a mistake in Matt’s video
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation!