Skip to content

Commit

Permalink
Rewrite logic to just add overrides and not install deps
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiborza committed Nov 29, 2024
1 parent 970fcb8 commit cbc7b13
Show file tree
Hide file tree
Showing 25 changed files with 6,402 additions and 150 deletions.
3 changes: 3 additions & 0 deletions e2e-tests/test-applications/nextjs-test-app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

# Sentry Config File
.env.sentry-build-plugin
41 changes: 40 additions & 1 deletion e2e-tests/test-applications/nextjs-test-app/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,43 @@
import {withSentryConfig} from '@sentry/nextjs';
/** @type {import('next').NextConfig} */
const nextConfig = {};

export default nextConfig;
export default withSentryConfig(nextConfig, {
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options

org: "sentry-sdks",
project: "ab-nuxt",

// Only print logs for uploading source maps in CI
silent: !process.env.CI,

// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/

// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,

// Automatically annotate React components to show their full name in breadcrumbs and session replay
reactComponentAnnotation: {
enabled: true,
},

// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
// This can increase your server load as well as your hosting bill.
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
// side errors will fail.
tunnelRoute: "/monitoring",

// Hides source maps from generated client bundles
hideSourceMaps: true,

// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,

// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
// See the following for more information:
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
automaticVercelMonitors: true,
});
9 changes: 5 additions & 4 deletions e2e-tests/test-applications/nextjs-test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
"lint": "next lint"
},
"dependencies": {
"@sentry/nextjs": "^8",
"next": "14.2.14",
"react": "^18",
"react-dom": "^18",
"next": "14.2.14"
"react-dom": "^18"
},
"devDependencies": {
"typescript": "^5",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18"
"@types/react-dom": "^18",
"typescript": "^5"
}
}
27 changes: 27 additions & 0 deletions e2e-tests/test-applications/nuxt-foo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Nuxt dev/build outputs
.output
.data
.nuxt
.nitro
.cache
dist

# Node dependencies
node_modules

# Logs
logs
*.log

# Misc
.DS_Store
.fleet
.idea

# Local env files
.env
.env.*
!.env.example

# Sentry Config File
.env.sentry-build-plugin
75 changes: 75 additions & 0 deletions e2e-tests/test-applications/nuxt-foo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Nuxt Minimal Starter

Look at the [Nuxt documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.

## Setup

Make sure to install dependencies:

```bash
# npm
npm install

# pnpm
pnpm install

# yarn
yarn install

# bun
bun install
```

## Development Server

Start the development server on `http://localhost:3000`:

```bash
# npm
npm run dev

# pnpm
pnpm dev

# yarn
yarn dev

# bun
bun run dev
```

## Production

Build the application for production:

```bash
# npm
npm run build

# pnpm
pnpm build

# yarn
yarn build

# bun
bun run build
```

Locally preview production build:

```bash
# npm
npm run preview

# pnpm
pnpm preview

# yarn
yarn preview

# bun
bun run preview
```

Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
6 changes: 6 additions & 0 deletions e2e-tests/test-applications/nuxt-foo/app.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<template>
<div>
<NuxtRouteAnnouncer />
<NuxtWelcome />
</div>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!--
This is just a very simple component that throws an example error.
Feel free to delete this file.
-->

<script setup>
import * as Sentry from '@sentry/nuxt';

const throwError = () => {
Sentry.startSpan(
{
name: 'Example Frontend Span',
op: 'test'
},
() => {
throw new Error('Sentry Example Error');
}
)
};
</script>

<template>
<button id="errorBtn" @click="throwError"> Throw Error! </button>
</template>

<style scoped>
button {
padding: 12px;
cursor: pointer;
background-color: rgb(54, 45, 89);
border-radius: 4px;
border: none;
color: white;
font-size: 1em;
margin: 1em;
transition: all 0.25s ease-in-out;
}
button:hover {
background-color: #8c5393;
box-shadow: 4px;
box-shadow: 0px 0px 15px 2px rgba(140, 83, 147, 0.5);
}
button:active {
background-color: #c73852;
}
</style>
17 changes: 17 additions & 0 deletions e2e-tests/test-applications/nuxt-foo/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: '2024-11-01',
devtools: { enabled: true },
modules: ['@sentry/nuxt/module'],

sentry: {
sourceMapsUploadOptions: {
org: 'sentry-sdks',
project: 'ab-nuxt'
}
},

sourcemap: {
client: 'hidden'
}
})
24 changes: 24 additions & 0 deletions e2e-tests/test-applications/nuxt-foo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "nuxt-app",
"private": true,
"type": "module",
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"dependencies": {
"@sentry/nuxt": "^8.41.0",
"@vercel/nft": "^0.27.4",
"nitropack": "2.9.7",
"nuxt": "^3.14.1592",
"vue": "latest",
"vue-router": "latest"
},
"resolutions": {
"nitropack": "2.9.7",
"@vercel/nft": "^0.27.4"
}
}
Binary file not shown.
1 change: 1 addition & 0 deletions e2e-tests/test-applications/nuxt-foo/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

25 changes: 25 additions & 0 deletions e2e-tests/test-applications/nuxt-foo/sentry.client.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import * as Sentry from "@sentry/nuxt";

Sentry.init({
// If set up, you can use your runtime config here
// dsn: useRuntimeConfig().public.sentry.dsn,
dsn: "https://[email protected]/4508284360785920",

// We recommend adjusting this value in production, or using tracesSampler
// for finer control
tracesSampleRate: 1.0,

// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,

// If the entire session is not sampled, use the below sample rate to sample
// sessions when an error occurs.
replaysOnErrorSampleRate: 1.0,

// If you don't want to use Session Replay, just remove the line below:
integrations: [Sentry.replayIntegration()],

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
});
12 changes: 12 additions & 0 deletions e2e-tests/test-applications/nuxt-foo/sentry.server.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as Sentry from "@sentry/nuxt";

Sentry.init({
dsn: "https://[email protected]/4508284360785920",

// We recommend adjusting this value in production, or using tracesSampler
// for finer control
tracesSampleRate: 1.0,

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
});
3 changes: 3 additions & 0 deletions e2e-tests/test-applications/nuxt-foo/server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../.nuxt/tsconfig.server.json"
}
4 changes: 4 additions & 0 deletions e2e-tests/test-applications/nuxt-foo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json"
}
Loading

0 comments on commit cbc7b13

Please sign in to comment.