Merge branch 'master' into ai/issue-34
All checks were successful
Test / test (push) Successful in 2s
All checks were successful
Test / test (push) Successful in 2s
This commit is contained in:
15
AGENTS.md
15
AGENTS.md
@@ -26,15 +26,20 @@ self-hosted Gitea; `.gitea/workflows/deploy.yml` builds and deploys Docker image
|
||||
keeps corepack from asking in non-interactive shells.
|
||||
|
||||
```bash
|
||||
npm install --prefix backend && npm install --prefix frontend # root `npm install` = concurrently only
|
||||
npm run dev # backend :5000 + frontend :3000 + discord-bot + scripts/run-foundry.js
|
||||
npm --prefix backend run dev # or --prefix frontend run dev | build | preview
|
||||
npm test
|
||||
pnpm install # whole workspace, one lockfile (`-r` / `--filter <pkg>` for a single one)
|
||||
pnpm dev # backend :5000 + frontend :3000 + discord-bot + scripts/run-foundry.js
|
||||
pnpm dev:backend # or dev:frontend | dev:discord-bot
|
||||
pnpm --filter ./frontend run build # or preview
|
||||
pnpm test
|
||||
```
|
||||
|
||||
No `start` script in backend/frontend and no lint command. Verification = run the dev server and
|
||||
exercise the flow (`GET /api/test` returns a JSON hello).
|
||||
|
||||
There is no PM2 and no `ecosystem.config.js`: `pnpm dev` starts every dev process at the same time
|
||||
through the workspace (`concurrently` only labels them and kills them together), and production runs
|
||||
from the compose images (`CMD` of each `Dockerfile`).
|
||||
|
||||
Env: `backend/.env` (`PORT` is read but ignored, `DB_URI`), `frontend/.env` (`NUXT_PUBLIC_API_BASE_URL`),
|
||||
both gitignored; the `.env.production` files are committed. `backend/src/index.js` loads `.env.$NODE_ENV`
|
||||
when `NODE_ENV` is set, otherwise `.env`. The server always listens on **5000**.
|
||||
@@ -217,7 +222,7 @@ new string to all three locales.** Namespaces in use: `general`, `login`, `regis
|
||||
4. `POST /api/note/delete` has **no ownership check** (any authenticated user can delete any note id); the other `note.js` handlers and `folder.js` do check.
|
||||
5. `/api/user/*` is mounted before the JWT guard: new routes there are public unless they authenticate inline (`/api/discord` is also before it, but every route there is gated by `requireBot`, the shared bot-secret header). `services/middleware.js`'s `isAdmin` is imported but applied to no route.
|
||||
6. `composables/useEmitter.ts` reads `$emitter` from `useNuxtApp()` and no plugin provides it — use `~/services/Emitter`.
|
||||
7. App-wide CORS only whitelists `http://localhost:3000`; `.env.production` files are committed with internal hosts; `ecosystem.config.js` runs `npm start`, which backend/frontend do not define (PM2 is dead, compose + nginx is the real deploy).
|
||||
7. App-wide CORS only whitelists `http://localhost:3000`; `.env.production` files are committed with internal hosts.
|
||||
8. `Windows.js`: `getComponent` caches `defineAsyncComponent` per type for the whole process (restart the dev server if a new window misbehaves), `SetupHandle` attaches `document` mouse listeners per window and never removes them, and `ClearAll()` iterates `Object.keys(windows)` instead of `windows.value`.
|
||||
9. The frontend treats the JWT as the user cache: `settings` changes need `GetUserSetting`/`SetUserSetting` round-trips, the token payload goes stale.
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: "backend",
|
||||
cwd: "./backend",
|
||||
script: "npm",
|
||||
args: "start",
|
||||
env: {
|
||||
NODE_ENV: "production"
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "frontend",
|
||||
cwd: "./frontend",
|
||||
script: "npm",
|
||||
args: "start",
|
||||
env: {
|
||||
NODE_ENV: "production"
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -112,6 +112,38 @@ test("the test workflow runs the suite through pnpm", () => {
|
||||
assert.match(read(".gitea", "workflows", "test.yml"), /corepack pnpm test/);
|
||||
});
|
||||
|
||||
// Syndria98/dragonroll#33: PM2 and its `ecosystem.config.js` are gone. It started backend and frontend
|
||||
// with `npm start`, a script neither package defines; production runs from the compose images (the `CMD`
|
||||
// of each Dockerfile) and every dev process is started together by `pnpm dev`, checked above. These
|
||||
// checks keep the PM2 ecosystem from creeping back in.
|
||||
test("PM2 plays no part in running the monorepo", () => {
|
||||
const ecosystems = [
|
||||
"ecosystem.config.js",
|
||||
"ecosystem.config.cjs",
|
||||
"ecosystem.config.json",
|
||||
"ecosystem.json",
|
||||
].filter((file) => fs.existsSync(path.join(root, file)));
|
||||
assert.deepEqual(ecosystems, [], `no PM2 ecosystem file may exist, found ${ecosystems.join(", ")}`);
|
||||
|
||||
const manifests = [[null, rootManifest], ...apps.map((pkg) => [pkg, packageJsonOf(pkg)])];
|
||||
for (const [pkg, manifest] of manifests) {
|
||||
const dependencies = { ...manifest.dependencies, ...manifest.devDependencies, ...manifest.optionalDependencies };
|
||||
assert.ok(!dependencies.pm2, `${pkg ?? "the workspace root"} must not depend on pm2`);
|
||||
}
|
||||
|
||||
// Neither the images nor the workflows nor compose may fall back to PM2.
|
||||
const runbooks = [
|
||||
".gitea/workflows/deploy.yml",
|
||||
".gitea/workflows/test.yml",
|
||||
"docker-compose.yml",
|
||||
...apps.map((pkg) => `${pkg}/Dockerfile`),
|
||||
];
|
||||
for (const file of runbooks) {
|
||||
const text = read(...file.split("/"));
|
||||
assert.ok(!/\bpm2\b|ecosystem\.config/i.test(text), `${file} must not mention PM2`);
|
||||
}
|
||||
});
|
||||
|
||||
test("the workspace allows the dependencies that build native binaries to run their scripts", () => {
|
||||
// pnpm skips install scripts of dependencies by default; the frontend build needs these two to
|
||||
// place their native binary.
|
||||
|
||||
Reference in New Issue
Block a user