Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish Widget
on:
push:
branches: [main]
paths: ["widget/**"]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
registry-url: "https://registry.npmjs.org"
- name: Install PNPM
run: npm install -g pnpm
- name: Install dependencies
run: pnpm install
- name: Publish
run: ./scripts/publish.sh
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Comment on lines +26 to +27
Copy link
Contributor Author

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.

19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,25 @@ To configure the demo, create a `.env` file in the `/demo` directory:
VITE_API_TOKEN=your_api_token_here
```

## Publishing

This repository is configured to publish to npmjs.org whenever:

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:
Copy link
Contributor

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?

Copy link
Contributor Author

@evantahler evantahler Apr 2, 2025

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 within package.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.


```bash
pnpm version <major|minor|patch>
```

and then push those changes to the main branch. Don't forget the tags!

```bash
git push origin main --tags && git push
```

## License

This software is proprietary and confidential. Commercial terms apply. Please see [LICENSE.txt](LICENSE.txt) for details or contact Airbyte, Inc. for licensing information.
3 changes: 2 additions & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h1>Airbyte Widget Demo</h1>
<div id="error" class="error"></div>
</div>
<script type="module">
import { EmbeddedWidget } from "../src/index";
import { EmbeddedWidget } from "@airbyte-embedded/airbyte-embedded-modal";
Copy link
Contributor Author

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.

Copy link
Contributor Author

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


const loadingEl = document.getElementById("loading");
const errorEl = document.getElementById("error");
Expand All @@ -42,6 +42,7 @@ <h1>Airbyte Widget Demo</h1>
client_secret: import.meta.env.VITE_AB_API_CLIENT_SECRET || "",
});

// Note: This should be an API call to the customer's backend server, not Airbyte directly
const response = await fetch(`${import.meta.env.VITE_AB_BASE_URL}/api/v1/applications/token`, {
method: "POST",
headers: {
Expand Down
3 changes: 3 additions & 0 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"test:ui": "playwright test --ui"
},
"license": "UNLICENSED",
"dependencies": {
"@airbyte-embedded/airbyte-embedded-modal": "workspace:*"
},
Comment on lines +10 to +12
Copy link
Contributor Author

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

"devDependencies": {
"@playwright/test": "^1.42.1",
"@types/node": "^22.13.14",
Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "airbyte-embedded-widget",
"version": "0.0.1",
"name": "@airbyte-embedded/airbyte-embedded-modal",
"version": "0.1.0",
"description": "Embedded widget for Airbyte",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -39,5 +39,10 @@
"jest-environment-jsdom": "^29.7.0",
"ts-jest": "^29.1.2",
"typescript": "^5.3.3"
},
"pnpm": {
"onlyBuiltDependencies": [
"esbuild"
]
}
}
Loading
Loading