Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
🧑💻 Improve developer experience (#1140)
Luke Vella685f49b4c23a
diff --git a/.env.development b/.env.developmentindex c0451365a..59f291d8d 100644--- a/.env.development+++ b/.env.development@@ -1,11 +1,19 @@# A random 32-character secret key used to encrypt user sessionsSECRET_PASSWORD=abcdef1234567890abcdef1234567890+# The base url where this instance is accessible, including the scheme.# Example: https://example.comNEXT_PUBLIC_BASE_URL=http://localhost:3000NEXTAUTH_URL=$NEXT_PUBLIC_BASE_URL+# A connection string to your Postgres database-DATABASE_URL="postgres://postgres:postgres@localhost:5450/db"+DATABASE_URL="postgres://postgres:postgres@localhost:5450/rallly"++# Required to be able to send emails++# Toggle Self-Hosted mode+NEXT_PUBLIC_SELF_HOSTED=false# Suppress warning from sentry during local developmentSENTRY_IGNORE_API_RESOLUTION_ERROR=1\ No newline at end of filediff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.ymlnew file mode 100644index 000000000..18f1ea925--- /dev/null+++ b/.github/actions/setup-node/action.yml@@ -0,0 +1,19 @@+name: "Setup Node.js"+description: "Sets up a consistent Node.js environment"+inputs:+ node-version:+ description: "Node.js version"+ required: true+ default: "18"+ cache:+ description: "Package manager for caching"+ required: false+ default: "yarn"+runs:+ using: "composite"+ steps:+ - name: Setup Node.js+ uses: actions/setup-node@v4+ with:+ node-version: ${{ inputs.node-version }}+ cache: ${{ inputs.cache }}diff --git a/.github/actions/yarn-install/action.yml b/.github/actions/yarn-install/action.ymlnew file mode 100644index 000000000..1eeffa405--- /dev/null+++ b/.github/actions/yarn-install/action.yml@@ -0,0 +1,8 @@+name: "Yarn Install"+description: "Runs yarn install with --frozen-lockfile"+runs:+ using: "composite"+ steps:+ - name: Run yarn install+ run: yarn install --frozen-lockfile+ shell: bashdiff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 6ad5aca0f..b6b6d88f1 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -7,76 +7,98 @@ on:branches:- main+concurrency:+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}+ cancel-in-progress: true+jobs:- linting:- name: Linting+ changes:+ name: Check for changesruns-on: ubuntu-latest- env:- TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}- TURBO_TEAM: ${{ vars.TURBO_TEAM }}+ permissions:+ pull-requests: read+ outputs:+ has-files-requiring-all-checks: ${{ steps.filter.outputs.has-files-requiring-all-checks }}steps:- - name: Check out repository code- uses: actions/checkout@v4-- - name: Setup node- uses: actions/setup-node@v4+ - uses: actions/checkout@v4+ - uses: dorny/paths-filter@v3+ id: filterwith:- node-version: 18- cache: yarn+ filters: |+ has-files-requiring-all-checks:+ - "!(**.md|.github)"++ type-check:+ name: Type check+ runs-on: ubuntu-latest+ needs: changes+ if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}+ steps:+ - uses: actions/checkout@v4+ - uses: ./.github/actions/setup-node+ - uses: ./.github/actions/yarn-install- - name: Install dependencies- run: yarn install --frozen-lockfile+ - name: Check types+ run: yarn lint:tsc++ linting:+ name: Linting+ runs-on: ubuntu-latest+ needs: changes+ if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}+ steps:+ - uses: actions/checkout@v4+ - uses: ./.github/actions/setup-node+ - uses: ./.github/actions/yarn-install- name: Check linting rulesrun: yarn lint- - name: Check types- run: yarn lint:tsc+ unit-tests:+ name: Unit tests+ needs: changes+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v4+ - uses: ./.github/actions/setup-node+ - uses: ./.github/actions/yarn-install++ - name: Run tests+ run: yarn test:unit# Label of the container jobintegration-tests:- name: Run tests- # Containers must run in Linux based operating systems+ name: Integration tests+ needs: changesruns-on: ubuntu-latest- env:- TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}- TURBO_TEAM: ${{ vars.TURBO_TEAM }}steps:- # Downloads a copy of the code in your repository before running CI tests- - name: Check out repository code- uses: actions/checkout@v4+ - uses: actions/checkout@v4+ - uses: ./.github/actions/setup-node+ - uses: ./.github/actions/yarn-install- name: Install system dependenciesrun: |sudo apt-get update- - name: Setup node- uses: actions/setup-node@v4- with:- node-version: 18- cache: yarn-- - name: Install dependencies- run: yarn install --frozen-lockfile+ - name: Install playwright dependencies+ run: yarn playwright install --with-deps chromium- name: Set environment variablesrun: |- echo "DATABASE_URL=postgresql://postgres:password@localhost:5450/db" >> $GITHUB_ENV+ echo "DATABASE_URL=postgresql://postgres:postgres@localhost:5450/rallly" >> $GITHUB_ENV- - name: Run db- run: |- docker pull postgres:14.2- docker run -d -p 5450:5432 -e POSTGRES_PASSWORD=password -e POSTGRES_DB=rallly postgres:14.2- yarn wait-on --timeout 60000 tcp:localhost:5450+ - name: Create production build+ run: yarn turbo build:test --filter=@rallly/web- - name: Deploy migrations- run: yarn db:setup+ - name: Generate Prisma Client+ run: yarn db:generate- - name: Install playwright dependencies- run: yarn playwright install --with-deps chromium+ - name: Set up database+ run: |+ yarn dx- name: Run tests- run: yarn test+ run: yarn test:integration- name: Upload artifact playwright-reportif: ${{ success() || failure() }}diff --git a/.gitignore b/.gitignoreindex a1c458b17..a7b4e7411 100644--- a/.gitignore+++ b/.gitignore@@ -38,4 +38,8 @@ tsconfig.tsbuildinfo.turbo# Jetbrains IDE-.idea\ No newline at end of file+.idea++# Playwright+playwright-report+test-results\ No newline at end of filediff --git a/apps/landing/package.json b/apps/landing/package.jsonindex f8c7a8134..42fff8709 100644--- a/apps/landing/package.json+++ b/apps/landing/package.json@@ -18,9 +18,7 @@"@rallly/tailwind-config": "*","@rallly/ui": "*","@svgr/webpack": "^6.5.1",- "@tailwindcss/typography": "^0.5.9","@vercel/analytics": "^0.1.8",- "autoprefixer": "^10.4.13","class-variance-authority": "^0.7.0","dayjs": "^1.11.7","gray-matter": "^4.0.3",diff --git a/apps/web/.env.test b/apps/web/.env.testindex bfd50acbf..c826ce18b 100644--- a/apps/web/.env.test+++ b/apps/web/.env.test@@ -1,6 +1,7 @@PORT=3002NEXT_PUBLIC_BASE_URL=http://localhost:3002-NEXTAUTH_URL=http://localhost:3002-SECRET_PASSWORD=abcdefghijklmnopqrstuvwxyz1234567890-DATABASE_URL=postgres://postgres:postgres@localhost:5450/db+NEXTAUTH_URL=$NEXT_PUBLIC_BASE_URL+SECRET_PASSWORD=abcdef1234567890abcdef1234567890+DATABASE_URL=postgres://postgres:postgres@localhost:5450/rallly+SMTP_PORT=4025\ No newline at end of filediff --git a/apps/web/package.json b/apps/web/package.jsonindex 7f137217d..502772d53 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -12,7 +12,7 @@"lint:tsc": "tsc --noEmit","i18n:scan": "i18next-scanner --config i18next-scanner.config.js","prettier": "prettier --write ./src",- "test:e2e": "playwright test",+ "test:integration": "playwright test","test:unit": "vitest run","test": "yarn test:unit && yarn test:e2e","test:codegen": "playwright codegen http://localhost:3000",@@ -31,7 +31,6 @@"@rallly/tailwind-config": "*","@rallly/ui": "*","@svgr/webpack": "^6.5.1",- "@tailwindcss/typography": "^0.5.9","@tanstack/react-query": "^4.0.0","@tanstack/react-table": "^8.9.1","@trpc/client": "^10.13.0",diff --git a/apps/web/playwright.config.ts b/apps/web/playwright.config.tsindex 36e6bc582..0219183cf 100644--- a/apps/web/playwright.config.ts+++ b/apps/web/playwright.config.ts@@ -6,11 +6,9 @@ const ci = process.env.CI === "true";dotenv.config({ path: path.resolve(__dirname, ".env.test") });-// Use process.env.PORT by default and fallback to port 3000-const PORT = process.env.PORT || 3000;-+const port = process.env.PORT || 3000;// Set webServer.url and use.baseURL with the location of the WebServer respecting the correct set port-const baseURL = `http://localhost:${PORT}`;+const baseURL = `http://localhost:${port}`;// Reference: https://playwright.dev/docs/test-configurationconst config: PlaywrightTestConfig = {@@ -24,11 +22,17 @@ const config: PlaywrightTestConfig = {trace: "retain-on-failure",},testDir: "./tests",- webServer: {- command: `NODE_ENV=test yarn start --port ${PORT}`,- url: baseURL,- reuseExistingServer: !process.env.CI,- },+ webServer: ci+ ? {+ command: `NODE_ENV=test next start --port ${port}`,+ url: baseURL,+ reuseExistingServer: false,+ }+ : {+ command: `NODE_ENV=test next dev --port ${port}`,+ url: baseURL,+ reuseExistingServer: true,+ },reporter: [[ci ? "github" : "list"],["html", { open: !ci ? "on-failure" : "never" }],diff --git a/apps/web/src/utils/emails.ts b/apps/web/src/utils/emails.tsindex 7ca7538e8..130c57471 100644--- a/apps/web/src/utils/emails.ts+++ b/apps/web/src/utils/emails.ts@@ -6,15 +6,12 @@ const env = process.env["NODE" + "_ENV"];export const emailClient = new EmailClient({openPreviews: env === "development",- useTestServer: env === "test",provider: {name: (process.env.EMAIL_PROVIDER as SupportedEmailProviders) ?? "smtp",},mail: {from: {- name:- (process.env.NOREPLY_EMAIL_NAME as string) ||- "Rallly",+ name: (process.env.NOREPLY_EMAIL_NAME as string) || "Rallly",address:(process.env.NOREPLY_EMAIL as string) ||(process.env.SUPPORT_EMAIL as string),diff --git a/docker-compose.dev.yml b/docker-compose.dev.ymlnew file mode 100644index 000000000..2ccffbe1b--- /dev/null+++ b/docker-compose.dev.yml@@ -0,0 +1,20 @@+services:+ rallly_db:+ image: postgres:14.2+ restart: always+ ports:+ - "5450:5432"+ volumes:+ - db-data:/var/lib/postgresql/data+ environment:+ - POSTGRES_PASSWORD=postgres+ - POSTGRES_DB=rallly+ healthcheck:+ test: ["CMD-SHELL", "pg_isready -U postgres"]+ interval: 5s+ timeout: 5s+ retries: 5++volumes:+ db-data:+ driver: localdiff --git a/docker-compose.e2e.yml b/docker-compose.e2e.ymldeleted file mode 100644index 7c66f413b..000000000--- a/docker-compose.e2e.yml+++ /dev/null@@ -1,27 +0,0 @@-services:- rallly_db:- image: postgres:14.2- restart: always- environment:- - POSTGRES_PASSWORD=postgres- - POSTGRES_DB=db- healthcheck:- test: ["CMD-SHELL", "pg_isready -U postgres"]- interval: 5s- timeout: 5s- retries: 5-- rallly:- build:- context: .- dockerfile: ./apps/web/Dockerfile- restart: always- depends_on:- rallly_db:- condition: service_healthy- ports:- - 3000:3000- environment:- - DATABASE_URL=postgres://postgres:postgres@rallly_db:5432/db- - NODE_ENV=test- - SECRET_PASSWORD=abcdefghijklmnopqrstuvwxyz1234567890diff --git a/docker-compose.yml b/docker-compose.ymlindex db71fcb13..6c1b04ab8 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -8,7 +8,7 @@ services:- db-data:/var/lib/postgresql/dataenvironment:- POSTGRES_PASSWORD=postgres- - POSTGRES_DB=db+ - POSTGRES_DB=ralllyhealthcheck:test: ["CMD-SHELL", "pg_isready -U postgres"]interval: 5s@@ -28,7 +28,7 @@ services:ports:- 3000:3000environment:- - DATABASE_URL=postgres://postgres:postgres@rallly_db:5450/db+ - DATABASE_URL=postgres://postgres:postgres@rallly_db:5450/ralllyenv_file:- .envdiff --git a/package.json b/package.jsonindex 469298b07..28f68e61f 100644--- a/package.json+++ b/package.json@@ -3,6 +3,7 @@"private": true,"version": "3.7.0","scripts": {+ "dx": "run-s docker:up db:setup","dev": "dotenv -c development -- turbo dev --filter=@rallly/web","dev:emails": "turbo dev --filter=@rallly/emails","dev:landing": "dotenv -c development turbo dev --filter=@rallly/landing",@@ -14,12 +15,11 @@"db:generate": "turbo db:generate","db:migrate": "prisma migrate dev","db:reset": "prisma migrate reset",- "db:up": "docker compose up -d rallly_db && wait-on --timeout 60000 tcp:localhost:5450","db:seed": "yarn workspace @rallly/database db:seed",- "db:down": "docker compose down --volumes --remove-orphans rallly_db",+ "docker:up": "docker compose -f docker-compose.dev.yml up -d && wait-on --timeout 60000 tcp:localhost:5450",+ "docker:down": "docker compose -f docker-compose.dev.yml down --volumes --remove-orphans","db:setup": "run-s db:deploy db:generate db:seed",- "dx": "run-s db:up db:setup",- "test": "turbo build:test && turbo test",+ "test:integration": "turbo test:integration","test:unit": "turbo test:unit","lint": "turbo lint","i18n:scan": "turbo i18n:scan",@@ -35,6 +35,7 @@"packages/*"],"dependencies": {+ "@prisma/client": "^5.3.1","@sentry/nextjs": "^7.77.0","framer-motion": "^10.16.4","next": "^14.0.4",@@ -44,6 +45,7 @@"zod": "^3.22.3"},"devDependencies": {+ "tailwindcss": "^3.4.4","@types/react": "^18.2.48","@types/react-dom": "^18.2.18","dotenv-cli": "^7.1.0",diff --git a/packages/database/package.json b/packages/database/package.jsonindex e37031cb3..38174fe86 100644--- a/packages/database/package.json+++ b/packages/database/package.json@@ -11,9 +11,6 @@},"main": "./index.ts","types": "./index.ts",- "dependencies": {- "@prisma/client": "^5.3.1"- },"devDependencies": {"@faker-js/faker": "^7.6.0","@rallly/tsconfig": "*",diff --git a/packages/emails/src/send-email.tsx b/packages/emails/src/send-email.tsxindex 0ede9c2c2..1ffcf3e69 100644--- a/packages/emails/src/send-email.tsx+++ b/packages/emails/src/send-email.tsx@@ -43,10 +43,6 @@ type EmailClientConfig = {* Whether to open previews of each email in the browser*/openPreviews?: boolean;- /**- * Whether to send emails to the test server- */- useTestServer: boolean;/*** Email provider config*/@@ -132,13 +128,6 @@ export class EmailClient {return this.cachedTransport;}- if (this.config.useTestServer) {- this.cachedTransport = createTransport({- port: 4025,- });- return this.cachedTransport;- }-switch (this.config.provider.name) {case "ses": {const ses = new aws.SES({diff --git a/packages/tailwind-config/package.json b/packages/tailwind-config/package.jsonindex 04a787ee6..de3970b17 100644--- a/packages/tailwind-config/package.json+++ b/packages/tailwind-config/package.json@@ -4,10 +4,9 @@"private": true,"main": "tailwind.config.js","types": "tailwind.config.d.ts",- "dependencies": {- "tailwindcss": "^3.4.1"- },"devDependencies": {+ "autoprefixer": "^10.4.13",+ "@tailwindcss/typography": "^0.5.13","tailwind-scrollbar": "^3.0.4","tailwindcss-animate": "^1.0.5"}diff --git a/turbo.json b/turbo.jsonindex ec913c98e..3523abc16 100644--- a/turbo.json+++ b/turbo.json@@ -27,6 +27,9 @@"test:unit": {"cache": true},+ "test:integration": {+ "cache": true+ },"db:generate": {"dependsOn": ["^db:generate"]},diff --git a/yarn.lock b/yarn.lockindex 71a10d4d9..9555fd4ab 100644--- a/yarn.lock+++ b/yarn.lock@@ -4113,10 +4113,10 @@resolved "https://registry.yarnpkg.com/@swc/types/-/types-0.1.5.tgz#043b731d4f56a79b4897a3de1af35e75d56bc63a"integrity sha512-myfUej5naTBWnqOCc/MdVOLVjXUXtIA+NpDrDBKJtLLg2shUjBu3cZmB/85RyitKc55+lUUyl7oRfLOvkr2hsw==-"@tailwindcss/typography@^0.5.9":- version "0.5.9"- resolved "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.9.tgz"- integrity sha512-t8Sg3DyynFysV9f4JDOVISGsjazNb48AeIYQwcL+Bsq5uf4RYL75C1giZ43KISjeDGBaTN3Kxh7Xj/vRSMJUUg==+"@tailwindcss/typography@^0.5.13":+ version "0.5.13"+ resolved "https://registry.yarnpkg.com/@tailwindcss/typography/-/typography-0.5.13.tgz#cd788a4fa4d0ca2506e242d512f377b22c1f7932"+ integrity sha512-ADGcJ8dX21dVVHIwTRgzrcunY6YY9uSlAHHGVKvkA+vLc5qLwEszvKts40lx7z0qc4clpjclwLeK5rVCV2P/uw==dependencies:lodash.castarray "^4.4.0"lodash.isplainobject "^4.0.6"@@ -5553,15 +5553,10 @@ camelcase@^6.2.0:resolved "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz"integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==-caniuse-lite@^1.0.30001406, caniuse-lite@^1.0.30001426, caniuse-lite@^1.0.30001449:- version "1.0.30001534"- resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001534.tgz"- integrity sha512-vlPVrhsCS7XaSh2VvWluIQEzVhefrUQcEsQWSS5A5V+dM07uv1qHeQzAOTGIMy9i3e9bH15+muvI/UHojVgS/Q==--caniuse-lite@^1.0.30001464, caniuse-lite@^1.0.30001580:- version "1.0.30001580"- resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001580.tgz#e3c76bc6fe020d9007647044278954ff8cd17d1e"- integrity sha512-mtj5ur2FFPZcCEpXFy8ADXbDACuNFXg6mxVDqp7tqooX6l3zwm+d8EPoeOSIFRDvHs8qu7/SLFOGniULkcH2iA==+caniuse-lite@^1.0.30001406, caniuse-lite@^1.0.30001426, caniuse-lite@^1.0.30001449, caniuse-lite@^1.0.30001464, caniuse-lite@^1.0.30001580:+ version "1.0.30001629"+ resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001629.tgz"+ integrity sha512-c3dl911slnQhmxUIT4HhYzT7wnBK/XYpGnYLOj4nJBaRiw52Ibe7YxlDaAeRECvA786zCuExhxIUJ2K7nHMrBw==ccount@^2.0.0:version "2.0.1"@@ -8482,6 +8477,11 @@ jiti@^1.19.1:resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.21.0.tgz#7c97f8fe045724e136a397f7340475244156105d"integrity sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==+jiti@^1.21.0:+ version "1.21.3"+ resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.21.3.tgz#b2adb07489d7629b344d59082bbedb8c21c5f755"+ integrity sha512-uy2bNX5zQ+tESe+TiC7ilGRz8AtRGmnJH55NC5S0nSUjvvvM2hJHmefHErugGXN4pNv4Qx7vLsnNw9qJ9mtIsw==+joi@^17.6.0:version "17.8.3"resolved "https://registry.npmjs.org/joi/-/joi-17.8.3.tgz"@@ -11861,10 +11861,10 @@ [email protected]:resolve "^1.22.2"sucrase "^3.32.0"-tailwindcss@^3.4.1:- version "3.4.1"- resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.4.1.tgz#f512ca5d1dd4c9503c7d3d28a968f1ad8f5c839d"- integrity sha512-qAYmXRfk3ENzuPBakNK0SRrUDipP8NQnEY6772uDhflcQz5EhRdD7JNZxyrFHVQNCwULPBn6FNPp9brpO7ctcA==+tailwindcss@^3.4.4:+ version "3.4.4"+ resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.4.4.tgz#351d932273e6abfa75ce7d226b5bf3a6cb257c05"+ integrity sha512-ZoyXOdJjISB7/BcLTR6SEsLgKtDStYyYZVLsUtWChO4Ps20CBad7lfJKVDiejocV4ME1hLmyY0WJE3hSDcmQ2A==dependencies:"@alloc/quick-lru" "^5.2.0"arg "^5.0.2"@@ -11874,7 +11874,7 @@ tailwindcss@^3.4.1:fast-glob "^3.3.0"glob-parent "^6.0.2"is-glob "^4.0.3"- jiti "^1.19.1"+ jiti "^1.21.0"lilconfig "^2.1.0"micromatch "^4.0.5"normalize-path "^3.0.0"