|
8 | 8 |
|
9 | 9 | ## Workspace shape |
10 | 10 | - The authoritative workspace list is `pnpm-workspace.yaml`; it includes `backend`, `frontend`, `frontend-embed`, `frontend-worker`, `frontend-shared`, `frontend-builder`, `i18n`, `icons-subsetter`, `sw`, `misskey-js`, `misskey-js/generator`, `misskey-reversi`, and `misskey-bubble-game`. |
| 11 | +- Root `package.json` has a stale/incomplete `workspaces` list; do not use it as the source of truth. |
11 | 12 | - `packages/shared` exists but is not a pnpm workspace package. |
12 | | -- Use workspace filters (`pnpm --filter <pkg> ...` / `pnpm -F <pkg> ...`) instead of ad hoc `cd` commands when possible. |
| 13 | +- Use workspace filters (`pnpm --filter <pkg> ...` / `pnpm -F <pkg> ...`) for targeted work; `pnpm -r` is for intentionally running every workspace script. |
13 | 14 |
|
14 | 15 | ## Type4ny fork context |
15 | 16 | - This repo redevelops Type4ny features on top of newer Misskey code; when a Type4ny feature is reported missing, compare against `https://github.com/type4ny-project/type4ny` (or `~/Coding/Type4ny` if that checkout exists locally). |
|
19 | 20 | - Full build: `pnpm build` (`build-pre` -> recursive package builds -> `build-assets`). |
20 | 21 | - Dev server: `pnpm dev`; backend proxies Vite at `/vite` and `/embed_vite`, so Vite-only behavior can differ from production. |
21 | 22 | - Lint all workspaces: `pnpm lint`; root tests: `pnpm test`, but backend tests need services/config below. |
22 | | -- Focused frontend/SDK checks: `pnpm --filter frontend test`, `pnpm --filter misskey-js test`, `pnpm --filter i18n verify`. |
| 23 | +- Focused checks: `pnpm --filter frontend test`, `pnpm --filter frontend typecheck`, `pnpm --filter misskey-js test`, `pnpm --filter i18n verify`. |
23 | 24 | - Backend unit/e2e tests: copy `.github/misskey/test.yml` into `.config/`, start `docker compose -f packages/backend/test/compose.yml up`, then run `pnpm --filter backend test` or `pnpm --filter backend test:e2e`. |
24 | 25 | - Run a single backend test with the path after `--`, e.g. `pnpm --filter backend test -- packages/backend/test/unit/activitypub.ts` or `pnpm --filter backend test:e2e -- packages/backend/test/e2e/nodeinfo.ts`. |
25 | 26 | - Migration checks in CI use `MISSKEY_CONFIG_YML=test.yml pnpm --filter backend migrate` and `MISSKEY_CONFIG_YML=test.yml pnpm --filter backend check-migrations`. |
| 27 | +- Federation tests use `packages/backend/test-federation/`; its README hardcodes `NODE_VERSION=22`, but CI derives the exact version from `.node-version` or `.github/min.node-version`. |
26 | 28 |
|
27 | 29 | ## Generated files and codegen |
28 | | -- Do not hand-edit generated outputs: `built/`, `packages/*/built/`, `packages/frontend-shared/js-built/`, `packages/i18n/src/autogen/locale.ts`, `packages/misskey-js/src/autogen/`, `packages/misskey-js/generator/built/autogen/`, `packages/misskey-js/etc/misskey-js.api.md`, `packages/frontend/storybook-static/`, `cypress/screenshots/`, and `cypress/videos/`. |
| 30 | +- Do not hand-edit generated outputs: `built/`, `packages/*/built/`, `packages/frontend-shared/js-built/`, `packages/i18n/src/autogen/locale.ts`, `packages/misskey-js/src/autogen/`, `packages/misskey-js/generator/built/autogen/`, `packages/misskey-js/etc/misskey-js.api.md`, `packages/frontend/storybook-static/`, `built/cloudflare-worker/assets/`, `cypress/screenshots/`, and `cypress/videos/`. |
29 | 31 | - Backend config is generated by `packages/backend/scripts/compile_config.js` into repo-root `built/.config.json`; backend start/migrate commands run `compile-config` first. |
30 | 32 | - Backend OpenAPI JSON comes from `pnpm --filter backend generate-api-json`; `packages/backend/src/server/api/openapi/OpenApiServerService.ts` serves `/api-doc` and `/api.json`. |
31 | | -- To refresh misskey-js types, use root `pnpm build-misskey-js-with-types`; it builds backend deps, generates `api.json`, copies it into `packages/misskey-js/generator/api.json`, runs autogen, builds SDK, then runs API Extractor. |
32 | | -- Storybook files are generated by `packages/frontend/.storybook/generate.tsx`; after adding/editing/removing `.stories.impl.ts`, `.stories.meta.ts`, or `.stories.msw.ts`, rerun the Storybook prebuild (`pnpm --filter frontend build-storybook-pre`). |
| 33 | +- Misskey-JS types are generated from backend OpenAPI. Never hand-edit `packages/misskey-js/src/autogen/`; use root `pnpm build-misskey-js-with-types` so backend `api.json`, generator output, SDK build, and API Extractor report stay in sync. |
| 34 | +- CI has `check-misskey-js-autogen.yml`; backend API changes that drift from generated SDK types will be rejected until the generated Misskey-JS files are refreshed. |
| 35 | +- Storybook `.stories.ts` files are generated by `packages/frontend/.storybook/generate.tsx`; after adding/editing/removing `.stories.impl.ts`, `.stories.meta.ts`, or `.stories.msw.ts`, rerun `pnpm --filter frontend build-storybook-pre`. |
33 | 36 | - `packages/icons-subsetter/src/generator.ts` scans literal Tabler icon class names; do not build dynamic classes like ``ti-${name}`` without a literal fallback. |
34 | 37 |
|
35 | 38 | ## Architecture gotchas |
36 | 39 | - Backend build uses Rolldown (`packages/backend/rolldown.config.ts`), not plain `tsc`; backend typecheck uses `tsgo` for app, test, and federation configs. |
37 | 40 | - Frontend build uses `packages/frontend/build.ts` around Vite; frontend routing is the custom `nirax` router, and route order matters. |
38 | 41 | - Frontend code must call Misskey API endpoints through `misskeyApi`/`misskeyApiGet` from `@/utility/misskey-api.js`, not ad hoc `window.fetch` calls or manual `apiUrl` wrappers. Use direct fetch only for non-Misskey endpoints such as file upload transports or explicitly documented exceptions. |
39 | 42 | - New Vue components should use Composition API with setup syntax; existing Options API components are legacy. |
40 | | -- The Worker package is a broad frontend/static/SSR layer, not an `/api` proxy. Before `pnpm deploy:cloudflare-worker`, configure the no-worker backend overrides in `packages/frontend-worker/CLOUDFLARE_SINGLE_ORIGIN_ROUTES.md` (`/api/*`, `/streaming*`, auth, ActivityPub, etc.). |
| 43 | +- The Worker package is a broad frontend/static/SSR layer, not an `/api` proxy. Before `pnpm deploy:cloudflare-worker`, configure the no-worker backend overrides in `packages/frontend-worker/CLOUDFLARE_SINGLE_ORIGIN_ROUTES.md` (`/api/*`, `/streaming*`, auth, ActivityPub, `/api.json`, `/api-doc`, etc.). |
41 | 44 | - Worker build/deploy commands are root wrappers: `pnpm build:cloudflare-worker` and `pnpm deploy:cloudflare-worker`; package-local scripts are `pnpm --filter frontend-worker cf:build`, `dev`, `deploy`, and `check`. |
42 | 45 | - Do not edit `en-US.yml`; `.github/copilot-instructions.md` explicitly forbids it. |
43 | 46 |
|
|
0 commit comments