Skip to content

Commit

Permalink
Bring oldschooljs/toolkit in as a monorepo (#6211)
Browse files Browse the repository at this point in the history
  • Loading branch information
gc authored Nov 23, 2024
1 parent 2a43aa5 commit 34bec4b
Show file tree
Hide file tree
Showing 543 changed files with 341,707 additions and 13,713 deletions.
1 change: 0 additions & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ CLIENT_ID=111398433321891634
BOT_TOKEN=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
TEST=true
CI=true
YARN_ENABLE_HARDENED_MODE=0
DATABASE_URL="postgresql://postgres:postgres@localhost:4444/osb_test?schema=public"
NODE_NO_WARNINGS=1
2 changes: 1 addition & 1 deletion .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- "docs/**"

jobs:
test:
integration_tests:
runs-on: ubuntu-latest
timeout-minutes: 10
concurrency:
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- "docs/**"

jobs:
test:
unit_tests:
name: Node v${{ matrix.node_version }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 5
Expand All @@ -31,20 +31,18 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
cache: yarn
cache: pnpm
- name: Restore CI Cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies
run: yarn remove zlib-sync && yarn install
key: ${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Copy Configuration
run: |
pushd src &&
cp config.example.ts config.ts &&
popd && cp .env.test .env
- name: Generate Prisma Clients
run: yarn gen
cp .env.test .env
- name: Install Dependencies
run: pnpm install
- name: Build
run: pnpm monorepo:build
- name: Test
run: yarn test:ci:unit
run: pnpm monorepo:test
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/config/private.js
/config/private.json
private.json
src/config.ts
trivia-questions.json
dist/
bwd/
Expand Down Expand Up @@ -47,4 +46,12 @@ tests/**/*.tsbuildinfo
!.yarn/versions
item/

tmp
tmp


robochimp
wiki.xml

.pnpm-store
*.tsbuildinfo
*/coverage
5 changes: 0 additions & 5 deletions .yarnrc.yml

This file was deleted.

3 changes: 1 addition & 2 deletions SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ This assumes you are using VSCode as your IDE. If you have errors or issues, you
- Using **pgAdmin 4** select `Servers > PostgreSQL > Databases > Create > Database...`.
- Enter the database name into `Database` and hit `Save`.
4. Change `DATABASE_URL` and `ROBOCHIMP_DATABASE_URL` in your .env file with the format `postgresql://USER:PASSWORD@HOST:PORT/DATABASE_NAME`.
5. Make a config file from the example: `cp src/config.example.ts src/config.ts`.
6. Edit this new `config.ts` file:
5. Edit `config.ts`:
- Copy your Discord ID into both `OWNER_IDS` and `ADMIN_IDS`.
- Enter the Server ID where you want to Administer your bot from in `SupportServer`.

Expand Down
12 changes: 11 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@
},
"files": {
"maxSize": 10000000,
"ignore": ["node_modules", "dist", "coverage", "profiling", "logs", "icon_cache", ".astro", ".yarn"],
"ignore": [
"node_modules",
"dist",
"coverage",
"profiling",
"logs",
"icon_cache",
".astro",
".yarn",
".pnpm-store"
],
"include": ["**/*.ts", "**/*.mts", "**/*.json", "**/*.test.ts", "**/*.mdx", "**/*.md", "**/*.mjs", "**/*.cjs"]
},
"vcs": {
Expand Down
27 changes: 17 additions & 10 deletions dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,39 @@ RUN apt-get update && apt-get install -y \
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs && \
corepack enable && \
corepack prepare yarn@stable --activate
corepack prepare pnpm@latest --activate

ENTRYPOINT ["dumb-init", "--"]

FROM base AS dependencies
WORKDIR /usr/src/app

COPY package.json yarn.lock .yarnrc.yml ./
COPY src/config.example.ts src/config.ts
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
COPY .env.test .env

RUN yarn install --immutable
RUN pnpm install --frozen-lockfile

FROM base AS build-run
FROM base AS build
WORKDIR /usr/src/app

COPY --from=dependencies /usr/src/app/node_modules /usr/src/app/node_modules
COPY --from=dependencies /usr/src/app/pnpm-lock.yaml /usr/src/app/pnpm-lock.yaml

COPY . .
COPY src/config.example.ts src/config.ts

RUN pnpm install --frozen-lockfile --offline
RUN pnpm run monorepo:build

FROM base AS build-run
WORKDIR /usr/src/app

COPY --from=build /usr/src/app /usr/src/app

ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.9.0/wait /wait
RUN chmod +x /wait
CMD (/wait > /dev/null 2>&1) && \
(yarn prisma db push --schema='./prisma/robochimp.prisma' > /dev/null 2>&1 & \
yarn prisma db push --schema='./prisma/schema.prisma' > /dev/null 2>&1 & \
(pnpm prisma db push --schema='./prisma/robochimp.prisma' > /dev/null 2>&1 & \
pnpm prisma db push --schema='./prisma/schema.prisma' > /dev/null 2>&1 & \
wait) && \
yarn run build:esbuild && \
NODE_NO_WARNINGS=1 yarn vitest run --config vitest.integration.config.mts && \
NODE_NO_WARNINGS=1 pnpm vitest run --config vitest.integration.config.mts && \
exit 0
4 changes: 0 additions & 4 deletions docs/.vscode/extensions.json

This file was deleted.

11 changes: 0 additions & 11 deletions docs/.vscode/launch.json

This file was deleted.

10 changes: 6 additions & 4 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/check": "^0.9.3",
"@astrojs/check": "^0.9.4",
"@astrojs/starlight": "^0.28.2",
"astro": "^4.16.1",
"collapse-white-space": "^2.1.0",
"docs": "link:",
"markdown-it": "^14.1.0",
"sharp": "^0.32.5",
"typescript": "^5.6.2",
"unist-util-visit": "^5.0.0"
"oldschooljs": "workspace:*",
"unist-util-visit": "^5.0.0",
"unist-util-visit-parents": "^6.0.1"
},
"devDependencies": {
"@types/markdown-it": "^14"
Expand Down
Loading

0 comments on commit 34bec4b

Please sign in to comment.