mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-11-02 10:13:46 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b7d177efe |
@@ -0,0 +1 @@
|
|||||||
|
1.1.40
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix UI search without ask AI enabled and fix error with questions not returned from API
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix empty sitemap
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Adapt code to pull token from customer backend generated custom cookies
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix search no results error showing while there are results
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Log component stack in Sentry
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Reintroduce a safety check around search whilst we continue investigating caching.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Apply antialiasing on any text that are not code inline/blocks to avoid contrast issues
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Handle security issue with cookies on Safari
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Investigate an issue causing caches to return empty objects instead of null/undefined.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'@gitbook/react-openapi': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Add an optional client context to get a callback called when the Scalar client is opened for a block.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix vertical section overflow color
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix pass Sentry release properly
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix shrinking page icons
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Add support for sidebar background styles
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Start using tint in more places, TOC and PageAside
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Ignore invalid API calls to `getSiteRedirectFromSource` API
|
||||||
|
|
||||||
|
To reduce the load on the API and also avoid errors.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Remove KV cache backend and only rely on DO as an external cache backend
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Ignore errors from event flushing
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Simplify search results logic to investigate a bug
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Try to fix error on og image generation
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Improve emoji setup, align with GitBook app
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Downgrade to Next.js v14 to fix incompatibilities with next-on-pages causing multiple bugs.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix an issue where the redirects of potentially malicious images were not going through.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix zoom image view transition on Safari
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Position the variant picker in the ToC
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Make cookies access safer
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Handle Firefox security error on localStorage
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix errors from customization not found
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Improve contrast of search box placeholder
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix OG image generation for non-latin characters
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Simplify the `useHash` algo used.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Ignore cache invalidation error from local backend
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Track events for site insights using the new dedicated API.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Allow only good values for theme query parameter. Avoid having a 500 error when we pass an invalid value.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Improve colour contrast of list item decoration
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Set Sentry release
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
'@gitbook/react-openapi': minor
|
||||||
|
'gitbook': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Revert scalar to 1.0.87 to mitigate an issue with ApiClientModalProvider
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
'@gitbook/react-contentkit': minor
|
||||||
|
'gitbook': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Send redirectOnError param to getPublishedContent when token is pulled from cookie
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Restyle PageAside to use sidebar list styles
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'@gitbook/react-contentkit': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix potential invalid URL error in react-contentkit
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Avoid error on fetch by passing a string URL
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix an issue where search and Ask AI triggers unnecessary renders when in a Visitor Authenticated site.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Track clicks on links (header, footer, content) for site insights.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix code format overriding inline link styles
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix emojis display
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix server actions stability leading to no results found sometimes on search
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Implement a safer way to interact with localStorage.
|
||||||
|
|
||||||
|
If it's disabled on the browser it should not throw error.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix search UI behaviour
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix two issues where pages would crash due Recoil not behaving correctly in RSC.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix dynamic tabs infinite loop
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'@gitbook/react-openapi': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Prevent codemirror from loading multiple versions in scalar
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix error when accessing a change request not found
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix variant selector contrast for non-default themes
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix issue leading to increase the storage write and the stability of the platform
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Force route handler to be dynamic to avoid errors
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'@gitbook/react-openapi': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Updated scalar depdenency
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix search loading state
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix Sentry instrumentation
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Even safer localStorage
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Avoid errors on legacy browsers
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Add antialiasing for text rendering
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Improve readability of tables with hover style and vertical dividers
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Improve styling of header buttons with shadows and high-contrast styles
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix viewing PDF from space
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Image optimization endpoint redirects to underlying image URL if the signature is not the latest.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix bullet list display on full size blocks
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Vertical orientation for sections list on sites without header
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix error when accessing some not found pages.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix "Parser" language syntax highlighting
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix a vulnerability issue for images using an older version of the image signing parameter.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Track an event into site insights when visitor is opening the Scalar API client.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Upgrade Next.js to v15, upgrade Shiki and use JS RegExp engine
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix breadcrumbs emoji display + add contrast styles
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix server actions cache compromised. Leading to some bugs on frontend.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Improve smoothness of scroll listener
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix variant dropdown styling in header
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix view transition error on Safari
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Bump `heading-3` font size to offset it from paragraphs
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix Sentry instrumentation server-side
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'gitbook': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Remove animation on section tabs. Page is reloaded (for technical reasons), so the animation is not accurate here.
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
name: 'Deploy vercel'
|
|
||||||
description: 'Deploy GitBook to Vercel'
|
|
||||||
inputs:
|
|
||||||
vercel-org:
|
|
||||||
description: 'Vercel organization'
|
|
||||||
required: true
|
|
||||||
vercel-project:
|
|
||||||
description: 'Vercel project'
|
|
||||||
required: true
|
|
||||||
vercel-token:
|
|
||||||
description: 'Vercel token'
|
|
||||||
required: true
|
|
||||||
environment:
|
|
||||||
description: 'Environment to deploy to'
|
|
||||||
required: true
|
|
||||||
outputs:
|
|
||||||
deployment-url:
|
|
||||||
description: "Deployment URL"
|
|
||||||
value: ${{ steps.deploy.outputs.deployment-url }}
|
|
||||||
runs:
|
|
||||||
using: 'composite'
|
|
||||||
steps:
|
|
||||||
- name: Setup Bun
|
|
||||||
uses: ./.github/composite/setup-bun
|
|
||||||
- name: Install dependencies
|
|
||||||
run: bun install --frozen-lockfile
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
PUPPETEER_SKIP_DOWNLOAD: 1
|
|
||||||
- name: Sets env vars for environment
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "VERCEL_ENVIRONMENT=${{ inputs.environment }}" >> $GITHUB_ENV
|
|
||||||
- name: Pull Vercel Environment Information
|
|
||||||
run: bun run vercel pull --yes --environment=$VERCEL_ENVIRONMENT --token=${{ inputs.vercel-token }}
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
VERCEL_ORG_ID: ${{ inputs.vercel-org }}
|
|
||||||
VERCEL_PROJECT_ID: ${{ inputs.vercel-project }}
|
|
||||||
- name: Build Project Artifacts
|
|
||||||
run: bun run vercel build --target=$VERCEL_ENVIRONMENT --token=${{ inputs.vercel-token }}
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
VERCEL_ORG_ID: ${{ inputs.vercel-org }}
|
|
||||||
VERCEL_PROJECT_ID: ${{ inputs.vercel-project }}
|
|
||||||
- name: Deploy Project Artifacts to Vercel
|
|
||||||
id: deploy
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
DEPLOYMENT_URL=$(bun run vercel deploy --prebuilt --target=$VERCEL_ENVIRONMENT --token=${{ inputs.vercel-token }})
|
|
||||||
echo "deployment-url=$DEPLOYMENT_URL" >> "$GITHUB_OUTPUT"
|
|
||||||
env:
|
|
||||||
VERCEL_ORG_ID: ${{ inputs.vercel-org }}
|
|
||||||
VERCEL_PROJECT_ID: ${{ inputs.vercel-project }}
|
|
||||||
- name: Outputs
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "URL: ${{ steps.deploy.outputs.deployment-url }}"
|
|
||||||
@@ -15,4 +15,4 @@ runs:
|
|||||||
- name: Setup bun
|
- name: Setup bun
|
||||||
uses: oven-sh/setup-bun@v2
|
uses: oven-sh/setup-bun@v2
|
||||||
with:
|
with:
|
||||||
bun-version-file: 'package.json'
|
bun-version-file: '.bun-version'
|
||||||
|
|||||||
+31
-202
@@ -18,8 +18,7 @@ jobs:
|
|||||||
checks: write
|
checks: write
|
||||||
statuses: write
|
statuses: write
|
||||||
outputs:
|
outputs:
|
||||||
deployment-url: ${{ steps.deploy.outputs.deployment-url }}
|
deployment_url: ${{ steps.deploy.outputs.deployment-url }}
|
||||||
deployment-alias-url: ${{ steps.deploy.outputs.deployment-alias-url }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -39,7 +38,7 @@ jobs:
|
|||||||
echo "SENTRY_ENVIRONMENT=preview" >> $GITHUB_ENV
|
echo "SENTRY_ENVIRONMENT=preview" >> $GITHUB_ENV
|
||||||
if: 1 && !startsWith(github.ref, 'refs/heads/main')
|
if: 1 && !startsWith(github.ref, 'refs/heads/main')
|
||||||
- name: Build Next.js with next-on-pages
|
- name: Build Next.js with next-on-pages
|
||||||
run: bun run turbo gitbook#build:cloudflare
|
run: bun run build:cloudflare
|
||||||
env:
|
env:
|
||||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||||
NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: ${{ secrets.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY }}
|
NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: ${{ secrets.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY }}
|
||||||
@@ -49,7 +48,7 @@ jobs:
|
|||||||
SENTRY_RELEASE: ${{ github.sha }}
|
SENTRY_RELEASE: ${{ github.sha }}
|
||||||
- id: deploy
|
- id: deploy
|
||||||
name: Deploy to Cloudflare
|
name: Deploy to Cloudflare
|
||||||
uses: cloudflare/wrangler-action@v3.14.0
|
uses: cloudflare/wrangler-action@v3.11.0
|
||||||
with:
|
with:
|
||||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||||
@@ -75,156 +74,31 @@ jobs:
|
|||||||
-H "Accept: application/vnd.github.v3+json" \
|
-H "Accept: application/vnd.github.v3+json" \
|
||||||
-d '{"state": "success", "target_url": "${{ steps.deploy.outputs.deployment-url }}", "description": "Deployed Preview URL for commit", "context": "cloudflare/preview"}' \
|
-d '{"state": "success", "target_url": "${{ steps.deploy.outputs.deployment-url }}", "description": "Deployed Preview URL for commit", "context": "cloudflare/preview"}' \
|
||||||
https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }}
|
https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }}
|
||||||
deploy-v2-vercel:
|
|
||||||
name: Deploy v2 to Vercel
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
deployments: write
|
|
||||||
issues: write
|
|
||||||
pull-requests: write
|
|
||||||
checks: write
|
|
||||||
statuses: write
|
|
||||||
outputs:
|
|
||||||
deployment-url: ${{ steps.deploy.outputs.deployment-url }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Deploy ${{ github.ref == 'refs/heads/main' && 'production' || 'preview' }}
|
|
||||||
id: deploy
|
|
||||||
uses: ./.github/composite/deploy-vercel
|
|
||||||
with:
|
|
||||||
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'preview' }}
|
|
||||||
vercel-org: ${{ secrets.VERCEL_ORG_ID }}
|
|
||||||
vercel-project: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
||||||
vercel-token: ${{ secrets.VERCEL_TOKEN }}
|
|
||||||
deploy-v2-vercel-staging:
|
|
||||||
name: Deploy v2 to Vercel (staging)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
deployments: write
|
|
||||||
issues: write
|
|
||||||
pull-requests: write
|
|
||||||
checks: write
|
|
||||||
statuses: write
|
|
||||||
if: startsWith(github.ref, 'refs/heads/main')
|
|
||||||
outputs:
|
|
||||||
deployment-url: ${{ steps.deploy.outputs.deployment-url }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Deploy staging
|
|
||||||
id: deploy
|
|
||||||
uses: ./.github/composite/deploy-vercel
|
|
||||||
with:
|
|
||||||
environment: staging
|
|
||||||
vercel-org: ${{ secrets.VERCEL_ORG_ID }}
|
|
||||||
vercel-project: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
||||||
vercel-token: ${{ secrets.VERCEL_TOKEN }}
|
|
||||||
deploy-v2-cloudflare:
|
|
||||||
name: Deploy v2 to Cloudflare Worker
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
deployments: write
|
|
||||||
issues: write
|
|
||||||
pull-requests: write
|
|
||||||
checks: write
|
|
||||||
statuses: write
|
|
||||||
outputs:
|
|
||||||
deployment-url: ${{ steps.deploy.outputs.deployment-url }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Setup Bun
|
|
||||||
uses: ./.github/composite/setup-bun
|
|
||||||
- name: Install dependencies
|
|
||||||
run: bun install --frozen-lockfile
|
|
||||||
env:
|
|
||||||
PUPPETEER_SKIP_DOWNLOAD: 1
|
|
||||||
- name: Sets env vars for production
|
|
||||||
run: |
|
|
||||||
echo "SENTRY_ENVIRONMENT=production" >> $GITHUB_ENV
|
|
||||||
echo "GITBOOK_URL=https://open-2c.gitbook.com" >> $GITHUB_ENV
|
|
||||||
echo "GITBOOK_ASSETS_PREFIX=https://static-2c.gitbook.com" >> $GITHUB_ENV
|
|
||||||
if: startsWith(github.ref, 'refs/heads/main')
|
|
||||||
- name: Sets env vars for preview
|
|
||||||
run: |
|
|
||||||
echo "SENTRY_ENVIRONMENT=preview" >> $GITHUB_ENV
|
|
||||||
if: 1 && !startsWith(github.ref, 'refs/heads/main')
|
|
||||||
- name: Build worker
|
|
||||||
run: bun run turbo build:v2:cloudflare
|
|
||||||
env:
|
|
||||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
||||||
NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: ${{ secrets.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY }}
|
|
||||||
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
|
|
||||||
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
|
|
||||||
SENTRY_DSN: ${{ vars.SENTRY_DSN }}
|
|
||||||
SENTRY_RELEASE: ${{ github.sha }}
|
|
||||||
- id: deploy
|
|
||||||
name: Deploy to Cloudflare
|
|
||||||
uses: cloudflare/wrangler-action@v3.14.0
|
|
||||||
with:
|
|
||||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
||||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
||||||
workingDirectory: ./
|
|
||||||
wranglerVersion: '3.82.0'
|
|
||||||
command: versions upload --config ./packages/gitbook-v2/wrangler.toml
|
|
||||||
- name: Outputs
|
|
||||||
run: |
|
|
||||||
echo "URL: ${{ steps.deploy.outputs.deployment-url }}"
|
|
||||||
comment-deployments:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Comment Deployments
|
|
||||||
if: always() && !startsWith(github.ref, 'refs/heads/main')
|
|
||||||
needs:
|
|
||||||
- deploy
|
|
||||||
- deploy-v2-vercel
|
|
||||||
- deploy-v2-cloudflare
|
|
||||||
steps:
|
|
||||||
- name: Find GitHub Comment
|
- name: Find GitHub Comment
|
||||||
uses: peter-evans/find-comment@v3
|
uses: peter-evans/find-comment@v3
|
||||||
id: fc
|
id: fc
|
||||||
|
if: 1 && !startsWith(github.ref, 'refs/heads/main')
|
||||||
with:
|
with:
|
||||||
issue-number: ${{ github.event.pull_request.number }}
|
issue-number: ${{ github.event.pull_request.number }}
|
||||||
comment-author: 'github-actions[bot]'
|
comment-author: 'github-actions[bot]'
|
||||||
body-includes: 'Summary of the deployments'
|
body-includes: GitBook Preview
|
||||||
|
|
||||||
- name: Create or update GitHub comment
|
- name: Create or update GitHub comment
|
||||||
uses: peter-evans/create-or-update-comment@v4
|
uses: peter-evans/create-or-update-comment@v4
|
||||||
|
if: 1 && !startsWith(github.ref, 'refs/heads/main')
|
||||||
with:
|
with:
|
||||||
comment-id: ${{ steps.fc.outputs.comment-id }}
|
comment-id: ${{ steps.fc.outputs.comment-id }}
|
||||||
issue-number: ${{ github.event.pull_request.number }}
|
issue-number: ${{ github.event.pull_request.number }}
|
||||||
body: |
|
body: |
|
||||||
Summary of the deployments:
|
**GitBook Preview**
|
||||||
|
Latest commit: [${{ steps.deploy.outputs.deployment-url }}](${{ steps.deploy.outputs.deployment-url }})
|
||||||
### Version 1 (production)
|
PR: [${{ steps.deploy.outputs.deployment-alias-url }}](${{ steps.deploy.outputs.deployment-alias-url }})
|
||||||
|
|
||||||
| Version | URL | Status |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| Latest commit | [${{ needs.deploy.outputs.deployment-url }}](${{ needs.deploy.outputs.deployment-url }}) | ${{ needs.deploy.result == 'success' && '✅' || '❌' }} |
|
|
||||||
| PR | [${{ needs.deploy.outputs.deployment-alias-url }}](${{ needs.deploy.outputs.deployment-alias-url }}) | ${{ needs.deploy.result == 'success' && '✅' || '❌' }} |
|
|
||||||
|
|
||||||
### Version 2 (experimental)
|
|
||||||
|
|
||||||
| Version | URL | Status |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| Vercel | [${{ needs.deploy-v2-vercel.outputs.deployment-url }}](${{ needs.deploy-v2-vercel.outputs.deployment-url }}) | ${{ needs.deploy-v2-vercel.result == 'success' && '✅' || '❌' }} |
|
|
||||||
| Cloudflare | [${{ needs.deploy-v2-cloudflare.outputs.deployment-url }}](${{ needs.deploy-v2-cloudflare.outputs.deployment-url }}) | ${{ needs.deploy-v2-cloudflare.result == 'success' && '✅' || '❌' }} |
|
|
||||||
|
|
||||||
### Test content
|
|
||||||
|
|
||||||
| Site | v1 | v2 |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| GitBook | [${{ needs.deploy.outputs.deployment-url }}/docs.gitbook.com](${{ needs.deploy.outputs.deployment-url }}/docs.gitbook.com) | [${{ needs.deploy-v2-vercel.outputs.deployment-url }}/url/docs.gitbook.com](${{ needs.deploy-v2-vercel.outputs.deployment-url }}/url/docs.gitbook.com) |
|
|
||||||
| E2E | [${{ needs.deploy.outputs.deployment-url }}/gitbook.gitbook.io/test-gitbook-open](${{ needs.deploy.outputs.deployment-url }}/gitbook.gitbook.io/test-gitbook-open) | [${{ needs.deploy-v2-vercel.outputs.deployment-url }}/url/gitbook.gitbook.io/test-gitbook-open](${{ needs.deploy-v2-vercel.outputs.deployment-url }}/url/gitbook.gitbook.io/test-gitbook-open) |
|
|
||||||
edit-mode: replace
|
edit-mode: replace
|
||||||
visual-testing:
|
visual-testing:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Visual Testing
|
name: Visual Testing
|
||||||
needs: deploy
|
needs: deploy
|
||||||
timeout-minutes: 6
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -237,68 +111,14 @@ jobs:
|
|||||||
- name: Run Playwright tests
|
- name: Run Playwright tests
|
||||||
run: bun e2e
|
run: bun e2e
|
||||||
env:
|
env:
|
||||||
BASE_URL: ${{ needs.deploy.outputs.deployment-url }}
|
BASE_URL: ${{needs.deploy.outputs.deployment_url}}
|
||||||
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
|
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
|
||||||
visual-testing-v2:
|
- uses: actions/upload-artifact@v4
|
||||||
runs-on: ubuntu-latest
|
if: ${{ !cancelled() }}
|
||||||
name: Visual Testing v2
|
with:
|
||||||
needs: deploy-v2-vercel
|
name: playwright-test-results
|
||||||
timeout-minutes: 6
|
path: packages/gitbook/test-results/
|
||||||
steps:
|
retention-days: 3
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Setup Bun
|
|
||||||
uses: ./.github/composite/setup-bun
|
|
||||||
- name: Install dependencies
|
|
||||||
run: bun install --frozen-lockfile
|
|
||||||
- name: Setup Playwright
|
|
||||||
uses: ./.github/actions/setup-playwright
|
|
||||||
- name: Run Playwright tests
|
|
||||||
run: bun e2e
|
|
||||||
env:
|
|
||||||
BASE_URL: ${{ needs.deploy-v2-vercel.outputs.deployment-url }}/url/
|
|
||||||
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
|
|
||||||
ARGOS_BUILD_NAME: 'v2'
|
|
||||||
visual-testing-customers:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Visual Testing Customers
|
|
||||||
needs: deploy
|
|
||||||
timeout-minutes: 6
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Setup Bun
|
|
||||||
uses: ./.github/composite/setup-bun
|
|
||||||
- name: Install dependencies
|
|
||||||
run: bun install --frozen-lockfile
|
|
||||||
- name: Setup Playwright
|
|
||||||
uses: ./.github/actions/setup-playwright
|
|
||||||
- name: Run Playwright tests
|
|
||||||
run: bun e2e-customers
|
|
||||||
env:
|
|
||||||
BASE_URL: ${{ needs.deploy.outputs.deployment-url }}
|
|
||||||
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
|
|
||||||
ARGOS_BUILD_NAME: 'customers'
|
|
||||||
visual-testing-customers-v2:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Visual Testing Customers v2
|
|
||||||
needs: deploy-v2-vercel
|
|
||||||
timeout-minutes: 6
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Setup Bun
|
|
||||||
uses: ./.github/composite/setup-bun
|
|
||||||
- name: Install dependencies
|
|
||||||
run: bun install --frozen-lockfile
|
|
||||||
- name: Setup Playwright
|
|
||||||
uses: ./.github/actions/setup-playwright
|
|
||||||
- name: Run Playwright tests
|
|
||||||
run: bun e2e-customers
|
|
||||||
env:
|
|
||||||
BASE_URL: ${{ needs.deploy-v2-vercel.outputs.deployment-url }}/url/
|
|
||||||
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
|
|
||||||
ARGOS_BUILD_NAME: 'customers-v2'
|
|
||||||
pagespeed-testing:
|
pagespeed-testing:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: PageSpeed Testing
|
name: PageSpeed Testing
|
||||||
@@ -315,12 +135,11 @@ jobs:
|
|||||||
- name: Run pagespeed tests
|
- name: Run pagespeed tests
|
||||||
run: bun ./packages/gitbook/tests/pagespeed-testing.ts $DEPLOYMENT_URL
|
run: bun ./packages/gitbook/tests/pagespeed-testing.ts $DEPLOYMENT_URL
|
||||||
env:
|
env:
|
||||||
DEPLOYMENT_URL: ${{needs.deploy.outputs.deployment-url}}
|
DEPLOYMENT_URL: ${{needs.deploy.outputs.deployment_url}}
|
||||||
PAGESPEED_API_KEY: ${{ secrets.PAGESPEED_API_KEY }}
|
PAGESPEED_API_KEY: ${{ secrets.PAGESPEED_API_KEY }}
|
||||||
format:
|
format:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Format
|
name: Format
|
||||||
timeout-minutes: 6
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -331,10 +150,22 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
PUPPETEER_SKIP_DOWNLOAD: 1
|
PUPPETEER_SKIP_DOWNLOAD: 1
|
||||||
- run: bun format:check
|
- run: bun format:check
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Lint
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Bun
|
||||||
|
uses: ./.github/composite/setup-bun
|
||||||
|
- name: Install dependencies
|
||||||
|
run: bun install --frozen-lockfile
|
||||||
|
env:
|
||||||
|
PUPPETEER_SKIP_DOWNLOAD: 1
|
||||||
|
- run: bun lint --no-cache
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Test
|
name: Test
|
||||||
timeout-minutes: 6
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -349,7 +180,6 @@ jobs:
|
|||||||
# CI to check that the repository builds correctly on a machine without the credentials
|
# CI to check that the repository builds correctly on a machine without the credentials
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Build (Open Source)
|
name: Build (Open Source)
|
||||||
timeout-minutes: 6
|
|
||||||
env:
|
env:
|
||||||
NPM_TOKEN_READONLY: ''
|
NPM_TOKEN_READONLY: ''
|
||||||
steps:
|
steps:
|
||||||
@@ -365,7 +195,6 @@ jobs:
|
|||||||
typecheck:
|
typecheck:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Typecheck
|
name: Typecheck
|
||||||
timeout-minutes: 6
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|||||||
@@ -28,12 +28,11 @@ jobs:
|
|||||||
uses: changesets/action@v1
|
uses: changesets/action@v1
|
||||||
with:
|
with:
|
||||||
publish: npm run release
|
publish: npm run release
|
||||||
version: npm run changeset-version
|
|
||||||
env:
|
env:
|
||||||
# Using a PAT instead of GITHUB_TOKEN because we need to run workflows when releases are created
|
# Using a PAT instead of GITHUB_TOKEN because we need to run workflows when releases are created
|
||||||
# https://github.com/orgs/community/discussions/26875#discussioncomment-3253761
|
# https://github.com/orgs/community/discussions/26875#discussioncomment-3253761
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_PERSONAL_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GH_PERSONAL_TOKEN }}
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN_READONLY: ${{ secrets.NPM_TOKEN_READONLY }}
|
||||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
release-preview:
|
release-preview:
|
||||||
|
|||||||
@@ -22,6 +22,3 @@ yarn-error.log*
|
|||||||
|
|
||||||
# Env files
|
# Env files
|
||||||
.env.local
|
.env.local
|
||||||
|
|
||||||
# TypeScript
|
|
||||||
*.tsbuildinfo
|
|
||||||
|
|||||||
+1
-5
@@ -1,6 +1,5 @@
|
|||||||
.next
|
.next
|
||||||
.vercel
|
.vercel
|
||||||
.open-next
|
|
||||||
|
|
||||||
# Generated
|
# Generated
|
||||||
packages/emoji-codepoints/index.ts
|
packages/emoji-codepoints/index.ts
|
||||||
@@ -11,7 +10,4 @@ packages/icons/src/data/*.json
|
|||||||
dist/
|
dist/
|
||||||
|
|
||||||
README.md
|
README.md
|
||||||
CHANGELOG.md
|
CHANGELOG.md
|
||||||
|
|
||||||
# v2
|
|
||||||
packages/gitbook-v2/public/~gitbook/static/
|
|
||||||
Vendored
-3
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"recommendations": ["biomejs.biome"]
|
|
||||||
}
|
|
||||||
Vendored
+1
-6
@@ -7,10 +7,5 @@
|
|||||||
["style \\=([^;]*);", "\"([^\"]*)\""],
|
["style \\=([^;]*);", "\"([^\"]*)\""],
|
||||||
["style \\=([^;]*);", "\\`([^\\`]*)\\`"]
|
["style \\=([^;]*);", "\\`([^\\`]*)\\`"]
|
||||||
],
|
],
|
||||||
"tailwindCSS.classAttributes": ["class", "className", "style", ".*Style"],
|
"tailwindCSS.classAttributes": ["class", "className", "style", ".*Style"]
|
||||||
"prettier.enable": false,
|
|
||||||
"editor.defaultFormatter": "biomejs.biome",
|
|
||||||
"editor.codeActionsOnSave": {
|
|
||||||
"source.organizeImports": "explicit"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,10 +35,8 @@ To run a local version of this project, please follow these simple steps.
|
|||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|
||||||
- Node.js (Version: >=20.6)
|
- Node.js (Version: >=18.x)
|
||||||
- Use nvm for easy Node management
|
- Bun
|
||||||
- Bun (Version: >=1.2.1)
|
|
||||||
- We use a text-based lockfile which isn't supported below 1.2.1
|
|
||||||
|
|
||||||
### Set up
|
### Set up
|
||||||
|
|
||||||
|
|||||||
-168
@@ -1,168 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
|
|
||||||
"vcs": {
|
|
||||||
"enabled": false,
|
|
||||||
"clientKind": "git",
|
|
||||||
"useIgnoreFile": false
|
|
||||||
},
|
|
||||||
"files": {
|
|
||||||
"ignoreUnknown": false,
|
|
||||||
"ignore": [
|
|
||||||
"**/node_modules/**/*",
|
|
||||||
"**/dist/**/*",
|
|
||||||
"**/build/**/*",
|
|
||||||
"**/public/**/*",
|
|
||||||
"**/.next/**/*",
|
|
||||||
"**/.open-next/**/*",
|
|
||||||
"**/.turbo/**/*",
|
|
||||||
"**/.vercel/**/*",
|
|
||||||
"**/.cache/**/*",
|
|
||||||
"**/.wrangler/**/*",
|
|
||||||
"packages/openapi-parser/src/fixtures/**/*"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"formatter": {
|
|
||||||
"enabled": true,
|
|
||||||
"useEditorconfig": true,
|
|
||||||
"formatWithErrors": false,
|
|
||||||
"indentStyle": "space",
|
|
||||||
"indentWidth": 4,
|
|
||||||
"lineEnding": "lf",
|
|
||||||
"lineWidth": 100,
|
|
||||||
"attributePosition": "auto",
|
|
||||||
"bracketSpacing": true
|
|
||||||
},
|
|
||||||
"organizeImports": {
|
|
||||||
"enabled": true
|
|
||||||
},
|
|
||||||
"linter": {
|
|
||||||
"enabled": true,
|
|
||||||
"rules": {
|
|
||||||
"recommended": true,
|
|
||||||
"performance": {
|
|
||||||
"noDelete": "warn"
|
|
||||||
},
|
|
||||||
"security": {
|
|
||||||
"noDangerouslySetInnerHtml": "off"
|
|
||||||
},
|
|
||||||
"complexity": {
|
|
||||||
"noForEach": "off",
|
|
||||||
"noUselessFragments": "warn",
|
|
||||||
"noBannedTypes": "warn"
|
|
||||||
},
|
|
||||||
"correctness": {
|
|
||||||
"noUndeclaredVariables": "error",
|
|
||||||
"noUnusedVariables": "error",
|
|
||||||
"useArrayLiterals": "error",
|
|
||||||
"useHookAtTopLevel": "error",
|
|
||||||
"noUnusedImports": "error",
|
|
||||||
"noVoidElementsWithChildren": "warn",
|
|
||||||
"useJsxKeyInIterable": "warn",
|
|
||||||
"useExhaustiveDependencies": "warn",
|
|
||||||
"noUnknownFunction": "warn"
|
|
||||||
},
|
|
||||||
"style": {
|
|
||||||
"noNonNullAssertion": "warn",
|
|
||||||
"noParameterAssign": "off",
|
|
||||||
"useThrowOnlyError": "error"
|
|
||||||
},
|
|
||||||
"suspicious": {
|
|
||||||
"noConsole": "warn",
|
|
||||||
"noExplicitAny": "warn",
|
|
||||||
"noImplicitAnyLet": "warn",
|
|
||||||
"noConfusingVoidType": "warn",
|
|
||||||
"noControlCharactersInRegex": "warn",
|
|
||||||
"noPrototypeBuiltins": "warn",
|
|
||||||
"noAssignInExpressions": "warn",
|
|
||||||
"noArrayIndexKey": "warn"
|
|
||||||
},
|
|
||||||
"a11y": {
|
|
||||||
"useSemanticElements": "warn",
|
|
||||||
"useKeyWithClickEvents": "warn",
|
|
||||||
"noSvgWithoutTitle": "warn",
|
|
||||||
"useButtonType": "warn",
|
|
||||||
"useIframeTitle": "warn",
|
|
||||||
"useAltText": "warn",
|
|
||||||
"noPositiveTabindex": "warn",
|
|
||||||
"useFocusableInteractive": "warn",
|
|
||||||
"useAriaPropsForRole": "warn",
|
|
||||||
"useValidAnchor": "warn",
|
|
||||||
"noLabelWithoutControl": "warn",
|
|
||||||
"noNoninteractiveTabindex": "warn"
|
|
||||||
},
|
|
||||||
"nursery": {
|
|
||||||
"useSortedClasses": {
|
|
||||||
"level": "error",
|
|
||||||
"fix": "safe",
|
|
||||||
"options": {
|
|
||||||
"attributes": ["class", "className", "style"],
|
|
||||||
"functions": ["clsx", "tw"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"javascript": {
|
|
||||||
"formatter": {
|
|
||||||
"jsxQuoteStyle": "double",
|
|
||||||
"quoteProperties": "asNeeded",
|
|
||||||
"trailingCommas": "es5",
|
|
||||||
"semicolons": "always",
|
|
||||||
"arrowParentheses": "always",
|
|
||||||
"bracketSameLine": false,
|
|
||||||
"quoteStyle": "single",
|
|
||||||
"attributePosition": "auto",
|
|
||||||
"bracketSpacing": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"include": [
|
|
||||||
"packages/gitbook/**/*",
|
|
||||||
"packages/gitbook-v2/**/*",
|
|
||||||
"packages/react-openapi/**/*",
|
|
||||||
"packages/react-math/**/*",
|
|
||||||
"packages/react-contentkit/**/*",
|
|
||||||
"packages/icons/**/*"
|
|
||||||
],
|
|
||||||
"javascript": {
|
|
||||||
"globals": ["React"]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": ["packages/gitbook/**/*"],
|
|
||||||
"javascript": {
|
|
||||||
"globals": ["React", "GitBookIntegrationEvent"]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": ["*.css"],
|
|
||||||
"javascript": {
|
|
||||||
"globals": ["theme"]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": ["*.test.ts", "packages/gitbook/tests/**/*"],
|
|
||||||
"javascript": {
|
|
||||||
"globals": ["Bun"]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": [
|
|
||||||
"packages/cache-do/**/*",
|
|
||||||
"packages/gitbook/cf-env.d.ts",
|
|
||||||
"packages/gitbook/src/cloudflare-entrypoint.ts"
|
|
||||||
],
|
|
||||||
"javascript": {
|
|
||||||
"globals": [
|
|
||||||
"DurableObjectLocationHint",
|
|
||||||
"DurableObjectNamespace",
|
|
||||||
"DurableObjectStub",
|
|
||||||
"ContinentCode",
|
|
||||||
"Fetcher",
|
|
||||||
"ExportedHandler"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
# Caching
|
||||||
|
|
||||||
|
## Revalidating the cache
|
||||||
|
|
||||||
|
Invalidate cache can be done at two levels using tags:
|
||||||
|
|
||||||
|
- Data fetching cache
|
||||||
|
- Rendering cache
|
||||||
|
|
||||||
|
To invalidate and refetch the data cache, you can execute a POST request to `/~/gitbook/revalidate`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl --location --request POST 'https://gitbook/mycompany.com/~gitbook/revalidate' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data-raw '{"tags": ["space.id"]}'
|
||||||
|
```
|
||||||
|
|
||||||
|
To invalidate the rendering cache, the implementation mainly depends on the infrastructure serving the content, GitBook outputs a `Cache-Tag` header on every requests. The value of the header is a comma separated list of tags.
|
||||||
|
|
||||||
|
## Purging the cache
|
||||||
|
|
||||||
|
Purging the cache, without revalidating, is done by passing `"purge": true` in the request body.
|
||||||
+14
-15
@@ -2,12 +2,11 @@
|
|||||||
"name": "gitbook",
|
"name": "gitbook",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "^1.9.4",
|
"@changesets/cli": "^2.27.7",
|
||||||
"@changesets/cli": "^2.27.12",
|
"prettier": "^3.0.3",
|
||||||
"turbo": "^2.4.4",
|
"turbo": "^2.1.2"
|
||||||
"vercel": "^39.3.0"
|
|
||||||
},
|
},
|
||||||
"packageManager": "bun@1.2.4",
|
"packageManager": "bun@1.1.18",
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"@codemirror/state": "6.4.1",
|
"@codemirror/state": "6.4.1",
|
||||||
"react": "18.3.1",
|
"react": "18.3.1",
|
||||||
@@ -15,27 +14,27 @@
|
|||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "turbo run dev",
|
"dev": "turbo run dev --ui=stream",
|
||||||
"dev:v2": "turbo run dev:v2",
|
|
||||||
"build": "turbo run build",
|
"build": "turbo run build",
|
||||||
"build:v2": "turbo run build:v2",
|
"build:cloudflare": "turbo run build:cloudflare",
|
||||||
"clean-deps": "rm -rf node_modules && rm -rf packages/*/node_modules",
|
"lint": "turbo run lint",
|
||||||
|
"lint:fix": "turbo run lint -- --fix",
|
||||||
"typecheck": "turbo run typecheck",
|
"typecheck": "turbo run typecheck",
|
||||||
"format": "biome check --write ./",
|
"format": "prettier ./ --ignore-unknown --write",
|
||||||
"format:check": "biome check --diagnostic-level=error ./",
|
"format:check": "prettier ./ --ignore-unknown --list-different",
|
||||||
"unit": "turbo run unit",
|
"unit": "turbo run unit",
|
||||||
"e2e": "turbo run e2e",
|
"e2e": "turbo run e2e",
|
||||||
"e2e-customers": "turbo run e2e-customers",
|
|
||||||
"changeset": "changeset",
|
"changeset": "changeset",
|
||||||
"changeset-version": "changeset version && bun run format",
|
|
||||||
"release": "turbo run release && changeset publish",
|
"release": "turbo run release && changeset publish",
|
||||||
"release:preview": "turbo run release:preview",
|
"release:preview": "turbo run release:preview",
|
||||||
"download:env": "op read op://gitbook-x-dev/gitbook-open/.env.local >> .env.local",
|
"download:env": "op read op://gitbook-x-dev/gitbook-open/.env.local >> .env.local",
|
||||||
"clean": "turbo run clean"
|
"clean": "turbo run clean"
|
||||||
},
|
},
|
||||||
"workspaces": ["packages/*"],
|
"workspaces": [
|
||||||
|
"packages/*"
|
||||||
|
],
|
||||||
"patchedDependencies": {
|
"patchedDependencies": {
|
||||||
"decode-named-character-reference@1.0.2": "patches/decode-named-character-reference@1.0.2.patch",
|
"decode-named-character-reference@1.0.2": "patches/decode-named-character-reference@1.0.2.patch",
|
||||||
"@vercel/next@4.4.2": "patches/@vercel%2Fnext@4.4.2.patch"
|
"@vercel/next@4.3.15": "patches/@vercel%2Fnext@4.3.15.patch"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^5.5.3",
|
"typescript": "^5.5.3",
|
||||||
"wrangler": "^3.109.2"
|
"wrangler": "3.82.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"generate": "wrangler types --experimental-include-runtime",
|
"generate": "wrangler types --experimental-include-runtime",
|
||||||
@@ -31,5 +31,12 @@
|
|||||||
"release": "wrangler deploy",
|
"release": "wrangler deploy",
|
||||||
"release:preview": "wrangler deploy && wrangler deploy --env preview"
|
"release:preview": "wrangler deploy && wrangler deploy --env preview"
|
||||||
},
|
},
|
||||||
"files": ["dist", "src", "bin", "data", "README.md", "CHANGELOG.md"]
|
"files": [
|
||||||
|
"dist",
|
||||||
|
"src",
|
||||||
|
"bin",
|
||||||
|
"data",
|
||||||
|
"README.md",
|
||||||
|
"CHANGELOG.md"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
import { encode, decode } from '@msgpack/msgpack';
|
||||||
import { DurableObject } from 'cloudflare:workers';
|
import { DurableObject } from 'cloudflare:workers';
|
||||||
import { decode, encode } from '@msgpack/msgpack';
|
|
||||||
import { LRUMap } from 'lru_map';
|
import { LRUMap } from 'lru_map';
|
||||||
|
|
||||||
export interface CacheObjectDescriptor {
|
export interface CacheObjectDescriptor {
|
||||||
@@ -137,7 +137,7 @@ export class CacheObject extends DurableObject {
|
|||||||
*/
|
*/
|
||||||
public async purge() {
|
public async purge() {
|
||||||
return this.logOperation({ operation: 'purge' }, async (setLog) => {
|
return this.logOperation({ operation: 'purge' }, async (setLog) => {
|
||||||
const result = new Set<string>();
|
let result = new Set<string>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// List all the keys in the cache object.
|
// List all the keys in the cache object.
|
||||||
@@ -149,7 +149,11 @@ export class CacheObject extends DurableObject {
|
|||||||
entries.forEach((exp) => {
|
entries.forEach((exp) => {
|
||||||
result.add(exp.k);
|
result.add(exp.k);
|
||||||
});
|
});
|
||||||
} catch (_error) {}
|
} catch (error) {
|
||||||
|
// If an error occurs, reset the cache object.
|
||||||
|
// This is a safety mechanism to prevent the cache object from being stuck in a bad state.
|
||||||
|
console.error('Error during purge, resetting the cache object', error);
|
||||||
|
}
|
||||||
|
|
||||||
await this.reset();
|
await this.reset();
|
||||||
return Array.from(result);
|
return Array.from(result);
|
||||||
@@ -170,7 +174,7 @@ export class CacheObject extends DurableObject {
|
|||||||
const toDeleteSet = new Set<string>();
|
const toDeleteSet = new Set<string>();
|
||||||
|
|
||||||
for (const [key, exp] of entries) {
|
for (const [key, exp] of entries) {
|
||||||
const timestamp = Number.parseInt(key.split('.')[1]);
|
const timestamp = parseInt(key.split('.')[1]);
|
||||||
if (timestamp < Date.now()) {
|
if (timestamp < Date.now()) {
|
||||||
toDeleteSet.add(key);
|
toDeleteSet.add(key);
|
||||||
for (let i = 0; i < exp.c; i++) {
|
for (let i = 0; i < exp.c; i++) {
|
||||||
@@ -190,7 +194,10 @@ export class CacheObject extends DurableObject {
|
|||||||
if (toDelete.length) {
|
if (toDelete.length) {
|
||||||
await this.ctx.storage.setAlarm(Date.now() + 12 * 60 * 60 * 1000);
|
await this.ctx.storage.setAlarm(Date.now() + 12 * 60 * 60 * 1000);
|
||||||
}
|
}
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
|
// If an error occurs, reset the cache object.
|
||||||
|
// This is a safety mechanism to prevent the cache object from being stuck in a bad state.
|
||||||
|
console.error('Error during alarm, reset the cache object', error);
|
||||||
await this.reset();
|
await this.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -211,10 +218,10 @@ export class CacheObject extends DurableObject {
|
|||||||
*/
|
*/
|
||||||
async logOperation<T>(
|
async logOperation<T>(
|
||||||
log: Record<string, unknown>,
|
log: Record<string, unknown>,
|
||||||
fn: (update: (log: Record<string, unknown>) => void) => Promise<T>
|
fn: (update: (log: Record<string, unknown>) => void) => Promise<T>,
|
||||||
): Promise<T> {
|
): Promise<T> {
|
||||||
const objectId = this.ctx.id.name ?? this.ctx.id.toString();
|
const objectId = this.ctx.id.name ?? this.ctx.id.toString();
|
||||||
const update: Record<string, unknown> = {};
|
let update: Record<string, unknown> = {};
|
||||||
const start = performance.now();
|
const start = performance.now();
|
||||||
try {
|
try {
|
||||||
return await fn((arg) => {
|
return await fn((arg) => {
|
||||||
@@ -258,7 +265,7 @@ function encodeChunks<T>(key: string, value: T): Record<string, Uint8Array> {
|
|||||||
function decodeChunks<T>(entries: Map<string, Uint8Array>): { value: T; size: number } | undefined {
|
function decodeChunks<T>(entries: Map<string, Uint8Array>): { value: T; size: number } | undefined {
|
||||||
const chunks = Array.from(entries.entries())
|
const chunks = Array.from(entries.entries())
|
||||||
.map(([key, value]) => {
|
.map(([key, value]) => {
|
||||||
const index = Number.parseInt(key.split('.').pop()!);
|
const index = parseInt(key.split('.').pop()!);
|
||||||
return [index, value] as const;
|
return [index, value] as const;
|
||||||
})
|
})
|
||||||
.sort(([a], [b]) => a - b)
|
.sort(([a], [b]) => a - b)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { CacheObject } from './CacheObject';
|
import type { CacheObject, CacheObjectDescriptor } from './CacheObject';
|
||||||
|
|
||||||
export type CacheLocationId = ContinentCode;
|
export type CacheLocationId = ContinentCode;
|
||||||
const allLocations: CacheLocationId[] = ['AF', 'AS', 'NA', 'SA', 'AN', 'EU', 'OC'];
|
const allLocations: CacheLocationId[] = ['AF', 'AS', 'NA', 'SA', 'AN', 'EU', 'OC'];
|
||||||
@@ -30,7 +30,7 @@ export class CacheObjectStub {
|
|||||||
/** ID of the location to target */
|
/** ID of the location to target */
|
||||||
private locationId: CacheLocationId,
|
private locationId: CacheLocationId,
|
||||||
/** Name of the tag */
|
/** Name of the tag */
|
||||||
private tag: string
|
private tag: string,
|
||||||
) {
|
) {
|
||||||
const groupId = getCacheObjectIdName(this.locationId, this.tag);
|
const groupId = getCacheObjectIdName(this.locationId, this.tag);
|
||||||
this.stub = this.doNamespace.get(this.doNamespace.idFromName(groupId), {
|
this.stub = this.doNamespace.get(this.doNamespace.idFromName(groupId), {
|
||||||
@@ -85,7 +85,7 @@ export class CacheObjectStub {
|
|||||||
});
|
});
|
||||||
const locationkeys = await cacheGroup.purge();
|
const locationkeys = await cacheGroup.purge();
|
||||||
locationkeys.forEach((key) => keys.add(key));
|
locationkeys.forEach((key) => keys.add(key));
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
return keys;
|
return keys;
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
dist/
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
# @gitbook/colors
|
|
||||||
|
|
||||||
## 0.2.0
|
|
||||||
|
|
||||||
### Minor Changes
|
|
||||||
|
|
||||||
- 445baaa: Initial release
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user