Skip to content

Commit 5342aef

Browse files
committed
First
1 parent 9705cfd commit 5342aef

Some content is hidden

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

59 files changed

+19491
-0
lines changed

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/node_modules
2+
*.log
3+
.DS_Store
4+
.env
5+
/.cache
6+
/public/build
7+
/build

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
DATABASE_URL="file:./data.db?connection_limit=1"
2+
SESSION_SECRET="super-duper-s3cret"

.eslintrc.cjs

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
/**
2+
* This is intended to be a basic starting point for linting in the Indie Stack.
3+
* It relies on recommended configs out of the box for simplicity, but you can
4+
* and should modify this configuration to best suit your team's needs.
5+
*/
6+
7+
/** @type {import('eslint').Linter.Config} */
8+
module.exports = {
9+
root: true,
10+
parserOptions: {
11+
ecmaVersion: "latest",
12+
sourceType: "module",
13+
ecmaFeatures: {
14+
jsx: true,
15+
},
16+
},
17+
env: {
18+
browser: true,
19+
commonjs: true,
20+
es6: true,
21+
},
22+
23+
// Base config
24+
extends: ["eslint:recommended"],
25+
26+
overrides: [
27+
// React
28+
{
29+
files: ["**/*.{js,jsx,ts,tsx}"],
30+
plugins: ["react", "jsx-a11y"],
31+
extends: [
32+
"plugin:react/recommended",
33+
"plugin:react/jsx-runtime",
34+
"plugin:react-hooks/recommended",
35+
"plugin:jsx-a11y/recommended",
36+
"prettier",
37+
],
38+
settings: {
39+
react: {
40+
version: "detect",
41+
},
42+
formComponents: ["Form"],
43+
linkComponents: [
44+
{ name: "Link", linkAttribute: "to" },
45+
{ name: "NavLink", linkAttribute: "to" },
46+
],
47+
},
48+
rules: {
49+
"react/jsx-no-leaked-render": [
50+
"warn",
51+
{ validStrategies: ["ternary"] },
52+
],
53+
},
54+
},
55+
56+
// Typescript
57+
{
58+
files: ["**/*.{ts,tsx}"],
59+
plugins: ["@typescript-eslint", "import"],
60+
parser: "@typescript-eslint/parser",
61+
settings: {
62+
"import/internal-regex": "^~/",
63+
"import/resolver": {
64+
node: {
65+
extensions: [".ts", ".tsx"],
66+
},
67+
typescript: {
68+
alwaysTryTypes: true,
69+
},
70+
},
71+
},
72+
extends: [
73+
"plugin:@typescript-eslint/recommended",
74+
"plugin:@typescript-eslint/stylistic",
75+
"plugin:import/recommended",
76+
"plugin:import/typescript",
77+
"prettier",
78+
],
79+
rules: {
80+
"import/order": [
81+
"error",
82+
{
83+
alphabetize: { caseInsensitive: true, order: "asc" },
84+
groups: ["builtin", "external", "internal", "parent", "sibling"],
85+
"newlines-between": "always",
86+
},
87+
],
88+
},
89+
},
90+
91+
// Markdown
92+
{
93+
files: ["**/*.md"],
94+
plugins: ["markdown"],
95+
extends: ["plugin:markdown/recommended-legacy", "prettier"],
96+
},
97+
98+
// Jest/Vitest
99+
{
100+
files: ["**/*.test.{js,jsx,ts,tsx}"],
101+
plugins: ["jest", "jest-dom", "testing-library"],
102+
extends: [
103+
"plugin:jest/recommended",
104+
"plugin:jest-dom/recommended",
105+
"plugin:testing-library/react",
106+
"prettier",
107+
],
108+
env: {
109+
"jest/globals": true,
110+
},
111+
settings: {
112+
jest: {
113+
// We're using vitest which has a very similar API to jest
114+
// (so the linting plugins work nicely), but it means we
115+
// have to set the jest version explicitly.
116+
version: 28,
117+
},
118+
},
119+
},
120+
121+
// Cypress
122+
{
123+
files: ["cypress/**/*.ts"],
124+
plugins: ["cypress"],
125+
extends: ["plugin:cypress/recommended", "prettier"],
126+
},
127+
128+
// Node
129+
{
130+
files: [".eslintrc.js", "mocks/**/*.js"],
131+
env: {
132+
node: true,
133+
},
134+
},
135+
],
136+
};

.github/workflows/deploy.yml

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
name: 🚀 Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
pull_request:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
actions: write
16+
contents: read
17+
18+
jobs:
19+
lint:
20+
name: ⬣ ESLint
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: ⬇️ Checkout repo
24+
uses: actions/checkout@v4
25+
26+
- name: ⎔ Setup node
27+
uses: actions/setup-node@v4
28+
with:
29+
cache: npm
30+
cache-dependency-path: ./package.json
31+
node-version: 18
32+
33+
- name: 📥 Install deps
34+
run: npm install
35+
36+
- name: 🔬 Lint
37+
run: npm run lint
38+
39+
typecheck:
40+
name: ʦ TypeScript
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: ⬇️ Checkout repo
44+
uses: actions/checkout@v4
45+
46+
- name: ⎔ Setup node
47+
uses: actions/setup-node@v4
48+
with:
49+
cache: npm
50+
cache-dependency-path: ./package.json
51+
node-version: 18
52+
53+
- name: 📥 Install deps
54+
run: npm install
55+
56+
- name: 🔎 Type check
57+
run: npm run typecheck --if-present
58+
59+
vitest:
60+
name: ⚡ Vitest
61+
runs-on: ubuntu-latest
62+
steps:
63+
- name: ⬇️ Checkout repo
64+
uses: actions/checkout@v4
65+
66+
- name: ⎔ Setup node
67+
uses: actions/setup-node@v4
68+
with:
69+
cache: npm
70+
cache-dependency-path: ./package.json
71+
node-version: 18
72+
73+
- name: 📥 Install deps
74+
run: npm install
75+
76+
- name: ⚡ Run vitest
77+
run: npm run test -- --coverage
78+
79+
cypress:
80+
name: ⚫️ Cypress
81+
runs-on: ubuntu-latest
82+
steps:
83+
- name: ⬇️ Checkout repo
84+
uses: actions/checkout@v4
85+
86+
- name: 🏄 Copy test env vars
87+
run: cp .env.example .env
88+
89+
- name: ⎔ Setup node
90+
uses: actions/setup-node@v4
91+
with:
92+
cache: npm
93+
cache-dependency-path: ./package.json
94+
node-version: 18
95+
96+
- name: 📥 Install deps
97+
run: npm install
98+
99+
- name: 🛠 Setup Database
100+
run: npx prisma migrate reset --force
101+
102+
- name: ⚙️ Build
103+
run: npm run build
104+
105+
- name: 🌳 Cypress run
106+
uses: cypress-io/github-action@v6
107+
with:
108+
start: npm run start:mocks
109+
wait-on: http://localhost:8811
110+
env:
111+
PORT: 8811
112+
113+
deploy:
114+
name: 🚀 Deploy
115+
runs-on: ubuntu-latest
116+
needs: [lint, typecheck, vitest, cypress]
117+
# only deploy main/dev branch on pushes
118+
if: ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && github.event_name == 'push' }}
119+
120+
steps:
121+
- name: ⬇️ Checkout repo
122+
uses: actions/checkout@v4
123+
124+
- name: 👀 Read app name
125+
uses: SebRollen/toml-action@v1.2.0
126+
id: app_name
127+
with:
128+
file: fly.toml
129+
field: app
130+
131+
- name: 🎈 Setup Fly
132+
uses: superfly/flyctl-actions/setup-flyctl@v1
133+
134+
- name: 🚀 Deploy Staging
135+
if: ${{ github.ref == 'refs/heads/dev' }}
136+
run: flyctl deploy --remote-only --build-arg COMMIT_SHA=${{ github.sha }} --app ${{ steps.app_name.outputs.value }}-staging
137+
env:
138+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
139+
140+
- name: 🚀 Deploy Production
141+
if: ${{ github.ref == 'refs/heads/main' }}
142+
run: flyctl deploy --remote-only --build-arg COMMIT_SHA=${{ github.sha }} --app ${{ steps.app_name.outputs.value }}
143+
env:
144+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
node_modules
2+
3+
/build
4+
/public/build
5+
.env
6+
7+
/cypress/screenshots
8+
/cypress/videos
9+
/prisma/data.db
10+
/prisma/data.db-journal

.gitpod.Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM gitpod/workspace-full
2+
3+
# Install Fly
4+
RUN curl -L https://fly.io/install.sh | sh
5+
ENV FLYCTL_INSTALL="/home/gitpod/.fly"
6+
ENV PATH="$FLYCTL_INSTALL/bin:$PATH"
7+
8+
# Install GitHub CLI
9+
RUN brew install gh

.gitpod.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# https://www.gitpod.io/docs/config-gitpod-file
2+
3+
image:
4+
file: .gitpod.Dockerfile
5+
6+
ports:
7+
- port: 3000
8+
onOpen: notify
9+
10+
tasks:
11+
- name: Restore .env file
12+
command: |
13+
if [ -f .env ]; then
14+
# If this workspace already has a .env, don't override it
15+
# Local changes survive a workspace being opened and closed
16+
# but they will not persist between separate workspaces for the same repo
17+
18+
echo "Found .env in workspace"
19+
else
20+
# There is no .env
21+
if [ ! -n "${ENV}" ]; then
22+
# There is no $ENV from a previous workspace
23+
# Default to the example .env
24+
echo "Setting example .env"
25+
26+
cp .env.example .env
27+
else
28+
# After making changes to .env, run this line to persist it to $ENV
29+
# eval $(gp env -e ENV="$(base64 .env | tr -d '\n')")
30+
#
31+
# Environment variables set this way are shared between all your workspaces for this repo
32+
# The lines below will read $ENV and print a .env file
33+
34+
echo "Restoring .env from Gitpod"
35+
36+
echo "${ENV}" | base64 -d | tee .env > /dev/null
37+
fi
38+
fi
39+
40+
- init: npm install
41+
command: npm run setup && npm run dev
42+
43+
vscode:
44+
extensions:
45+
- ms-azuretools.vscode-docker
46+
- esbenp.prettier-vscode
47+
- dbaeumer.vscode-eslint
48+
- bradlc.vscode-tailwindcss

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
legacy-peer-deps=true

.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
3+
/build
4+
/public/build
5+
.env
6+
7+
/app/styles/tailwind.css

0 commit comments

Comments
 (0)