Skip to content
Open
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
Binary file not shown.
84 changes: 84 additions & 0 deletions benchmarks/with-dgp-cookie-consent/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import type { Metadata } from "next";
import Script from "next/script";
import type { ReactNode } from "react";

export const metadata: Metadata = {
title: "benchmark",
};

export default function RootLayout({
children,
}: Readonly<{
children: ReactNode;
}>) {
return (
<html lang="en" suppressHydrationWarning>
<head>
{/** Add custom styles to consent-dialog to allow benchmarking, cuz selecting elements inside shadow DOM is not yet supported */}
<style>{`consent-dialog { display: block; }`}</style>
<Script
id="dgp-cookie-consent-config"
type="text/javascript"
strategy="beforeInteractive"
>
{`
window.CookieConsentTranslations = {
locale: 'en-US',
tabAgree: {
title: 'Consent',
body: '<p><strong>This website uses cookies</strong></p><p>We use cookies to personalize content and ads, provide social media features, and analyze our traffic.</p>',
},
tabAbout: {
title: 'About',
body: '<p>Cookies are small text files that can be used by websites to make the user experience more efficient.</p>',
},
tabDetail: {
title: 'Detail',
necessary: {
title: 'Necessary',
perex: 'Necessary cookies help make a website usable.',
},
preferences: {
title: 'Preference',
perex: 'Preference cookies enable a website to remember information.',
},
statistics: {
title: 'Statistics',
perex: 'Statistics cookies help website owners.',
},
marketing: {
title: 'Marketing',
perex: 'Marketing cookies are used to track visitors.',
},
},
buttonEdit: { label: 'Settings' },
buttonAllowAll: { label: 'Allow all' },
buttonRejectAll: { label: 'Reject all' },
buttonConfirm: { label: 'Confirm' },
badge: { label: 'Edit cookie settings' },
dialog: { label: 'Your cookie settings' },
lastUpdated: 'Cookie statement was last updated %date.',
};

window.CookieConsentSettings = {
tabAgree: { showButtonRejectAll: true },
tabAbout: { showButtonRejectAll: true },
enableDarkMode: true,
disableBadge: true,
disableCross: false,
disableHeader: false,
};
`}
</Script>
<Script
id="dgp-cookie-consent-script"
src="https://cdn.jsdelivr.net/gh/danielsitek/dgp-cookie-consent@1.8.0/dist/cookies.min.js"
strategy="beforeInteractive"
type="text/javascript"
async
/>
</head>
<body>{children}</body>
</html>
);
}
7 changes: 7 additions & 0 deletions benchmarks/with-dgp-cookie-consent/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function Home() {
return (
<div>
<h1>Benchmark</h1>
</div>
);
}
48 changes: 48 additions & 0 deletions benchmarks/with-dgp-cookie-consent/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"$schema": "./node_modules/@cookiebench/benchmark-schema/schema.json",
"name": "with-dgp-cookie-consent",
"id": "dgp-cookie-consent",
"iterations": 20,
"cookieBanner": {
"selectors": ["consent-dialog"],
"serviceHosts": ["cdn.jsdelivr.net"],
"waitForVisibility": true,
"measureViewportCoverage": true,
"expectedLayoutShift": true,
"serviceName": "DGP Cookie Consent"
},
"techStack": {
"bundler": "rollup",
"bundleType": "iffe",
"frameworks": [],
"languages": ["typescript"],
"packageManager": "npm",
"typescript": true
},
"internationalization": {
"detection": "manual",
"stringLoading": "server"
},
"source": {
"isOpenSource": true,
"license": "MIT",
"github": "https://github.com/danielsitek/dgp-cookie-consent",
"website": "https://github.com/danielsitek/dgp-cookie-consent"
},
"company": {
"name": "Daniel Sitek",
"website": "https://github.com/danielsitek",
"avatar": "https://avatars.githubusercontent.com/u/danielsitek"
},
"includes": {
"backend": "false",
"components": ["webcomponent", "typescript"]
},
"tags": [
"lightweight",
"zero-dependency",
"gdpr",
"webcomponent",
"typescript"
]
}
5 changes: 5 additions & 0 deletions benchmarks/with-dgp-cookie-consent/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
7 changes: 7 additions & 0 deletions benchmarks/with-dgp-cookie-consent/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
/* config options here */
};

export default nextConfig;
26 changes: 26 additions & 0 deletions benchmarks/with-dgp-cookie-consent/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "with-dgp-cookie-consent",
"private": true,
"scripts": {
"benchmark": "pnpm exec benchmark-cli benchmark",
"build": "next build",
"dev": "next dev --port 3001",
"fmt": "biome format . --write",
"lint": "biome lint .",
"start": "next start"
},
"dependencies": {
"next": "16.0.1",
"react": "^19.2.0",
"react-dom": "^19.2.0"
},
"devDependencies": {
"@cookiebench/benchmark-schema": "workspace:*",
"@cookiebench/cli": "workspace:*",
"@cookiebench/ts-config": "workspace:*",
"@types/node": "^24.9.2",
"@types/react": "^19.2.2",
"@types/react-dom": "^19.2.2",
"typescript": "^5.9.3"
}
}
11 changes: 11 additions & 0 deletions benchmarks/with-dgp-cookie-consent/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "@cookiebench/ts-config/nextjs.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
34 changes: 34 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.