mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-10-01 14:38:39 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| de2d468677 | |||
| 7f50ad68bb | |||
| 3a759b14a4 | |||
| b5e2e3fa8d | |||
| fec48ce708 | |||
| 0784bf5df7 | |||
| f8f485ae25 | |||
| 3491bdc522 | |||
| 2cda8d4cad | |||
| 3fcbe46262 | |||
| 884ee7073f |
@@ -94,48 +94,6 @@ jobs:
|
|||||||
Latest commit: [${{ steps.deploy.outputs.deployment-url }}](${{ steps.deploy.outputs.deployment-url }})
|
Latest commit: [${{ steps.deploy.outputs.deployment-url }}](${{ steps.deploy.outputs.deployment-url }})
|
||||||
PR: [${{ steps.deploy.outputs.deployment-alias-url }}](${{ steps.deploy.outputs.deployment-alias-url }})
|
PR: [${{ steps.deploy.outputs.deployment-alias-url }}](${{ steps.deploy.outputs.deployment-alias-url }})
|
||||||
edit-mode: replace
|
edit-mode: replace
|
||||||
visual-testing:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Visual Testing
|
|
||||||
needs: deploy
|
|
||||||
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
|
|
||||||
env:
|
|
||||||
BASE_URL: ${{needs.deploy.outputs.deployment_url}}
|
|
||||||
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
if: ${{ !cancelled() }}
|
|
||||||
with:
|
|
||||||
name: playwright-test-results
|
|
||||||
path: packages/gitbook/test-results/
|
|
||||||
retention-days: 3
|
|
||||||
pagespeed-testing:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: PageSpeed Testing
|
|
||||||
needs: deploy
|
|
||||||
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: Run pagespeed tests
|
|
||||||
run: bun ./packages/gitbook/tests/pagespeed-testing.ts $DEPLOYMENT_URL
|
|
||||||
env:
|
|
||||||
DEPLOYMENT_URL: ${{needs.deploy.outputs.deployment_url}}
|
|
||||||
PAGESPEED_API_KEY: ${{ secrets.PAGESPEED_API_KEY }}
|
|
||||||
format:
|
format:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Format
|
name: Format
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^5.5.3",
|
"typescript": "^5.5.3",
|
||||||
"wrangler": "3.82.0"
|
"wrangler": "^3.100.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"generate": "wrangler types --experimental-include-runtime",
|
"generate": "wrangler types --experimental-include-runtime",
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
"@gitbook/react-openapi": "workspace:*",
|
"@gitbook/react-openapi": "workspace:*",
|
||||||
"@radix-ui/react-checkbox": "^1.0.4",
|
"@radix-ui/react-checkbox": "^1.0.4",
|
||||||
"@radix-ui/react-popover": "^1.0.7",
|
"@radix-ui/react-popover": "^1.0.7",
|
||||||
|
"@sentry/cloudflare": "8.35.0",
|
||||||
"@sentry/nextjs": "8.35.0",
|
"@sentry/nextjs": "8.35.0",
|
||||||
"@sindresorhus/fnv1a": "^3.1.0",
|
"@sindresorhus/fnv1a": "^3.1.0",
|
||||||
"@tailwindcss/container-queries": "^0.1.1",
|
"@tailwindcss/container-queries": "^0.1.1",
|
||||||
|
|||||||
@@ -1,18 +1,10 @@
|
|||||||
import * as Sentry from '@sentry/browser';
|
import * as Sentry from '@sentry/nextjs';
|
||||||
|
|
||||||
const dsn = process.env.SENTRY_DSN;
|
const dsn = process.env.SENTRY_DSN;
|
||||||
if (dsn) {
|
if (dsn) {
|
||||||
Sentry.init({
|
Sentry.init({
|
||||||
dsn,
|
dsn,
|
||||||
release: process.env.SENTRY_RELEASE,
|
|
||||||
|
|
||||||
// Disable tracing as it creates additional requests in an env where subrequests are limited.
|
// Disable tracing as it creates additional requests in an env where subrequests are limited.
|
||||||
tracesSampleRate: 0,
|
tracesSampleRate: 0,
|
||||||
|
|
||||||
// Disable transactions as it creates additional requests in an env where subrequests are limited.
|
|
||||||
// https://docs.sentry.io/platforms/node/configuration/filtering/#using--3
|
|
||||||
beforeSendTransaction: () => {
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
import { init } from '@sentry/nextjs';
|
|
||||||
|
|
||||||
const dsn = process.env.SENTRY_DSN;
|
|
||||||
if (dsn) {
|
|
||||||
init({
|
|
||||||
dsn,
|
|
||||||
release: process.env.SENTRY_RELEASE,
|
|
||||||
|
|
||||||
// Disable tracing as it creates additional requests in an env where subrequests are limited.
|
|
||||||
tracesSampleRate: 0,
|
|
||||||
|
|
||||||
// Disable transactions as it creates additional requests in an env where subrequests are limited.
|
|
||||||
// https://docs.sentry.io/platforms/node/configuration/filtering/#using--3
|
|
||||||
beforeSendTransaction: () => {
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
import { init } from '@sentry/nextjs';
|
|
||||||
|
|
||||||
const dsn = process.env.SENTRY_DSN;
|
|
||||||
if (dsn) {
|
|
||||||
init({
|
|
||||||
dsn,
|
|
||||||
release: process.env.SENTRY_RELEASE,
|
|
||||||
|
|
||||||
// Disable tracing as it creates additional requests in an env where subrequests are limited.
|
|
||||||
tracesSampleRate: 0,
|
|
||||||
|
|
||||||
// Disable transactions as it creates additional requests in an env where subrequests are limited.
|
|
||||||
// https://docs.sentry.io/platforms/node/configuration/filtering/#using--3
|
|
||||||
beforeSendTransaction: () => {
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,13 +1,10 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import nextOnPagesHandler from '@cloudflare/next-on-pages/fetch-handler';
|
import nextOnPagesHandler from '@cloudflare/next-on-pages/fetch-handler';
|
||||||
|
import { withSentry } from '@sentry/cloudflare';
|
||||||
|
|
||||||
import { withMiddlewareHeadersStorage } from './lib/middleware';
|
import { withMiddlewareHeadersStorage } from './lib/middleware';
|
||||||
|
|
||||||
/**
|
const exportedHandler = {
|
||||||
* We use a custom entrypoint until we can move to opennext (https://github.com/opennextjs/opennextjs-cloudflare/issues/92).
|
|
||||||
* There is a bug in next-on-pages where headers can't be set on the response in the middleware for RSC requests (https://github.com/cloudflare/next-on-pages/issues/897).
|
|
||||||
*/
|
|
||||||
export default {
|
|
||||||
async fetch(request, env, ctx) {
|
async fetch(request, env, ctx) {
|
||||||
const response = await withMiddlewareHeadersStorage(() =>
|
const response = await withMiddlewareHeadersStorage(() =>
|
||||||
nextOnPagesHandler.fetch(request, env, ctx),
|
nextOnPagesHandler.fetch(request, env, ctx),
|
||||||
@@ -15,4 +12,19 @@ export default {
|
|||||||
|
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
} as ExportedHandler<{ ASSETS: Fetcher }>;
|
} satisfies ExportedHandler<{ ASSETS: Fetcher }>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We use a custom entrypoint until we can move to opennext (https://github.com/opennextjs/opennextjs-cloudflare/issues/92).
|
||||||
|
* There is a bug in next-on-pages where headers can't be set on the response in the middleware for RSC requests (https://github.com/cloudflare/next-on-pages/issues/897).
|
||||||
|
*/
|
||||||
|
export default withSentry(
|
||||||
|
(env) => ({
|
||||||
|
dsn: env.SENTRY_DSN,
|
||||||
|
release: env.SENTRY_RELEASE,
|
||||||
|
environment: env.SENTRY_ENVIRONMENT,
|
||||||
|
tracesSampleRate: 0,
|
||||||
|
}),
|
||||||
|
// @ts-ignore
|
||||||
|
exportedHandler,
|
||||||
|
);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export function HeaderMobileMenu(props: Partial<React.ButtonHTMLAttributes<HTMLB
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const windowRef = useRef(typeof window === 'undefined' ? null : window);
|
const windowRef = useRef(window);
|
||||||
useScrollListener(() => {
|
useScrollListener(() => {
|
||||||
if (window.scrollY >= scrollDistance) {
|
if (window.scrollY >= scrollDistance) {
|
||||||
setHasScrolled(true);
|
setHasScrolled(true);
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
import * as Sentry from '@sentry/nextjs';
|
|
||||||
import { Instrumentation } from 'next';
|
|
||||||
|
|
||||||
export async function register() {
|
|
||||||
await import('../sentry.edge.config');
|
|
||||||
}
|
|
||||||
|
|
||||||
export const onRequestError: Instrumentation.onRequestError = async (...args) => {
|
|
||||||
Sentry.captureRequestError(...args);
|
|
||||||
// There is an issue on Cloudflare that requires us to flush the events manually.
|
|
||||||
// https://github.com/getsentry/sentry-javascript/issues/14931#issuecomment-2577640023
|
|
||||||
await Sentry.flush();
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user