Skip to content

Commit

Permalink
commit config
Browse files Browse the repository at this point in the history
  • Loading branch information
prodkt committed Sep 16, 2024
0 parents commit 3ac0bfb
Show file tree
Hide file tree
Showing 34 changed files with 1,554 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
56 changes: 56 additions & 0 deletions .commitlintrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { getWorkspacePackageNames } from './scripts/utils'

// ------------------------------------------------------------------

// -- CUSTOM COMMITLINT CONFIGURATION --
// This configuration is used to enforce the scope-enum rule.
// The scope-enum rule requires that the scope of a commit message
// must be one of the defined values.
// The defined values are the package names of the workspace.
// The package names are extracted from the package.json files.
//
// This was previously achieved using @commitlint/config-pnpm-scopes
// which provides a custom commitlint configuration.

// ------------------------------------------------------------------

interface Context {
cwd?: string
}

// ------------------------------------------------------------------

/**
* Function to get all projects in the workspace
* @param context The context object
* @returns An array of all projects in the workspace
*/
function getProjects(context?: Context): string[] {
const ctx = context ?? {}
const cwd = ctx.cwd ?? process.cwd()

return getWorkspacePackageNames(cwd)
.reduce((projects: string[], name) => {
if (name.startsWith('@')) {
const project = name.split('/')[1]

if (typeof project === 'string') {
projects.push(project)
}

projects.push(name)
}

return projects
}, [])
.sort()
}

// We are exporting a custom commitlint configuration
export default {
extends: ['@commitlint/config-conventional'],
utils: { getProjects },
rules: {
'scope-enum': (ctx: Context) => [2, 'always', getProjects(ctx)],
},
}
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# These are supported funding model platforms
github: [prodkt]
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Fixes #

## Proposed Changes

-
-
-
24 changes: 24 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Setup'
description: 'Common setup steps for Actions'

runs:
using: composite
steps:
- uses: oven-sh/setup-bun@v1
name: Install bun

- uses: actions/cache@v4
name: Setup bun cache
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-${{ matrix.bun }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-${{ matrix.bun }}-bun-
- name: Install dependencies
shell: bash
run: bun install

- name: Install Playwright Browsers
shell: bash
run: bun playwright install --with-deps
111 changes: 111 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Main CI

on:
push:
branches:
- main

env:
# These are needed to enable turborepo's remote task caching
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}

jobs:
spell-and-md-lint:
name: Spellcheck and Markdown Lint
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Setup
uses: ./.github/actions/setup

- name: Checks
run: bun turbo lint:md lint:spell

web:
name: Web CI
runs-on: ubuntu-latest

environment: Production

env:
# Database URL
DATABASE_URL: ${{ secrets.DATABASE_URL }}

# Auth Secret
AUTH_SECRET: ${{ secrets.AUTH_SECRET }}

# Github OAuth
AUTH_GITHUB_ID: ${{ secrets.AUTH_GITHUB_ID }}
AUTH_GITHUB_SECRET: ${{ secrets.AUTH_GITHUB_SECRET }}

# Google OAuth
AUTH_GOOGLE_ID: ${{ secrets.AUTH_GOOGLE_ID }}
AUTH_GOOGLE_SECRET: ${{ secrets.AUTH_GOOGLE_SECRET }}

# Uploadthing
UPLOADTHING_SECRET: ${{ secrets.UPLOADTHING_SECRET }}
UPLOADTHING_APP_ID: ${{ secrets.UPLOADTHING_APP_ID }}

# Unkey
UNKEY_ROOT_KEY: ${{ secrets.UNKEY_ROOT_KEY }}
UNKEY_NAMESPACE: ${{ secrets.UNKEY_NAMESPACE }}

# Sentry
NEXT_PUBLIC_SENTRY_DSN: ${{ vars.PUBLIC_SENTRY_DSN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: web
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

# Posthog
NEXT_PUBLIC_POSTHOG_HOST: ${{ vars.PUBLIC_POSTHOG_HOST }}
NEXT_PUBLIC_POSTHOG_KEY: ${{ secrets.NEXT_PUBLIC_POSTHOG_KEY }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Setup
uses: ./.github/actions/setup

- name: Checks
run: bun turbo lint typecheck build test:e2e --filter=@prodkt/web

- uses: actions/upload-artifact@v4
if: always()
with:
name: web-playwright-report
path: apps/web/playwright-report/
retention-days: 30

marketing:
name: Marketing CI
runs-on: ubuntu-latest

environment: Production

env:
# Sentry
PUBLIC_SENTRY_DSN: ${{ vars.PUBLIC_SENTRY_DSN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: marketing
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Setup
uses: ./.github/actions/setup

- name: Checks
run: bun turbo lint typecheck build test:e2e --filter=@prodkt/marketing
20 changes: 20 additions & 0 deletions .github/workflows/pr-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Clean up after after a PR is closed or merged
run-name: Clean up PR database
on:
pull_request:
types: [closed]

jobs:
delete-db-branch:
runs-on: ubuntu-latest
steps:
- name: Get branch name
id: branch_name
uses: tj-actions/branch-names@v8

- name: Delete Neon Branch
uses: neondatabase/delete-branch-action@v3
with:
project_id: ${{ secrets.NEON_PROJECT_ID }}
branch: web/pr-${{ github.event.number }}-${{ steps.branch_name.outputs.current_branch }}
api_key: ${{ secrets.NEON_API_KEY }}
Loading

0 comments on commit 3ac0bfb

Please sign in to comment.