diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..5bf8fc1 --- /dev/null +++ b/.envrc @@ -0,0 +1,3 @@ +source_url "https://raw.githubusercontent.com/cachix/devenv/95f329d49a8a5289d31e0982652f7058a189bfca/direnvrc" "sha256-d+8cBpDfDBj41inrADaJt+bDWhOktwslgoP5YiGJ1v0=" + +use devenv \ No newline at end of file diff --git a/.gitignore b/.gitignore index cf2f2ec..91c8a8a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,16 @@ build vite.config.js.timestamp-* vite.config.ts.timestamp-* +# Devenv +.devenv* +devenv.local.nix + +# direnv +.direnv + +# pre-commit +.pre-commit-config.yaml + # Created by https://www.toptal.com/developers/gitignore/api/node,macos,turbo # Edit at https://www.toptal.com/developers/gitignore?templates=node,macos,turbo diff --git a/.vscode/extensions.json b/.vscode/extensions.json index ffd0810..76a0312 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -11,6 +11,9 @@ "redhat.vscode-xml", "github.vscode-github-actions", "foxundermoon.shell-format", - "editorconfig.editorconfig" + "editorconfig.editorconfig", + "redhat.vscode-yaml", + "jnoortheen.nix-ide", + "mkhl.direnv" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 465b98d..5ae645d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,6 +18,8 @@ "deno", "developomp", "developomp's", + "devenv", + "direnv", "dompurify", "elasticlunr", "Exyle", @@ -43,6 +45,7 @@ "Librewolf", "mhchem", "microflash", + "nixpkgs", "nodedotjs", "nojs", "noopener", @@ -75,6 +78,10 @@ "zustand" ], + "nix.formatterPath": "nixfmt", + "nix.enableLanguageServer": true, + "nix.serverPath": "nixd", + "eslint.workingDirectories": [{ "mode": "auto" }], "eslint.validate": ["javascript", "typescript", "svelte"], @@ -118,5 +125,8 @@ }, "[markdown]": { "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[nix]": { + "editor.defaultFormatter": "jnoortheen.nix-ide" } } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6debb4c..781c100 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,60 +1,39 @@ # Contribution Guide -## Project Structure +## Project overview -- `apps` - - `main` - https://developomp.com - - `blog` - https://blog.developomp.com -- `packages` - shared stuff used across different packages - - `content` - Shared content - - `eslint-config` - ESLint configuration files - - `tailwind-config` -tailwind configuration with pomp-specific extensions +This project is largely managed by the following tools: -## Setting Up +- [devenv](https://devenv.sh) - for development shell and dependencies. Think of [Docker](https://docker.com) but better. +- [turborepo](https://turbo.build) - for JS/TS monorepo management. Understanding it is required to make sense of the project file structure. -> **If you are a Windows user:** -> -> - Do **NOT** use the Command Prompt (cmd) -> - Do **NOT** use Windows PowerShell -> - Run these commands from PowerShell or a Linux terminal such as WSL or Git Bash -> -> PowerShell and Windows PowerShell are [different applications](https://learn.microsoft.com/en-us/powershell/scripting/whats-new/differences-from-windows-powershell?view=powershell-7.3). +You need at least basic level understanding of the tools above to effectively work on this project. -1. Clone this git repository -2. Install the following - - [NodeJS](https://nodejs.org) - - [pnpm](https://pnpm.io/installation) -3. Install Dependencies - ``` - pnpm install - ``` -4. Setup husky - ``` - pnpm husky install - ``` -5. Run whatever command you need either in project root or in individual packages - - `pnpm build` - Build all apps and packages - - `pnpm dev` - Run all apps and packages locally - - blog - http://localhost:3000 - - main - http://localhost:5173 - - `pnpm lint` - Lint all apps and packages - - `pnpm i_am_sure_i_want_to_nuke_gitignored_files` - Remove all auto-generated content such as `node_modules` and `dist`. +## Setting up + +1. Install the following + - [devenv](https://devenv.sh/getting-started) + - [direnv](https://direnv.net/docs/installation.html) +2. Clone this git repository +3. Start coding! + +## Building + +must build the dependencies first + +``` +pnpm build +``` ## Testing -1. Build site - - ``` - pnpm build - ``` - -2. Run E2E Tests +1. Run E2E Tests ``` pnpm test:e2e ``` -3. Benchmark deployed sites using the following services: +2. Benchmark deployed sites using the following services: - https://seoptimer.com - https://gtmetrix.com diff --git a/README.md b/README.md index 06e29d2..7db9fcd 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ A collection of "pomp-branded" websites. ## Tech Stack +![devenv](https://img.shields.io/badge/devenv-222?style=for-the-badge) ![pnpm](https://img.shields.io/badge/pnpm-222?style=for-the-badge&logo=pnpm) ![turborepo](https://img.shields.io/badge/turborepo-222?style=for-the-badge&logo=turborepo) ![Typescript](https://img.shields.io/badge/typescript-222?style=for-the-badge&logo=typescript) diff --git a/apps/blog/package.json b/apps/blog/package.json index a65cf9e..cc407bd 100644 --- a/apps/blog/package.json +++ b/apps/blog/package.json @@ -23,7 +23,7 @@ "@fortawesome/free-solid-svg-icons": "^6.5.2", "@fortawesome/react-fontawesome": "^0.2.0", "@kunukn/react-collapse": "^3.0.14", - "@playwright/test": "^1.36.2", + "@playwright/test": "1.47.0", "@types/highlight.js": "^10.1.0", "@types/katex": "^0.16.7", "@types/node": "^20.10.5", diff --git a/apps/main/package.json b/apps/main/package.json index bedfdf8..80a1e51 100644 --- a/apps/main/package.json +++ b/apps/main/package.json @@ -19,7 +19,7 @@ "@developomp-site/tailwind-config": "workspace:*", "@fontsource/noto-sans-kr": "^5.0.5", "@inqling/svelte-icons": "^3.5.0", - "@playwright/test": "^1.36.2", + "@playwright/test": "1.47.0", "@sveltejs/adapter-static": "^3.0.5", "@sveltejs/kit": "^2.5.7", "@sveltejs/vite-plugin-svelte": "^3.1.0", diff --git a/devenv.lock b/devenv.lock new file mode 100644 index 0000000..3367a00 --- /dev/null +++ b/devenv.lock @@ -0,0 +1,100 @@ +{ + "nodes": { + "devenv": { + "locked": { + "dir": "src/modules", + "lastModified": 1735883199, + "owner": "cachix", + "repo": "devenv", + "rev": "d67d04ae2dd3bc3723e615003034ba752e8db8c3", + "type": "github" + }, + "original": { + "dir": "src/modules", + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1733328505, + "owner": "edolstra", + "repo": "flake-compat", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1735915915, + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a27871180d30ebee8aa6b11bf7fef8a52f024733", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1735882644, + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "a5a961387e75ae44cc20f0a57ae463da5e959656", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 0000000..056a963 --- /dev/null +++ b/devenv.nix @@ -0,0 +1,31 @@ +# https://devenv.sh/reference/options + +{ pkgs, ... }: + +{ + packages = with pkgs; [ + nixd + nixfmt-rfc-style + + # version must match what's defined in package.json + playwright-driver + ]; + + env = { + PLAYWRIGHT_BROWSERS_PATH = pkgs.playwright-driver.browsers; + PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = true; + }; + + languages = { + # https://devenv.sh/supported-languages/javascript + javascript = { + enable = true; + package = pkgs.nodejs_20; + + pnpm = { + enable = true; + install.enable = true; + }; + }; + }; +} diff --git a/devenv.yaml b/devenv.yaml new file mode 100644 index 0000000..b9d1385 --- /dev/null +++ b/devenv.yaml @@ -0,0 +1,7 @@ +# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json + +inputs: + nixpkgs: + url: github:nixos/nixpkgs/nixpkgs-unstable + +allowUnfree: true diff --git a/packages/playwright-config/package.json b/packages/playwright-config/package.json index 554fe96..46453ea 100644 --- a/packages/playwright-config/package.json +++ b/packages/playwright-config/package.json @@ -1,8 +1,9 @@ { "name": "@developomp-site/playwright-config", "version": "0.0.0", + "type": "module", "main": "index.ts", "devDependencies": { - "@playwright/test": "^1.36.2" + "@playwright/test": "1.47.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2e2c18a..13d0288 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -72,8 +72,8 @@ importers: specifier: ^3.0.14 version: 3.0.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@playwright/test': - specifier: ^1.36.2 - version: 1.36.2 + specifier: 1.47.0 + version: 1.47.0 '@types/highlight.js': specifier: ^10.1.0 version: 10.1.0 @@ -118,10 +118,10 @@ importers: version: 0.16.10 next: specifier: ^14.2.3 - version: 14.2.3(@playwright/test@1.36.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.75.0) + version: 14.2.3(@playwright/test@1.47.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.75.0) next-sitemap: specifier: ^4.2.3 - version: 4.2.3(next@14.2.3(@playwright/test@1.36.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.75.0)) + version: 4.2.3(next@14.2.3(@playwright/test@1.47.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.75.0)) open-cli: specifier: ^8.0.0 version: 8.0.0 @@ -177,8 +177,8 @@ importers: specifier: ^3.5.0 version: 3.5.0(svelte@4.2.15) '@playwright/test': - specifier: ^1.36.2 - version: 1.36.2 + specifier: 1.47.0 + version: 1.47.0 '@sveltejs/adapter-static': specifier: ^3.0.5 version: 3.0.5(@sveltejs/kit@2.5.7(@sveltejs/vite-plugin-svelte@3.1.0(svelte@4.2.15)(vite@5.2.10(@types/node@20.10.5)(sass@1.75.0)))(svelte@4.2.15)(vite@5.2.10(@types/node@20.10.5)(sass@1.75.0))) @@ -414,8 +414,8 @@ importers: packages/playwright-config: devDependencies: '@playwright/test': - specifier: ^1.36.2 - version: 1.36.2 + specifier: 1.47.0 + version: 1.47.0 packages/prettier-config: {} @@ -1225,10 +1225,9 @@ packages: resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==} engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} - '@playwright/test@1.36.2': - resolution: {integrity: sha512-2rVZeyPRjxfPH6J0oGJqE8YxiM1IBRyM8hyrXYK7eSiAqmbNhxwcLa7dZ7fy9Kj26V7FYia5fh9XJRq4Dqme+g==} - engines: {node: '>=16'} - deprecated: Please update to the latest version of Playwright to test up-to-date browsers. + '@playwright/test@1.47.0': + resolution: {integrity: sha512-SgAdlSwYVpToI4e/IH19IHHWvoijAYH5hu2MWSXptRypLSnzj51PcGD+rsOXFayde4P9ZLi+loXVwArg6IUkCA==} + engines: {node: '>=18'} hasBin: true '@polka/url@1.0.0-next.24': @@ -3887,9 +3886,14 @@ packages: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} - playwright-core@1.36.2: - resolution: {integrity: sha512-sQYZt31dwkqxOrP7xy2ggDfEzUxM1lodjhsQ3NMMv5uGTRDsLxU0e4xf4wwMkF2gplIxf17QMBCodSFgm6bFVQ==} - engines: {node: '>=16'} + playwright-core@1.47.0: + resolution: {integrity: sha512-1DyHT8OqkcfCkYUD9zzUTfg7EfTd+6a8MkD/NWOvjo0u/SCNd5YmY/lJwFvUZOxJbWNds+ei7ic2+R/cRz/PDg==} + engines: {node: '>=18'} + hasBin: true + + playwright@1.47.0: + resolution: {integrity: sha512-jOWiRq2pdNAX/mwLiwFYnPHpEZ4rM+fRSQpRHwEwZlP2PUANvL3+aJOF/bvISMhFD30rqMxUB4RJx9aQbfh4Ww==} + engines: {node: '>=18'} hasBin: true possible-typed-array-names@1.0.0: @@ -5933,12 +5937,9 @@ snapshots: '@pkgr/core@0.1.1': {} - '@playwright/test@1.36.2': + '@playwright/test@1.47.0': dependencies: - '@types/node': 20.10.5 - playwright-core: 1.36.2 - optionalDependencies: - fsevents: 2.3.2 + playwright: 1.47.0 '@polka/url@1.0.0-next.24': {} @@ -9065,15 +9066,15 @@ snapshots: natural-compare@1.4.0: {} - next-sitemap@4.2.3(next@14.2.3(@playwright/test@1.36.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.75.0)): + next-sitemap@4.2.3(next@14.2.3(@playwright/test@1.47.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.75.0)): dependencies: '@corex/deepmerge': 4.0.43 '@next/env': 13.4.12 fast-glob: 3.3.1 minimist: 1.2.8 - next: 14.2.3(@playwright/test@1.36.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.75.0) + next: 14.2.3(@playwright/test@1.47.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.75.0) - next@14.2.3(@playwright/test@1.36.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.75.0): + next@14.2.3(@playwright/test@1.47.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.75.0): dependencies: '@next/env': 14.2.3 '@swc/helpers': 0.5.5 @@ -9094,7 +9095,7 @@ snapshots: '@next/swc-win32-arm64-msvc': 14.2.3 '@next/swc-win32-ia32-msvc': 14.2.3 '@next/swc-win32-x64-msvc': 14.2.3 - '@playwright/test': 1.36.2 + '@playwright/test': 1.47.0 sass: 1.75.0 transitivePeerDependencies: - '@babel/core' @@ -9308,7 +9309,13 @@ snapshots: dependencies: find-up: 4.1.0 - playwright-core@1.36.2: {} + playwright-core@1.47.0: {} + + playwright@1.47.0: + dependencies: + playwright-core: 1.47.0 + optionalDependencies: + fsevents: 2.3.2 possible-typed-array-names@1.0.0: {}