Repository navigation
Publish connector snippets, prompts, and diagrams as @powersync/docs-content #788
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
Open
Chriztiaan
wants to merge
5
commits into
docs/write-api-reference-impl
Choose a base branch
from
docs/write-api-snippet-package
base: docs/write-api-reference-impl
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+912
−10
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2bc6ee2
Publish the connector snippets, write path prompts, and diagrams as a…
Chriztiaan c80775b
Merge branch 'docs/write-api-reference-impl' into docs/write-api-snip…
Chriztiaan 76db320
Describe @powersync/docs-content as general-purpose, not Dashboard-only
Chriztiaan 4b13a7c
Merge branch 'docs/write-api-reference-impl' into docs/write-api-snip…
Chriztiaan c7828d3
Add the initial @powersync/docs-content changeset
Chriztiaan 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,3 @@ | ||
| # Changesets | ||
|
|
||
| This folder holds pending release notes for [`@powersync/docs-content`](../packages/docs-content/README.md). Docs authors don't add changesets. A maintainer adds one with `pnpm changeset` when they decide to release the package. See [Releasing](../packages/docs-content/README.md#releasing). |
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/config@3.1.1/schema.json", | ||
| "changelog": "@changesets/cli/changelog", | ||
| "commit": false, | ||
| "fixed": [], | ||
| "linked": [], | ||
| "access": "public", | ||
| "baseBranch": "main", | ||
| "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,5 @@ | ||
| --- | ||
| '@powersync/docs-content': patch | ||
| --- | ||
|
|
||
| Initial release: connector snippets, write path prompts, and write path diagrams from the PowerSync docs. |
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,36 @@ | ||
| name: Build Docs Content Package | ||
|
|
||
| # The package build fails if a connector snippet, prompt, or diagram it reads | ||
| # is missing or malformed, so run it whenever those sources change. | ||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'snippets/**' | ||
| - 'images/**' | ||
| - 'packages/**' | ||
| - 'pnpm-lock.yaml' | ||
| - 'pnpm-workspace.yaml' | ||
| - '.github/workflows/build-docs-content.yaml' | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build @powersync/docs-content | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Enable Corepack | ||
| run: corepack enable | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version-file: .nvmrc | ||
| cache: pnpm | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Build package | ||
| run: pnpm --filter @powersync/docs-content build |
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,45 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
|
||
| permissions: | ||
| id-token: write # Required for OIDC / trusted publishing | ||
| contents: write # Required for changesets pushing commits | ||
| pull-requests: write # Required for changesets creating PRs | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Release | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Enable Corepack | ||
| run: corepack enable | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version-file: .nvmrc | ||
| cache: pnpm | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| # With pending changesets, this opens or updates the Version Packages PR. | ||
| # When that PR is merged, there are none left and this publishes to npm. | ||
| - name: Create Release Pull Request or Publish to npm | ||
| uses: changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d # v1.9.0 | ||
| with: | ||
| version: pnpm changeset:version | ||
| publish: pnpm release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 |
|---|---|---|
|
|
@@ -12,3 +12,6 @@ README.md | |
|
|
||
| # Scheduled agent prompts | ||
| routines/ | ||
|
|
||
| # npm packages built from the docs content | ||
| packages/ | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| dist/ | ||
| # Copied from the repository root by the build | ||
| LICENSE |
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,40 @@ | ||
| # @powersync/docs-content | ||
|
|
||
| Connector snippets, agent prompts, and diagrams from the PowerSync docs, for use outside the docs site, such as in the PowerSync Dashboard. | ||
|
|
||
| The docs are the source of truth. The build reads: | ||
|
|
||
| - `snippets/backend-connectors/**/*.mdx` | ||
| - `snippets/write-path/*-prompt.mdx` | ||
| - `images/handling-writes/*.png` | ||
|
|
||
| To change the content, edit those files. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```ts | ||
| import { CONNECTOR_URL_PLACEHOLDER, type ConnectorId } from '@powersync/docs-content'; | ||
| import connector from '@powersync/docs-content/connectors/generic/typescript'; | ||
| import prompt from '@powersync/docs-content/prompts/existing-api'; | ||
| import diagram from '@powersync/docs-content/images/write-path-overview.png'; | ||
|
|
||
| const code = connector.replace(CONNECTOR_URL_PLACEHOLDER, instanceUrl); | ||
| ``` | ||
|
|
||
| The root export also has `CONNECTOR_IDS`, `PROMPT_IDS`, and `IMAGE_IDS`. | ||
|
|
||
| Removing or renaming an ID, or changing the placeholder, is a breaking change. | ||
|
|
||
| ## Local Development | ||
|
|
||
| ```sh | ||
| pnpm --filter @powersync/docs-content build | ||
| ``` | ||
|
|
||
| To try it in another project, run `pnpm link <path-to-this-directory>` there, and rebuild after each change. | ||
|
|
||
| ## Releasing | ||
|
|
||
| 1. Run `pnpm changeset` and select `@powersync/docs-content`. | ||
| 2. Merge to `main`. The Release workflow opens a Version Packages PR. | ||
| 3. Merge that PR to publish to npm. |
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,46 @@ | ||
| { | ||
| "name": "@powersync/docs-content", | ||
| "version": "0.0.0", | ||
| "description": "Connector snippets, agent prompts, and diagrams from the PowerSync docs.", | ||
| "type": "module", | ||
| "license": "FSL-1.1-ALv2", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/powersync-ja/powersync-docs.git", | ||
| "directory": "packages/docs-content" | ||
| }, | ||
| "homepage": "https://github.com/powersync-ja/powersync-docs/tree/main/packages/docs-content#readme", | ||
| "files": [ | ||
| "dist", | ||
| "LICENSE" | ||
| ], | ||
| "sideEffects": false, | ||
| "types": "./dist/index.d.mts", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.mts", | ||
| "default": "./dist/index.mjs" | ||
| }, | ||
| "./connectors/*": { | ||
| "types": "./dist/connectors/*.d.mts", | ||
| "default": "./dist/connectors/*.mjs" | ||
| }, | ||
| "./prompts/*": { | ||
| "types": "./dist/prompts/*.d.mts", | ||
| "default": "./dist/prompts/*.mjs" | ||
| }, | ||
| "./images/*": "./dist/images/*", | ||
| "./package.json": "./package.json" | ||
| }, | ||
| "scripts": { | ||
| "build": "node scripts/build.mjs", | ||
| "prepack": "node scripts/build.mjs" | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public", | ||
| "provenance": true | ||
| }, | ||
| "engines": { | ||
| "node": ">=18" | ||
| } | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.