-
Notifications
You must be signed in to change notification settings - Fork 1
NPM publishing and Monorepo #2
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
Conversation
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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.
NPM token has been added to this repo as an Action secret, and is also in 1Password.
</div> | ||
<script type="module"> | ||
import { EmbeddedWidget } from "../src/index"; | ||
import { EmbeddedWidget } from "@airbyte-embedded/airbyte-embedded-modal"; |
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 enabled pnpm workspaces for this repo so that we could have real-looking imports, and test that the 'bundled-up' package acts like we want it to.
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.
Note for the future: the import should probably a little more specific, like AirbyteEmbeddedWidget
"dependencies": { | ||
"@airbyte-embedded/airbyte-embedded-modal": "workspace:*" | ||
}, |
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.
Now the demo imports our package in a regular-ish way
1. There is an update to the main branch. | ||
2. A new version is created in the `package.json`. | ||
|
||
To create a new version, you can use the following command: |
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.
when should one use these instructions instead of the publish script?
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.
Both are needed, sort of:
- The publish script and github action /always/ run on main, but are no-ops unless there's a new version in the package.json. Not every commit on main should produce a new artifact on NPM.
- The
pnpm version
command is the best way to bump the version of the package withinpackage.json
, but you don't have to do it that way. - No one should ever need to run the publish shell script manually
What's nice about pnpm version
is that it will also make a git tag for you too.
This PR sets up automatic publishing for the widget to
@airbyte-embedded/airbyte-embedded-modal
(https://www.npmjs.com/package/@airbyte-embedded/airbyte-embedded-modal). Just change thepackage.json
version and get that onmain
and Github Actions should handle the rest.Of note, I changed the package name to be within our namespace, and reuse the pacakge/repo were were using when Embedded was a stand-alone project. I bumped the minor version to mark that change.
I also made some other minor quality-of-life improvements that I'll annotate in the comments.