Skip to content

Commit

Permalink
chore: add csp and other vercel configs
Browse files Browse the repository at this point in the history
  • Loading branch information
ViorelMocanu committed Jan 30, 2024
1 parent 952f336 commit d6e4ca8
Show file tree
Hide file tree
Showing 7 changed files with 445 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Thumbs.db
# Hosting provider adapters
.netlify
.vercel
.vercel/*
.turbo
lambda

Expand All @@ -71,3 +72,6 @@ coverage

# nyc test coverage
.nyc_output

# Sentry Config File
.env.sentry-build-plugin
15 changes: 15 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import { ENV, LANGUAGE_EXTENDED, SITE_DESCRIPTION, SITE_NAME, ACCENT_COLOR, URL, DEBUG } from './src/config';
import { defineConfig, squooshImageService } from 'astro/config';
import { astroCSPHashGenerator } from './src/utils/csp-hash';
import { fileURLToPath } from 'url';
import { loadEnv } from 'vite';
//import compress from 'astro-compress';
import mdx from '@astrojs/mdx';
import path from 'path';
import partytown from '@astrojs/partytown';
import sentry from "@sentry/astro";
import sitemap from '@astrojs/sitemap';
import vercel from '@astrojs/vercel/serverless';
import webmanifest from 'astro-webmanifest';

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const { VITE_SENTRY_AUTH_TOKEN } = loadEnv(import.meta.env.PUBLIC_SENTRY_AUTH_TOKEN ?? process.env.PUBLIC_SENTRY_AUTH_TOKEN, process.cwd(), "");

// https://astro.build/config
export default defineConfig({
Expand Down Expand Up @@ -119,5 +123,16 @@ export default defineConfig({
SVG: true,
Logger: 1,
}),*/
astroCSPHashGenerator,
sentry({
dsn: "https://344f761c5efeb4b9ea6b08942c01f5b6@o4506599007911936.ingest.sentry.io/4506661195808768",
// @ts-ignore
sourceMapsUploadOptions: {
project: "resurse-dev",
// @ts-ignore
authToken: VITE_SENTRY_AUTH_TOKEN,
telemetry: false,
},
}),
],
});
4 changes: 4 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const ignoreArray = [
'.idea/**',
'.netlify/**',
'.vercel/**',
'/.vercel/**',
'build/**',
'coverage/**',
'demo/**',
Expand All @@ -20,6 +21,9 @@ const ignoreArray = [
'node_modules/**',
'static/**',
'src/env.d.ts',
'.vercel',
'**/.vercel/**',
'/.vercel/**',
];

export default [
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
"astro": "astro",
"format": "prettier --check ./**/*.{html,css,js,cjs,ts,astro,md,json,yaml} --plugin=prettier-plugin-astro",
"format:fix": "prettier --write ./**/*.{html,css,js,cjs,ts,astro,md,json,yaml} --plugin=prettier-plugin-astro",
"lint:js": "eslint ./**/*.js ./**/*.ts ./**/*.astro",
"lint:js": "eslint ./**/*.js ./**/*.ts ./**/*.astro --ignore-pattern '.vercel/*' --ignore-pattern '.astro/*' --ignore-pattern 'build/*' --ignore-pattern 'coverage/*' --ignore-pattern 'dist/*' --ignore-pattern 'node_modules/*'",
"lint:md": "markdownlint ./src/**/*.md",
"lint:fix": "pnpm lint:js --fix . && pnpm lint:md --fix",
"lint": "pnpm lint:js . && pnpm lint:md",
"lint:fix": "pnpm lint:js --fix && pnpm lint:md --fix",
"lint": "pnpm lint:js && pnpm lint:md",
"postinstall": "husky",
"coverage": "pnpm test:unit --coverage",
"test:unit": "vitest run",
Expand All @@ -54,12 +54,14 @@
"@astrojs/rss": "4.0.4",
"@astrojs/sitemap": "3.0.5",
"@astrojs/vercel": "7.0.2",
"@vercel/analytics": "1.1.2",
"@sentry/astro": "^7.99.0",
"@vercel/analytics": "^1.1.2",
"astro": "4.2.7",
"astro-compress": "2.2.8",
"astro-simpleanalytics-plugin": "^0.3.11",
"astro-webmanifest": "1.0.0",
"lite-youtube-embed": "0.3.0",
"node-html-parser": "6.1.12",
"sass": "1.70.0",
"sharp": "0.33.2"
},
Expand All @@ -79,6 +81,7 @@
"prettier": "3.2.4",
"prettier-plugin-astro": "0.13.0",
"typescript": "5.3.3",
"vite": "^5.0.12",
"vitest": "1.2.2"
}
}
Loading

0 comments on commit d6e4ca8

Please sign in to comment.