From 1156a503fa32c6fd7839c9b639ad7b55cfc791b4 Mon Sep 17 00:00:00 2001 From: matthieu42morin Date: Thu, 4 Apr 2024 02:39:54 +0200 Subject: [PATCH] configs --- .gitea/workflows/playwright.yml | 27 ++++++ .gitignore | 33 ++++++- README.md | 4 + package.json | 164 ++++++++++++++++---------------- svelte.config.js | 33 ++----- tsconfig.json | 31 ++++-- 6 files changed, 171 insertions(+), 121 deletions(-) create mode 100644 .gitea/workflows/playwright.yml diff --git a/.gitea/workflows/playwright.yml b/.gitea/workflows/playwright.yml new file mode 100644 index 0000000..0404c10 --- /dev/null +++ b/.gitea/workflows/playwright.yml @@ -0,0 +1,27 @@ +name: Playwright Tests +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] +jobs: + test: + timeout-minutes: 60 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Install dependencies + run: npm install -g pnpm && pnpm install + - name: Install Playwright Browsers + run: pnpm exec playwright install --with-deps + - name: Run Playwright tests + run: pnpm exec playwright test + - uses: actions/upload-artifact@v3 + if: always() + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 diff --git a/.gitignore b/.gitignore index dedc27a..df47f17 100644 --- a/.gitignore +++ b/.gitignore @@ -1,19 +1,41 @@ + .turbo + build/** + dist/** +dist +dist-ssr + .DS_Store node_modules /build /.svelte-kit /package +/lambda/ + +# Sentry Config File +.sentryclirc + .env .env.* !.env.example +*.local + vite.config.js.timestamp-* vite.config.ts.timestamp-* .vercel .output +.netlify + +cypress/screenshots +cypress/videos + +.idea +.stars-cache + +# pm .yarn +yarn-error.log +yarn.lock +pnpm-lock.yaml # Logs logs @@ -24,14 +46,10 @@ yarn-error.log* pnpm-debug.log* lerna-debug.log* -node_modules -dist -dist-ssr -*.local - # Editor directories and files !.vscode/extensions.json .vscode/* +.editorconfig .idea *.suo *.ntvs* @@ -61,3 +79,8 @@ public/api/vendor /playwright-report/ /blob-report/ /playwright/.cache/ +/test-results/ +/playwright-report/ +/blob-report/ +/playwright/.cache/ + diff --git a/README.md b/README.md index 5c91169..73ce66f 100644 --- a/README.md +++ b/README.md @@ -36,3 +36,7 @@ npm run build You can preview the production build with `npm run preview`. > To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. + + + +TODO: REcompose based on KkosmetickySalon project diff --git a/package.json b/package.json index 5e36980..f82cee6 100644 --- a/package.json +++ b/package.json @@ -1,85 +1,83 @@ { - "name": "portfolio", - "description": "Uses pnpm, svelte, mdsvex", - "version": "1.0.0", - "main": "index.js", - "private": true, - "homepage": "mattmor.in", - "author": "Matthieu Morin", - "license": "AGPLv3", - "repository": { - "type": "git", - "url": "https://github.com/matthieu42morin/Portfolio/" - }, - "packageManager": "pnpm@8.6.6", - "scripts": { - "dev": "vite dev", - "build": "vite build", - "preview": "vite preview", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "test": "vitest", - "lint": "prettier --plugin-search-dir . --check . && eslint .", - "format": "prettier --plugin-search-dir . --write .", - "test-ct": "playwright test -c playwright-ct.config.ts" - }, - "devDependencies": { - "@playwright/experimental-ct-svelte": "^1.41.2", - "@skeletonlabs/skeleton": "2.0.0", - "@skeletonlabs/tw-plugin": "0.1.0", - "@sveltejs/adapter-cloudflare": "^2.3.4", - "@sveltejs/kit": "^1.30.3", - "@tailwindcss/forms": "0.5.6", - "@tailwindcss/typography": "0.5.9", - "@types/js-cookie": "^3.0.6", - "@types/node": "20.5.7", - "@types/prismjs": "^1.26.3", - "@typescript-eslint/eslint-plugin": "^5.62.0", - "@typescript-eslint/parser": "^5.62.0", - "autoprefixer": "10.4.15", - "emoji-regex": "^10.3.0", - "eslint": "^8.56.0", - "eslint-config-prettier": "^8.10.0", - "eslint-plugin-svelte": "^2.35.1", - "ficons": "^1.1.54", - "hastscript": "^8.0.0", - "js-cookie": "^3.0.5", - "mdast-util-to-string": "^4.0.0", - "mdsvex": "^0.11.0", - "postcss": "8.4.29", - "prettier": "^2.8.8", - "prettier-plugin-svelte": "^2.10.1", - "rehype-img-size": "^1.0.1", - "rehype-wrap-all": "^1.1.0", - "remark-external-links": "^9.0.1", - "sass": "^1.70.0", - "svelte": "^4.2.10", - "svelte-check": "^3.6.4", - "tailwindcss": "3.3.3", - "tslib": "^2.6.2", - "typescript": "^5.3.3", - "unist-util-visit": "^5.0.0", - "vite": "^4.5.2", - "vite-plugin-tailwind-purgecss": "0.1.3", - "vitest": "^0.34.6" - }, - "dependencies": { - "@floating-ui/dom": "1.5.1", - "@fortawesome/fontawesome-free": "^6.5.1", - "@sveltejs/adapter-node": "^4.0.1", - "@threlte/core": "^6.1.1", - "@threlte/extras": "^8.7.4", - "@yushijinhun/three-minifier-rollup": "^0.4.0", - "highlight.js": "11.8.0", - "latest": "^0.2.0", - "linkedom": "^0.15.6", - "prismjs": "^1.29.0", - "rehype-autolink-headings": "^7.1.0", - "rehype-slug": "^6.0.0", - "remark-toc": "^9.0.0", - "remark-unwrap-images": "^4.0.0", - "rss": "^1.2.2", - "svelte-preprocess": "^5.1.3" - }, - "type": "module" + "name": "its-personal~portfolio", + "description": "Uses pnpm, svelte, mdsvex", + "version": "1.0.0", + "main": "index.js", + "private": true, + "homepage": "mattmor.in", + "author": "Matthieu Morin", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://git.mattmor.in/Madmin/its-personal/" + }, + "packageManager": "pnpm@8.6.6", + "scripts": { + "dev": "vite dev", + "build": "vite build", + "preview": "vite preview", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "test": "vitest", + "lint": "prettier --plugin-search-dir . --check . && eslint .", + "format": "prettier --plugin-search-dir . --write .", + "test-ct": "playwright test -c playwright-ct.config.ts" + }, + "devDependencies": { + "@playwright/test": "^1.41.2", + "@skeletonlabs/skeleton": "2.0.0", + "@skeletonlabs/tw-plugin": "0.1.0", + "@sveltejs/kit": "^2.5.0", + "@tailwindcss/forms": "0.5.6", + "@tailwindcss/typography": "0.5.9", + "@types/js-cookie": "^3.0.6", + "@types/node": "20.5.7", + "@types/prismjs": "^1.26.3", + "@typescript-eslint/eslint-plugin": "^5.62.0", + "@typescript-eslint/parser": "^5.62.0", + "autoprefixer": "10.4.15", + "emoji-regex": "^10.3.0", + "eslint": "^8.56.0", + "eslint-config-prettier": "^8.10.0", + "eslint-plugin-svelte": "^2.35.1", + "js-cookie": "^3.0.5", + "postcss": "8.4.29", + "prettier": "^2.8.8", + "prettier-plugin-svelte": "^2.10.1", + "rehype-autolink-headings": "^7.1.0", + "rehype-img-size": "^1.0.1", + "rehype-slug": "^6.0.0", + "remark-external-links": "^9.0.1", + "remark-toc": "^9.0.0", + "remark-unwrap-images": "^4.0.0", + "sass": "^1.71.0", + "shiki": "^1.1.6", + "svelte": "^4.2.11", + "svelte-check": "^3.6.4", + "tailwindcss": "3.3.3", + "tslib": "^2.6.2", + "typescript": "^5.3.3", + "unist-util-visit": "^5.0.0", + "vite": "^5.1.3", + "vite-plugin-tailwind-purgecss": "0.2.0", + "vitest": "^0.34.6" + }, + "dependencies": { + "@floating-ui/dom": "1.5.1", + "@fortawesome/fontawesome-free": "^6.5.1", + "@sentry/sveltekit": "^7.102.0", + "@sveltejs/adapter-node": "^4.0.1", + "@sveltejs/vite-plugin-svelte": "^3.0.2", + "@threlte/core": "^6.1.1", + "@threlte/extras": "^8.7.5", + "@yushijinhun/three-minifier-rollup": "^0.4.0", + "highlight.js": "11.8.0", + "latest": "^0.2.0", + "linkedom": "^0.15.6", + "mdsvex": "^0.11.0", + "prismjs": "^1.29.0", + "rss": "^1.2.2", + "svelte-preprocess": "^5.1.3" + }, + "type": "module" } diff --git a/svelte.config.js b/svelte.config.js index ebc9d3a..f6fb6a7 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,14 +1,9 @@ -import adapter from '@sveltejs/adapter-cloudflare'; -import { vitePreprocess } from '@sveltejs/kit/vite'; +import adapter from '@sveltejs/adapter-node'; import preprocess from 'svelte-preprocess'; -// import { mdsvexGlobalComponents } from './src/lib/utils/mdsvexGlobalComponents.js/index.js'; +// config extensions import { mdsvex } from 'mdsvex'; import mdsvexConfig from './mdsvex.config.js'; -/* Not using -// import { mdsvexGlobalComponents } from './src/lib/utils/mdsvex-global-components.js'; - - /** @type {import('@sveltejs/kit').Config} */ const config = { @@ -16,10 +11,7 @@ const config = { // Consult https://kit.svelte.dev/docs/integrations#preprocessors // for more information about preprocessors preprocess: [ - preprocess({ - postcss: true - }), - vitePreprocess(), + preprocess({ postcss: true }), // No neeed rn unless using mdsvex highlighter with svelte components //mdsvexGlobalComponents({ @@ -38,8 +30,12 @@ const config = { // If your environment is not supported or you settled on a specific environment, switch out the adapter. // See https://kit.svelte.dev/docs/adapters for more information about adapters. - adapter: adapter({}), - // sometimes problems with + adapter: adapter({ + out: 'build', + precompress: false + }), + + // Aliases need tsconfig explicit inclusion alias: { $lib: './src/lib', $root: './', @@ -47,15 +43,6 @@ const config = { $routes: './src/routes', $content: './src/content' }, - // TODO: FIX Banning external malware scripts for security and privacy of users, threw errors, - // csp: { - // directives: { - // 'script-src': ['self'] - // }, - // reportOnly: { - // 'script-src': ['self'] - // } - // }, csrf: { checkOrigin: process.env.NODE_ENV === 'development' ? false : true }, @@ -66,7 +53,7 @@ const config = { // Handle blog trying to prerender relative links that it can't if ( details.status == 404 && - details.path.startsWith('/blog') && + details.path.startsWith('/blog' && '/projects') && details.referenceType == 'linked' ) { console.warn(`PRERENDER ignored route ${details.path}`); diff --git a/tsconfig.json b/tsconfig.json index fd10935..06ad257 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,20 +3,31 @@ "compilerOptions": { "allowJs": true, "checkJs": true, - "noEmit": true, - "target": "esnext", - "module": "esnext", - "moduleResolution": "Bundler", - "allowSyntheticDefaultImports": true, - "strict": true, - "skipLibCheck": true, - // custom compiler options "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "resolveJsonModule": true, - "sourceMap": true + "skipLibCheck": true, + "sourceMap": true, + "strict": true, + // custom compiler options + "noEmit": true, + "target": "ES2018", + "module": "ES2022", + "moduleResolution": "Bundler", + "allowSyntheticDefaultImports": true }, - "include": ["./scripts/**/*", "./test/*.js", "./*.js", "mdsvex.config.ts", "svelte.config.ts"], + "include": [ + "./scripts/**/*", + "./test/*.js", + "./*.js", + "./src/**/*.d.ts", + "./src/**/*.js", + "./src/**/*.svelte", + "./src/**/*.ts", + ".svelte-kit/ambient.d.ts", + ".svelte-kit/types/**/$types.d.ts", + "./csp-directives.ts" + ], "exclude": ["node_modules/*"] // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias //