Skip to content

Commit 3dd332e

Browse files
typeofwebzaiste
andcommitted
initial commit for open-source repo
Co-authored-by: zaiste <[email protected]>
0 parents  commit 3dd332e

File tree

149 files changed

+19865
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+19865
-0
lines changed

.env-example

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ENABLE_EXPERIMENTAL_COREPACK=1
2+
3+
NEXT_PUBLIC_URL=http://localhost:3000
4+
5+
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=
6+
STRIPE_SECRET_KEY=
7+
STRIPE_WEBHOOK_SECRET=
8+
9+
STRIPE_CURRENCY=usd
10+
11+
NEXT_PUBLIC_UMAMI_WEBSITE_ID=
12+
13+
ENABLE_STRIPE_TAX=
14+
15+
NEXT_PUBLIC_LANGUAGE=en

.eslintrc.json

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
{
2+
"$schema": "https://json.schemastore.org/eslintrc.json",
3+
"plugins": ["@typescript-eslint", "import", "eslint-plugin-react-compiler"],
4+
"parserOptions": {
5+
"project": "tsconfig.json"
6+
},
7+
"extends": [
8+
"plugin:@typescript-eslint/recommended-type-checked",
9+
"plugin:@typescript-eslint/stylistic-type-checked",
10+
"plugin:import/recommended",
11+
"plugin:import/typescript",
12+
"prettier",
13+
"next/core-web-vitals"
14+
],
15+
"rules": {
16+
// these rules are too slow
17+
"import/no-cycle": "off",
18+
"react-compiler/react-compiler": "off",
19+
"@typescript-eslint/no-unsafe-assignment": "off",
20+
"@typescript-eslint/no-unused-vars": "off",
21+
22+
// this doesn't make any sense
23+
"@typescript-eslint/prefer-nullish-coalescing": "off",
24+
25+
// no
26+
"@typescript-eslint/consistent-type-definitions": "off",
27+
28+
// why tho
29+
"@typescript-eslint/array-type": "off",
30+
31+
// sort imports
32+
"import/order": "error",
33+
34+
// no let exports
35+
"import/no-mutable-exports": "error",
36+
37+
"import/no-default-export": "error",
38+
39+
// allow {} even though it's unsafe but comes handy
40+
"@typescript-eslint/ban-types": [
41+
"error",
42+
{
43+
"types": {
44+
"{}": false
45+
}
46+
}
47+
],
48+
49+
"@typescript-eslint/consistent-type-imports": [
50+
"error",
51+
{
52+
"prefer": "type-imports",
53+
"fixStyle": "inline-type-imports",
54+
"disallowTypeAnnotations": false
55+
}
56+
],
57+
58+
"import/no-duplicates": ["error", { "prefer-inline": true }],
59+
60+
// false negatives
61+
"import/namespace": ["off"],
62+
63+
// we allow empty interfaces
64+
"no-empty-pattern": "off",
65+
"@typescript-eslint/no-empty-interface": "off",
66+
67+
// we allow empty functions
68+
"@typescript-eslint/no-empty-function": "off",
69+
70+
// we sometimes use async functions that don't await anything
71+
"@typescript-eslint/require-await": "off",
72+
73+
// make sure to `await` inside try…catch
74+
"@typescript-eslint/return-await": ["error", "in-try-catch"],
75+
76+
"react/no-unescaped-entities": "off",
77+
78+
// numbers and booleans are fine in template strings
79+
"@typescript-eslint/restrict-template-expressions": [
80+
"error",
81+
{ "allowNumber": true, "allowBoolean": true }
82+
],
83+
84+
"@typescript-eslint/no-misused-promises": ["error", { "checksVoidReturn": false }],
85+
86+
"no-restricted-imports": [
87+
"error",
88+
{
89+
"name": "next/router",
90+
"message": "Please use next/navigation instead."
91+
}
92+
]
93+
},
94+
"overrides": [
95+
{
96+
"files": [
97+
"src/app/**/{page,layout,loading,route,not-found,error,global-error,default,robots,sitemap,opengraph-image}.ts?(x)",
98+
"src/i18n.ts",
99+
"*.d.ts",
100+
"tailwind.config.ts",
101+
"prettier.config.js",
102+
"middleware.ts",
103+
"commitlint.config.ts",
104+
"vitest.config.ts"
105+
],
106+
"rules": {
107+
"import/no-default-export": "off"
108+
}
109+
}
110+
],
111+
"ignorePatterns": ["*.js", "*.jsx", "*.mjs", "src/script/**/*.ts"]
112+
}

.github/workflows/release.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
relase:
12+
name: Release
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write # to be able to publish a GitHub release
16+
issues: write # to be able to comment on released issues
17+
pull-requests: write # to be able to comment on released pull requests
18+
id-token: write # to enable use of OIDC for npm provenance
19+
env:
20+
NEXT_PUBLIC_URL: ${{ vars.NEXT_PUBLIC_URL }}
21+
STRIPE_CURRENCY: ${{ vars.STRIPE_CURRENCY }}
22+
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: ${{ secrets.STRIPE_PUBLISHABLE_KEY }}
23+
STRIPE_SECRET_KEY: ${{ secrets.STRIPE_SECRET_KEY }}
24+
STRIPE_WEBHOOK_SECRET: ${{ secrets.STRIPE_WEBHOOK_SECRET }}
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- uses: pnpm/action-setup@v3
31+
32+
- uses: actions/setup-node@v4
33+
with:
34+
node-version-file: "package.json"
35+
cache: "pnpm"
36+
37+
- uses: actions/cache@v4
38+
with:
39+
path: |
40+
${{ github.workspace }}/.next/cache
41+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
42+
restore-keys: |
43+
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.json') }}-
44+
45+
- name: Install dependencies
46+
run: pnpm --version && pnpm install --frozen-lockfile
47+
48+
- name: Check prettier
49+
run: pnpm prettier --check .
50+
51+
- name: Build
52+
run: pnpm build
53+
54+
- name: Test
55+
run: pnpm test
56+
57+
- name: Release
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
run: pnpm semantic-release

.github/workflows/test.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: tests
2+
on:
3+
pull_request:
4+
merge_group:
5+
6+
concurrency:
7+
group: tests-${{ github.event.pull_request.number || github.ref }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Enable Corepack
17+
run: corepack enable
18+
19+
- name: Install Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version-file: package.json
23+
cache: "pnpm"
24+
25+
- name: Install dependencies
26+
run: pnpm --version && pnpm install --frozen-lockfile
27+
28+
- name: Check prettier
29+
run: pnpm prettier --cache --check .
30+
31+
- name: Eslint
32+
run: pnpm lint
33+
34+
- name: Test
35+
run: pnpm test

.gitignore

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
src/gql/
3+
4+
.env
5+
6+
# dependencies
7+
/node_modules
8+
/.pnp
9+
.pnp.js
10+
11+
# testing
12+
/coverage
13+
14+
# next.js
15+
/.next/
16+
/out/
17+
18+
# production
19+
/build
20+
21+
# misc
22+
.DS_Store
23+
*.pem
24+
25+
# debug
26+
npm-debug.log*
27+
yarn-debug.log*
28+
yarn-error.log*
29+
30+
# local env files
31+
.env*.local
32+
33+
# vercel
34+
.vercel
35+
36+
# typescript
37+
*.tsbuildinfo
38+
next-env.d.ts
39+
.prototools

.husky/commit-msg

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm commitlint --edit $1

.husky/pre-commit

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
pnpm lint-staged

.lintstagedrc.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// https://nextjs.org/docs/basic-features/eslint#lint-staged
2+
// @ts-check
3+
import Path from "node:path";
4+
5+
const buildEslintCommand = (filenames) =>
6+
`next lint --fix --file ${filenames
7+
.map((f) => Path.relative(process.cwd(), f))
8+
.join(" --file ")}`;
9+
10+
export default {
11+
"*.{js,mjs,jsx,ts,tsx}": [buildEslintCommand],
12+
"*.*": "prettier --write --ignore-unknown",
13+
};

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
save-exact=true

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.next
2+
node_modules
3+
pnpm-lock.yaml

.vscode/extensions.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"recommendations": [
3+
"esbenp.prettier-vscode",
4+
"dbaeumer.vscode-eslint",
5+
"bradlc.vscode-tailwindcss",
6+
"inlang.vs-code-extension"
7+
]
8+
}

.vscode/launch.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Next.js: debug server-side",
6+
"type": "node-terminal",
7+
"request": "launch",
8+
"command": "pnpm dev"
9+
},
10+
{
11+
"name": "Next.js: debug client-side",
12+
"type": "chrome",
13+
"request": "launch",
14+
"url": "http://localhost:3000"
15+
},
16+
{
17+
"name": "Next.js: debug full stack",
18+
"type": "node-terminal",
19+
"request": "launch",
20+
"command": "pnpm dev",
21+
"serverReadyAction": {
22+
"pattern": "- Local:.+(https?://.+)",
23+
"uriFormat": "%s",
24+
"action": "debugWithChrome"
25+
}
26+
}
27+
]
28+
}

.vscode/settings.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"typescript.tsdk": "node_modules/typescript/lib",
3+
"typescript.enablePromptUseWorkspaceTsdk": true,
4+
"tailwindCSS.experimental.classRegex": [
5+
["(?:twMerge|twJoin|cva|cn|clsx)\\(([^\\);]*)[\\);]", "[`'\"]([^'\"`,;]*)[`'\"]"]
6+
],
7+
"tailwindCSS.classAttributes": ["className", "tw", "class"],
8+
"typescript.preferences.importModuleSpecifier": "non-relative",
9+
"editor.defaultFormatter": "esbenp.prettier-vscode",
10+
"files.associations": {
11+
"*.css": "tailwindcss"
12+
},
13+
"editor.formatOnSave": true,
14+
"editor.codeActionsOnSave": {
15+
"source.fixAll.eslint": "always"
16+
},
17+
"editor.quickSuggestions": {
18+
"strings": true
19+
}
20+
}

0 commit comments

Comments
 (0)