Skip to content

Commit

Permalink
initial commit, remix example
Browse files Browse the repository at this point in the history
This is the result of calling npx create-remix-app and creating
and initializing the app.
  • Loading branch information
Glauber Costa authored and dekimir committed Jul 27, 2022
1 parent cde07a8 commit abb981e
Show file tree
Hide file tree
Showing 61 changed files with 2,517 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -4,6 +4,7 @@ Welcome to the repository of ChiselStrike examples!

* [Blog application using Gatsby with ChiselStrike](./gatsby)
* [Simple application using Next.js with ChiselStrike](./nextjs)
* [Adding blog posts to the Remix tutorial with ChiselStrike](./remix)
* [Todo application using Replicache and ChiselStrike](https://github.com/penberg/replicache-todo)
* [URL shortener using Gatsby and ChiselStrike](https://github.com/apoorv-on-git/chisel-shortner) by @apoorv-on-git

Expand Down
7 changes: 7 additions & 0 deletions remix/.dockerignore
@@ -0,0 +1,7 @@
/node_modules
*.log
.DS_Store
.env
/.cache
/public/build
/build
2 changes: 2 additions & 0 deletions remix/.env.example
@@ -0,0 +1,2 @@
DATABASE_URL="file:./data.db?connection_limit=1"
SESSION_SECRET="super-duper-s3cret"
19 changes: 19 additions & 0 deletions remix/.eslintrc.js
@@ -0,0 +1,19 @@
/**
* @type {import('@types/eslint').Linter.BaseConfig}
*/
module.exports = {
extends: [
"@remix-run/eslint-config",
"@remix-run/eslint-config/node",
"@remix-run/eslint-config/jest-testing-library",
"prettier",
],
// 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: 27,
},
},
};
41 changes: 41 additions & 0 deletions remix/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -0,0 +1,41 @@
name: 🐛 Bug Report
description: Something is wrong with the Stack.
body:
- type: markdown
attributes:
value: >-
Thank you for helping to improve Remix!
Our bandwidth on maintaining these stacks is limited. As a team, we're
currently focusing our efforts on Remix itself. The good news is you can
fork and adjust this stack however you'd like and start using it today
as a custom stack. Learn more from
[the Remix Stacks docs](https://remix.run/stacks).
If you'd still like to report a bug, please fill out this form. We can't
promise a timely response, but hopefully when we have the bandwidth to
work on these stacks again we can take a look. Thanks!
- type: input
attributes:
label: Have you experienced this bug with the latest version of the template?
validations:
required: true
- type: textarea
attributes:
label: Steps to Reproduce
description: Steps to reproduce the behavior.
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
description: A concise description of what you expected to happen.
validations:
required: true
- type: textarea
attributes:
label: Actual Behavior
description: A concise description of what you're experiencing.
validations:
required: true
21 changes: 21 additions & 0 deletions remix/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,21 @@
blank_issues_enabled: false
contact_links:
- name: Get Help
url: https://github.com/remix-run/remix/discussions/new?category=q-a
about:
If you can't get something to work the way you expect, open a question in
the Remix discussions.
- name: Feature Request
url: https://github.com/remix-run/remix/discussions/new?category=ideas
about:
We appreciate you taking the time to improve Remix with your ideas, but we
use the Remix Discussions for this instead of the issues tab 🙂.
- name: 💬 Remix Discord Channel
url: https://rmx.as/discord
about: Interact with other people using Remix 💿
- name: 💬 New Updates (Twitter)
url: https://twitter.com/remix_run
about: Stay up to date with Remix news on twitter
- name: 🍿 Remix YouTube Channel
url: https://rmx.as/youtube
about: Are you a tech lead or wanting to learn more about Remix in depth? Checkout the Remix YouTube Channel
14 changes: 14 additions & 0 deletions remix/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,14 @@
<!--
👋 Hey, thanks for your interest in contributing to Remix!
Our bandwidth on maintaining these stacks is limited. As a team, we're currently
focusing our efforts on Remix itself. The good news is you can fork and adjust
this stack however you'd like and start using it today as a custom stack. Learn
more from [the Remix Stacks docs](https://remix.run/stacks).
You're still welcome to make a PR. We can't promise a timely response, but
hopefully when we have the bandwidth to work on these stacks again we can take
a look. Thanks!
-->
213 changes: 213 additions & 0 deletions remix/.github/workflows/deploy.yml
@@ -0,0 +1,213 @@
name: 🚀 Deploy
on:
push:
branches:
- main
- dev
pull_request: {}
permissions:
actions: write
contents: read

jobs:
lint:
name: ⬣ ESLint
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1

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

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

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

- name: 🔬 Lint
run: npm run lint

typecheck:
name: ʦ TypeScript
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1

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

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

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

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

vitest:
name: ⚡ Vitest
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1

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

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

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

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

cypress:
name: ⚫️ Cypress
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1

- 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: 16

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

- name: 🛠 Setup Database
run: npx prisma migrate reset --force

- name: ⚙️ Build
run: npm run build

- name: 🌳 Cypress run
uses: cypress-io/github-action@v4
with:
start: npm run start:mocks
wait-on: "http://localhost:8811"
env:
PORT: "8811"

build:
name: 🐳 Build
# only build/deploy main branch on pushes
if: ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1

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

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

- name: 🐳 Set up Docker Buildx
uses: docker/setup-buildx-action@v2

# Setup cache
- name: ⚡️ Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: 🔑 Fly Registry Auth
uses: docker/login-action@v2
with:
registry: registry.fly.io
username: x
password: ${{ secrets.FLY_API_TOKEN }}

- name: 🐳 Docker build
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: registry.fly.io/${{ steps.app_name.outputs.value }}:${{ github.ref_name }}-${{ github.sha }}
build-args: |
COMMIT_SHA=${{ github.sha }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new

# This ugly bit is necessary if you don't want your cache to grow forever
# till it hits GitHub's limit of 5GB.
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: 🚚 Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
deploy:
name: 🚀 Deploy
runs-on: ubuntu-latest
needs: [lint, typecheck, vitest, cypress, build]
# only build/deploy main branch on pushes
if: ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && github.event_name == 'push' }}

steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1

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

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

- name: 🚀 Deploy Staging
if: ${{ github.ref == 'refs/heads/dev' }}
uses: superfly/flyctl-actions@1.3
with:
args: "deploy --app ${{ steps.app_name.outputs.value }}-staging --image registry.fly.io/${{ steps.app_name.outputs.value }}:${{ github.ref_name }}-${{ github.sha }}"
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 --image registry.fly.io/${{ steps.app_name.outputs.value }}:${{ github.ref_name }}-${{ github.sha }}"
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
19 changes: 19 additions & 0 deletions remix/.gitignore
@@ -0,0 +1,19 @@
# We don't want lockfiles in stacks, as people could use a different package manager
# This part will be removed by `remix.init`
package-lock.json
yarn.lock
pnpm-lock.yaml
pnpm-lock.yml

node_modules

/build
/public/build
.env

/cypress/screenshots
/cypress/videos
/prisma/data.db
/prisma/data.db-journal

/app/styles/tailwind.css
9 changes: 9 additions & 0 deletions remix/.gitpod.Dockerfile
@@ -0,0 +1,9 @@
FROM gitpod/workspace-full

# Install Fly
RUN curl -L https://fly.io/install.sh | sh
ENV FLYCTL_INSTALL="/home/gitpod/.fly"
ENV PATH="$FLYCTL_INSTALL/bin:$PATH"

# Install GitHub CLI
RUN brew install gh

0 comments on commit abb981e

Please sign in to comment.