Skip to content

Commit

Permalink
init: istalled deps
Browse files Browse the repository at this point in the history
  • Loading branch information
L-Steinmacher committed Jun 30, 2023
0 parents commit 6ddf368
Show file tree
Hide file tree
Showing 238 changed files with 46,895 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
LITEFS_DIR="/litefs/data"
DATABASE_PATH="./prisma/data.db"
DATABASE_URL="file:./data.db?connection_limit=1"
CACHE_DATABASE_PATH="./other/cache.db"
SESSION_SECRET="super-duper-s3cret"
INTERNAL_COMMAND_TOKEN="some-made-up-token"
RESEND_API_KEY="re_blAh_blaHBlaHblahBLAhBlAh"
SENTRY_DSN="your-dsn"
68 changes: 68 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
const vitestFiles = ['app/**/__tests__/**/*', 'app/**/*.{spec,test}.*']
const testFiles = ['**/tests/**', ...vitestFiles]
const appFiles = ['app/**']

/** @type {import('@types/eslint').Linter.BaseConfig} */
module.exports = {
extends: [
'@remix-run/eslint-config',
'@remix-run/eslint-config/node',
'prettier',
],
rules: {
'@typescript-eslint/consistent-type-imports': [
'warn',
{
prefer: 'type-imports',
disallowTypeAnnotations: true,
fixStyle: 'inline-type-imports',
},
],
'import/no-duplicates': 'warn',
},
overrides: [
{
plugins: ['remix-react-routes'],
files: appFiles,
excludedFiles: testFiles,
rules: {
'remix-react-routes/use-link-for-routes': 'error',
'remix-react-routes/require-valid-paths': 'error',
// disable this one because it doesn't appear to work with our
// route convention. Someone should dig deeper into this...
'remix-react-routes/no-relative-paths': [
'off',
{ allowLinksToSelf: true },
],
'remix-react-routes/no-urls': 'error',
'no-restricted-imports': [
'error',
{
patterns: [
{
group: testFiles,
message: 'Do not import test files in app files',
},
],
},
],
},
},
{
extends: ['@remix-run/eslint-config/jest-testing-library'],
files: vitestFiles,
rules: {
'testing-library/no-await-sync-events': 'off',
'jest-dom/prefer-in-document': 'off',
},
// we're using vitest which has a very similar API to jest
// (so the linting plugins work nicely), but it means we have to explicitly
// set the jest version.
settings: {
jest: {
version: 28,
},
},
},
],
}
15 changes: 15 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- Summary: Put your summary here -->

## Test Plan

<!-- What steps need to be taken to verify this works as expected? -->

## Checklist

- [ ] Tests updated
- [ ] Docs updated

## Screenshots

<!-- If what you're changing is within the app, please show before/after.
You can provide a video as well if that makes more sense -->
163 changes: 163 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
name: 🚀 Deploy
on:
push:
branches:
- main
- dev
pull_request: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
actions: write
contents: read

jobs:
lint:
name: ⬣ ESLint
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3

- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version: 18

- name: 📥 Download deps
uses: bahmutov/npm-install@v1

- name: 🔬 Lint
run: npm run lint

typecheck:
name: ʦ TypeScript
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3

- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version: 18

- name: 📥 Download deps
uses: bahmutov/npm-install@v1

- name: 🔎 Type check
run: npm run typecheck --if-present

vitest:
name: ⚡ Vitest
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3

- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version: 18

- name: 📥 Download deps
uses: bahmutov/npm-install@v1

- name: 🏄 Copy test env vars
run: cp .env.example .env

- name: ⚡ Run vitest
run: npm run test -- --coverage

playwright:
name: 🎭 Playwright
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3

- name: 🏄 Copy test env vars
run: cp .env.example .env

- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version: 18

- name: 📥 Download deps
uses: bahmutov/npm-install@v1

- name: 📥 Install Playwright Browsers
run: npm run test:e2e:install

- name: 🛠 Setup Database
run: npx prisma migrate deploy

- name: 🏦 Cache Database
id: db-cache
uses: actions/cache@v3
with:
path: prisma/data.db
key: db-cache

- name: 🏗 Build
run: npm run build

- name: 🎭 Playwright tests
run: npx playwright test

- name: 📊 Upload report
uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30

deploy:
name: 🚀 Deploy
runs-on: ubuntu-latest
needs: [lint, typecheck, vitest, playwright]
# only build/deploy main branch on pushes
if:
${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') &&
github.event_name == 'push' }}

steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3

- name: 👀 Read app name
uses: SebRollen/toml-action@v1.0.2
id: app_name
with:
file: 'fly.toml'
field: 'app'

# move Dockerfile to root
- name: 🚚 Move Dockerfile
run: |
mv ./other/Dockerfile ./Dockerfile
mv ./other/.dockerignore ./.dockerignore
- name: 🚀 Deploy Staging
if: ${{ github.ref == 'refs/heads/dev' }}
uses: superfly/flyctl-actions@1.3
with:
args:
'deploy --remote-only --build-arg COMMIT_SHA=${{ github.sha }} --app
${{ steps.app_name.outputs.value }}-staging'
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

- name: 🚀 Deploy Production
if: ${{ github.ref == 'refs/heads/main' }}
uses: superfly/flyctl-actions@1.3
with:
args: 'deploy --remote-only --build-arg COMMIT_SHA=${{ github.sha }}'
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
node_modules

/build
/public/build
/server-build
.env

/prisma/data.db
/prisma/data.db-journal
/tests/prisma

/test-results/
/playwright-report/
/playwright/.cache/
/tests/fixtures/email/
/coverage

/other/cache.db

# Easy way to create temporary files/folders that won't accidentally be added to git
*.local.*
*.ignored.*
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
legacy-peer-deps=true
registry=https://registry.npmjs.org/
15 changes: 15 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules

/build
/public/build
/server-build
.env

/test-results/
/playwright-report/
/playwright/.cache/
/tests/fixtures/email/*.json
/coverage
/prisma/migrations

package-lock.json
29 changes: 29 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = {
arrowParens: 'avoid',
bracketSameLine: false,
bracketSpacing: true,
embeddedLanguageFormatting: 'auto',
endOfLine: 'lf',
htmlWhitespaceSensitivity: 'css',
insertPragma: false,
jsxSingleQuote: false,
printWidth: 80,
proseWrap: 'always',
quoteProps: 'as-needed',
requirePragma: false,
semi: false,
singleAttributePerLine: false,
singleQuote: true,
tabWidth: 2,
trailingComma: 'all',
useTabs: true,
overrides: [
{
files: ['**/*.json'],
options: {
useTabs: false,
},
},
],
plugins: [require('prettier-plugin-tailwindcss')],
}
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"prisma.prisma",
"bradlc.vscode-tailwindcss"
]
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"typescript.preferences.autoImportFileExcludePatterns": [
"@remix-run/server-runtime",
"@remix-run/router",
"react-router"
]
}
Loading

0 comments on commit 6ddf368

Please sign in to comment.