mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-06 02:34:21 +00:00
style: format server and shared with prettier
A mechanical prettier --write over server/src, server/tests, server/scripts and shared/src with the workspaces' .prettierrc; nothing but layout and import order changes, and every file keeps the same set of imports. shared is formatted throughout and its format baseline is empty. The server baseline keeps the 35 files that Prettier would grow past their lint:size limit (they need a split first, which is not a formatting change), and the generated entity files stay as their generator writes them.
This commit is contained in:
@@ -25,13 +25,11 @@
|
||||
* node --import tsx scripts/generate-db-types.ts # rewrite src/db/kysely/
|
||||
* node --import tsx scripts/generate-db-types.ts --check # exit 1 when src/db/kysely/ drifted (CI)
|
||||
*/
|
||||
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { migrateTempDb, tempDbPath } from './generate-entities';
|
||||
|
||||
import Database from 'better-sqlite3';
|
||||
|
||||
import { migrateTempDb, tempDbPath } from './generate-entities';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
const SERVER_ROOT = path.join(__dirname, '..');
|
||||
export const KYSELY_DIR = path.join(SERVER_ROOT, 'src/db/kysely');
|
||||
@@ -39,7 +37,8 @@ export const KYSELY_DIR = path.join(SERVER_ROOT, 'src/db/kysely');
|
||||
/** Tables the application never queries: the migrator's own bookkeeping. */
|
||||
const SKIPPED_TABLES: ReadonlySet<string> = new Set(['mikro_orm_migrations']);
|
||||
|
||||
const HEADER = '// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:\n' +
|
||||
const HEADER =
|
||||
'// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:\n' +
|
||||
'// change the migration, then run `npm run gen:db-types`.\n';
|
||||
|
||||
export interface ColumnInfo {
|
||||
@@ -151,7 +150,7 @@ export function renderDb(tables: readonly TableInfo[]): string {
|
||||
const body = tables.map((t) => ` ${propertyKey(t.name)}: ${interfaceName(t.name)};`).join('\n');
|
||||
return (
|
||||
`${HEADER}${imports}\n\n` +
|
||||
'/** Every table of the migrated schema. A repository narrows it: `this.kysely<Pick<DB, \'trips\'>>()`. */\n' +
|
||||
"/** Every table of the migrated schema. A repository narrows it: `this.kysely<Pick<DB, 'trips'>>()`. */\n" +
|
||||
`export interface DB {\n${body}\n}\n`
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user