mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-03-21 18:04:39 -05:00
Remove Bun
This commit is contained in:
parent
8405be6f26
commit
920355bca4
24
.github/workflows/main.yml
vendored
24
.github/workflows/main.yml
vendored
|
|
@ -11,17 +11,25 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: npm-${{ hashFiles('package-lock.json') }}
|
||||
restore-keys: npm-
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile
|
||||
run: npm ci --ignore-scripts
|
||||
|
||||
- name: Formatter/Linter
|
||||
run: bun run biome:check
|
||||
run: npm run biome:check
|
||||
- name: Typecheck
|
||||
run: bun run typecheck
|
||||
- name: Unit tests
|
||||
run: bun run test:unit:all
|
||||
run: npm run typecheck
|
||||
- name: Check translations jsons
|
||||
run: bun run check-translation-jsons:no-write
|
||||
run: npm run check-translation-jsons:no-write
|
||||
|
|
|
|||
16
.github/workflows/translation-progress.yml
vendored
16
.github/workflows/translation-progress.yml
vendored
|
|
@ -13,16 +13,24 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: npm-${{ hashFiles('package-lock.json') }}
|
||||
restore-keys: npm-
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile
|
||||
run: npm ci --ignore-scripts
|
||||
|
||||
- name: Update translation progress issue
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
bun run check-translation-jsons
|
||||
npm run check-translation-jsons
|
||||
gh issue edit 1104 --body-file ./translation-progress.md
|
||||
|
|
|
|||
15
README.md
15
README.md
|
|
@ -42,7 +42,7 @@ Competitive Splatoon Platform
|
|||
- Sqlite3
|
||||
- CSS (plain)
|
||||
- E2E tests via Playwright
|
||||
- Unit/integration tests via bun:test
|
||||
- Unit/integration tests via Vitest
|
||||
|
||||
## Screenshots
|
||||
|
||||
|
|
@ -61,12 +61,11 @@ Prerequisites: [nvm](https://github.com/nvm-sh/nvm)
|
|||
There is a sequence of commands you need to run:
|
||||
|
||||
1. `nvm use` to switch to the correct Node version. If you don't have the correct Node.js version yet it will prompt you to install it via the `nvm install` command. If you have problems with nvm you can also install the latest LTS version of Node.js from [their website](https://nodejs.org/en/).
|
||||
2. Install latest version of [Bun](https://bun.sh/docs/installation)
|
||||
3. `bun install` to install the dependencies.
|
||||
4. Make a copy of `.env.example` that's called `.env`. Filling additional values is not necessary unless you want to use real Discord authentication or develop the Lohi bot.
|
||||
5. `bun migrate up` to set up the database tables.
|
||||
6. `bun run dev` to run the project in development mode.
|
||||
7. Navigate to `http://localhost:5173/admin`. There press the seed button to fill the DB with test data. You can also impersonate any user (Sendou#0043 = admin).
|
||||
1. `npm install` to install the dependencies.
|
||||
1. Make a copy of `.env.example` that's called `.env`. Filling additional values is not necessary unless you want to use real Discord authentication or develop the Lohi bot.
|
||||
1. `npm run migrate up` to set up the database tables.
|
||||
1. `npm run dev` to run the project in development mode.
|
||||
1. Navigate to `http://localhost:5173/admin`. There press the seed button to fill the DB with test data. You can also impersonate any user (Sendou#0043 = admin).
|
||||
|
||||
## Contributing
|
||||
|
||||
|
|
@ -241,7 +240,7 @@ Note: This is only useful if you have access to a production running on Render.c
|
|||
If you change any files and the CI pipeline errors out on certain formatting/linting steps (Biome) run this command in the repo's root directory:
|
||||
|
||||
```sh
|
||||
bun cf:noe2e
|
||||
npm run checks
|
||||
```
|
||||
|
||||
Before committing, if for some reason you see an abnormally high amount of files changed, simply run `git add --renormalize .` and it will fix the error.
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
[test]
|
||||
preload = ["./scripts/test-preload"]
|
||||
1934
package-lock.json
generated
1934
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
25
package.json
25
package.json
|
|
@ -5,24 +5,23 @@
|
|||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"deploy": "bun install --frozen-lockfile && bun run build",
|
||||
"deploy": "npm ci && npm run build",
|
||||
"build": "remix vite:build",
|
||||
"dev": "remix vite:dev --host",
|
||||
"dev:prod": "DB_PATH=db-prod.sqlite3 bun run dev",
|
||||
"dev:ci": "cp .env.example .env && bun run migrate up && bun run dev",
|
||||
"dev:prod": "DB_PATH=db-prod.sqlite3 npm run dev",
|
||||
"dev:ci": "cp .env.example .env && npm run migrate up && npm run dev",
|
||||
"start": "npm run migrate up && remix-serve ./build/server/index.js",
|
||||
"migrate": "ley",
|
||||
"migrate:reset": "bun scripts/delete-db-files.mjs && bun run migrate up",
|
||||
"check-translation-jsons": "bun scripts/check-translation-jsons.ts",
|
||||
"check-translation-jsons:no-write": "bun scripts/check-translation-jsons.ts --no-write",
|
||||
"refresh-prod-db": "bun scripts/refresh-prod-db.ts && DB_PATH=db-prod.sqlite3 bun migrate up",
|
||||
"biome:check": "bunx @biomejs/biome check .",
|
||||
"biome:fix": "bunx @biomejs/biome check --write .",
|
||||
"biome:fix:unsafe": "bunx @biomejs/biome check --write --unsafe .",
|
||||
"check-translation-jsons": "tsm scripts/check-translation-jsons.ts",
|
||||
"check-translation-jsons:no-write": "tsm scripts/check-translation-jsons.ts --no-write",
|
||||
"refresh-prod-db": "tsm scripts/refresh-prod-db.ts && cross-env DB_PATH=db-prod.sqlite3 npm run migrate up",
|
||||
"biome:check": "npx @biomejs/biome check .",
|
||||
"biome:fix": "npx @biomejs/biome check --write .",
|
||||
"biome:fix:unsafe": "npx @biomejs/biome check --write --unsafe .",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"test:unit": "vitest run",
|
||||
"test:e2e": "bunx playwright test",
|
||||
"cf": "npm run biome:fix && npm run test:unit && npm run check-translation-jsons && npm run typecheck"
|
||||
"test:e2e": "npx playwright test",
|
||||
"checks": "npm run biome:fix && npm run test:unit && npm run check-translation-jsons && npm run typecheck"
|
||||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.645.0",
|
||||
|
|
@ -89,7 +88,6 @@
|
|||
"@playwright/test": "^1.47.1",
|
||||
"@remix-run/dev": "^2.11.2",
|
||||
"@types/better-sqlite3": "^7.6.11",
|
||||
"@types/bun": "^1.1.8",
|
||||
"@types/node-cron": "^3.0.11",
|
||||
"@types/nprogress": "^0.2.3",
|
||||
"@types/react": "^18.3.5",
|
||||
|
|
@ -97,6 +95,7 @@
|
|||
"@types/react-responsive-masonry": "^2.1.3",
|
||||
"ley": "^0.8.1",
|
||||
"sql-formatter": "^15.4.2",
|
||||
"tsm": "^2.3.0",
|
||||
"typescript": "^5.5.4",
|
||||
"vite": "^5.4.3",
|
||||
"vite-tsconfig-paths": "^5.0.1",
|
||||
|
|
|
|||
|
|
@ -1,78 +0,0 @@
|
|||
import { Glob, pathToFileURL } from "bun";
|
||||
import camelCase from "just-camel-case";
|
||||
import { capitalize } from "~/utils/strings";
|
||||
|
||||
const glob = new Glob("locales/*/*.json");
|
||||
|
||||
const targetPath = pathToFileURL("./app/modules/i18n/resources.server.ts");
|
||||
|
||||
function main() {
|
||||
const record: Record<string, string[]> = {};
|
||||
const lines: string[] = [
|
||||
"// This file is generated by scripts/generate-resources-file.ts",
|
||||
"\n",
|
||||
];
|
||||
|
||||
for (const file of glob.scanSync(".")) {
|
||||
const [, lang, namespace] = file.replace(".json", "").split("/");
|
||||
|
||||
if (!record[lang]) {
|
||||
record[lang] = [];
|
||||
}
|
||||
|
||||
record[lang].push(namespace);
|
||||
}
|
||||
|
||||
lines.push(...imports(record));
|
||||
lines.push("\n");
|
||||
lines.push("export const resources = {", ...resourcesObject(record), "};");
|
||||
lines.push("\n");
|
||||
lines.push("export type Namespace = keyof typeof resources.en;");
|
||||
|
||||
Bun.write(targetPath, lines.join("\n"));
|
||||
}
|
||||
|
||||
function imports(record: Record<string, string[]>) {
|
||||
const lines: string[] = [];
|
||||
|
||||
for (const lang in record) {
|
||||
const namespaces = record[lang];
|
||||
const imports = namespaces.map(
|
||||
(namespace) =>
|
||||
`import ${namespaceLangToLocalVar(lang, namespace)} from "../../../locales/${lang}/${namespace}.json";`,
|
||||
);
|
||||
|
||||
lines.push(...imports);
|
||||
}
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
function namespaceLangToLocalVar(lang: string, namespace: string) {
|
||||
const base = camelCase(namespace);
|
||||
|
||||
if (lang === "en") return base;
|
||||
|
||||
return `${base}${capitalize(camelCase(lang))}`;
|
||||
}
|
||||
|
||||
function resourcesObject(record: Record<string, string[]>) {
|
||||
const lines: string[] = [];
|
||||
|
||||
for (const lang in record) {
|
||||
const namespaces = record[lang];
|
||||
|
||||
lines.push(
|
||||
` "${lang}": {`,
|
||||
...namespaces.map(
|
||||
(namespace) =>
|
||||
`${namespace.includes("-") ? `"${namespace}"` : namespace}: ${namespaceLangToLocalVar(lang, namespace)},`,
|
||||
),
|
||||
" },",
|
||||
);
|
||||
}
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
main();
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
const testDb = Bun.file("db-test.sqlite3");
|
||||
await Bun.write("db-test-active.sqlite3", testDb);
|
||||
|
||||
export type {};
|
||||
Loading…
Reference in New Issue
Block a user