-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* mv app to apps/ dir * migrate tooling to support apps/ dir * start script to run migrations * remove build:lib from ci * appease ci * add setup-test script, adjust ci * rm build:lib patch * fix local server build, load dotenv
- Loading branch information
Showing
169 changed files
with
219 additions
and
278 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,6 @@ cypress.env.json | |
notes.md | ||
|
||
/prisma/data | ||
/.svelte-kit | ||
/build | ||
|
||
packages/**/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
node_modules | ||
/build | ||
/.svelte-kit | ||
build | ||
.svelte-kit | ||
/package | ||
.env | ||
.env.* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,49 @@ | ||
#syntax=docker/dockerfile:1.4 | ||
FROM --platform=linux/amd64 alpine as builder | ||
# Download the static build of Litestream directly into the path & make it executable. | ||
# This is done in the builder and copied as the chmod doubles the size. | ||
ADD https://github.com/benbjohnson/litestream/releases/download/v0.3.8/litestream-v0.3.8-linux-amd64-static.tar.gz /tmp/litestream.tar.gz | ||
RUN tar -C /usr/local/bin -xzf /tmp/litestream.tar.gz | ||
ARG NODE_VERSION="18.15.0" | ||
ARG ALPINE_VERSION="3.17" | ||
FROM --platform=linux/amd64 node:${NODE_VERSION}-alpine${ALPINE_VERSION} as base | ||
ENV CI=true | ||
# for turbo - https://turbo.build/repo/docs/handbook/deploying-with-docker#example | ||
RUN apk add --no-cache libc6-compat curl | ||
RUN apk update | ||
WORKDIR /workspace | ||
# enable corepack for pnpm | ||
RUN corepack enable | ||
|
||
FROM --platform=linux/amd64 node:18-alpine | ||
WORKDIR /usr/src | ||
|
||
# @todo - remove this after upgrading prisma to ~4.8.0 | ||
# https://github.com/prisma/prisma/issues/16553#issuecomment-1353302617 | ||
RUN apk add --update --no-cache openssl1.1-compat | ||
|
||
# Copy executable & Litestream from builder. | ||
COPY --from=builder /usr/local/bin/litestream /usr/local/bin/litestream | ||
# Copy litestream config | ||
COPY scripts/litestream.yml /etc/litestream.yml | ||
|
||
# add bash | ||
RUN apk add bash | ||
|
||
# Create data directory (although this will likely be mounted too) | ||
RUN mkdir -p /data | ||
|
||
# Install pnpm | ||
ARG PNPM_VERSION=7.9.5 | ||
RUN npm install --global pnpm@${PNPM_VERSION} | ||
FROM base as fetcher | ||
# pnpm fetch only requires lockfile, but we'll need to build workspaces | ||
COPY pnpm*.yaml ./ | ||
# RUN pnpm fetch | ||
# add project source to build | ||
ADD . . | ||
# install dependencies | ||
RUN pnpm install --frozen-lockfile | ||
# expose arguments for VITE environment variables | ||
ARG VITE_HOST=http://localhost:3000 | ||
ARG VITE_NEXTAUTH_URL=http://localhost:3000 | ||
ARG VITE_DISCORD_GUILD_ID=976838371383083068 | ||
ARG DATABASE_URL="file:/data/sqlite.db" | ||
# expose necessary env vars | ||
ENV PORT=3000 | ||
# run build | ||
RUN pnpm run build:lib && pnpm run build | ||
# install production dependencies | ||
RUN pnpm install --frozen-lockfile --prod --ignore-scripts | ||
COPY patches ./patches | ||
# mount pnpm store as cache & fetch dependencies | ||
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm-store \ | ||
pnpm fetch --ignore-scripts | ||
|
||
FROM fetcher as builder | ||
ARG APP_NAME="@aws-amplify/discord-bot-frontend" | ||
ENV APP_NAME=${APP_NAME} | ||
WORKDIR /workspace | ||
COPY . . | ||
RUN --mount=type=secret,id=env,required=true,target=/workspace/.env \ | ||
pnpm install --frozen-lockfile --offline --loglevel=error | ||
# build workspace | ||
RUN --mount=type=secret,id=env,required=true,target=/workspace/.env \ | ||
--mount=type=cache,target=/workspace/node_modules/.cache \ | ||
pnpm run build | ||
|
||
FROM builder as deployer | ||
WORKDIR /workspace | ||
# deploy app | ||
RUN pnpm --filter ${APP_NAME} deploy --prod --ignore-scripts ./out | ||
|
||
EXPOSE 3000 | ||
CMD ["./scripts/start.sh"] | ||
FROM base as runner | ||
WORKDIR /workspace | ||
# Don't run production as root | ||
RUN addgroup --system --gid 1001 amplifygroup | ||
RUN adduser --system --uid 1001 amplifyuser | ||
USER amplifyuser | ||
# copy files needed to run the app | ||
COPY --chown=amplifyuser:amplifygroup --from=deployer /workspace/out/package.json . | ||
COPY --chown=amplifyuser:amplifygroup --from=deployer /workspace/out/node_modules/ ./node_modules | ||
COPY --chown=amplifyuser:amplifygroup --from=deployer /workspace/out/build/ ./build | ||
# start the app | ||
CMD pnpm run start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.svelte-kit | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{ | ||
"name": "@aws-amplify/discord-bot-frontend", | ||
"version": "1.5.0-next.5", | ||
"type": "module", | ||
"scripts": { | ||
"start": "sh ./scripts/start.sh", | ||
"start-server": "node ./build/index.js", | ||
"dev": "vite", | ||
"build": "pnpm run build-app && pnpm run build-server", | ||
"build-app": "vite build", | ||
"build-server": "node scripts/build-server.cjs", | ||
"test": "playwright test", | ||
"setup-dev": "prisma db push", | ||
"setup-test": "DATABASE_URL=\"file:data/test.db\" prisma db push", | ||
"postinstall": "prisma generate; playwright install", | ||
"preview": "vite preview --port 3000", | ||
"seed": "vite-node ./scripts/seed.ts", | ||
"prepare": "svelte-kit sync" | ||
}, | ||
"dependencies": { | ||
"@auth/core": "^0.15.2", | ||
"@auth/sveltekit": "^0.3.6", | ||
"@aws-crypto/sha256-js": "^2.0.1", | ||
"@carbon/styles": "^1.11.0", | ||
"@discordjs/builders": "^1.1.0", | ||
"@discordjs/rest": "^1.0.1", | ||
"@faker-js/faker": "^7.4.0", | ||
"@next-auth/prisma-adapter": "^1.0.4", | ||
"@octokit/auth-app": "^4.0.5", | ||
"@octokit/graphql": "^5.0.1", | ||
"@octokit/rest": "^19.0.4", | ||
"@prisma/client": "^4.5.0", | ||
"cookie": "^0.5.0", | ||
"discord-api-types": "^0.37.10", | ||
"discord.js": "^14.8.0", | ||
"express": "^4.18.1", | ||
"fast-glob": "^3.2.11", | ||
"prisma": "^4.5.0", | ||
"svelte": "4.2.1", | ||
"uuid": "^8.3.2", | ||
"zod": "^3.19.1" | ||
}, | ||
"devDependencies": { | ||
"@carbon/charts": "^1.5.2", | ||
"@carbon/charts-svelte": "^1.5.2", | ||
"@commitlint/cli": "^17.0.3", | ||
"@commitlint/config-conventional": "^17.0.3", | ||
"@faker-js/faker": "^7.3.0", | ||
"@hey-amplify/scripts": "workspace:*", | ||
"@hey-amplify/support": "workspace:*", | ||
"@hey-amplify/tsconfig": "workspace:*", | ||
"@playwright/test": "^1.37.1", | ||
"@sveltejs/adapter-node": "^1.3.1", | ||
"@sveltejs/kit": "^1.23.0", | ||
"@types/cookie": "^0.5.1", | ||
"@types/express": "^4.17.13", | ||
"@types/node": "^18.7.13", | ||
"@types/prettier": "^2.7.0", | ||
"@types/supertest": "^2.0.12", | ||
"@typescript-eslint/eslint-plugin": "^6.4.1", | ||
"@typescript-eslint/parser": "^6.4.1", | ||
"@vitest/ui": "^0.22.1", | ||
"carbon-components-svelte": "^0.70.1", | ||
"carbon-icons-svelte": "^11.2.0", | ||
"carbon-preprocess-svelte": "^0.9.1", | ||
"d3": "^7.6.1", | ||
"esbuild": "^0.19.2", | ||
"eslint": "^8.48.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-svelte3": "^4.0.0", | ||
"jsdom": "^20.0.0", | ||
"lint-staged": "^13.0.3", | ||
"prettier": "^2.7.1", | ||
"prettier-plugin-svelte": "^2.7.0", | ||
"supertest": "^6.2.4", | ||
"svelte-check": "^3.5.0", | ||
"tasuku": "^2.0.1", | ||
"tslib": "^2.6.2", | ||
"typescript": "^5.2.2", | ||
"vite": "^4.4.9", | ||
"vite-node": "^0.34.3", | ||
"vitest": "^0.22.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
12 changes: 12 additions & 0 deletions
12
scripts/build-server.cjs → ...ord-bot-frontend/scripts/build-server.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ fi | |
echo "Finish existing database prep" | ||
cd - | ||
|
||
pnpm start | ||
pnpm run start-server |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.