From 374102e63326e8d50b3376b9410f56d5199e7178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Sun, 19 Apr 2026 07:56:01 +0200 Subject: [PATCH] Make scripts/ a pnpm workspace + add README MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit render-legal.ts needs @types/node available to the TS language server so editors (VS Code, cursor, etc.) don't complain about missing Node globals. Without a tsconfig in this folder VS Code falls back to a default config with no types and shows red squiggles on every process/fs/path reference. Solution: scripts/ becomes its own pnpm workspace (@trails-cool/scripts), carrying @types/node as a devDep from the catalog, and a tiny tsconfig.json with types: [node] and include *.ts. This also wires the folder into `pnpm typecheck` as task #14, so CI type-checks scripts alongside every other package. No runtime impact — the workspace is never bundled or deployed. README documents the layout, current contents (render-legal.ts + check-dockerfiles.sh), and how to add new scripts. Co-Authored-By: Claude Opus 4.7 (1M context) --- pnpm-lock.yaml | 6 ++++++ pnpm-workspace.yaml | 1 + scripts/README.md | 31 +++++++++++++++++++++++++++++++ scripts/package.json | 13 +++++++++++++ scripts/tsconfig.json | 8 ++++++++ 5 files changed, 59 insertions(+) create mode 100644 scripts/README.md create mode 100644 scripts/package.json create mode 100644 scripts/tsconfig.json diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b10a7d0..0d2149f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -654,6 +654,12 @@ importers: packages/ui: {} + scripts: + devDependencies: + '@types/node': + specifier: 'catalog:' + version: 22.19.17 + packages: '@adobe/css-tools@4.4.4': diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 3a860bb..68d71bd 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,6 +1,7 @@ packages: - "apps/*" - "packages/*" + - "scripts" catalog: react: ^19.2.5 diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..525a3ce --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,31 @@ +# scripts + +One-off CLIs for maintenance tasks that don't belong inside any of the +apps or packages. Small enough to live in a single file each. + +This folder is a pnpm workspace (`@trails-cool/scripts`) purely so TypeScript +has a home to resolve `@types/node` from — it isn't published, bundled, or +deployed. Each script is a self-contained `.ts` file run with +`node --experimental-strip-types`. + +## Contents + +| Script | Purpose | +|---|---| +| `render-legal.ts` | Render a legal page (Terms / Privacy / Imprint) from its TSX source to plain markdown for `docs/legal-archive/`. See [`docs/legal-archive/README.md`](../docs/legal-archive/README.md). | +| `check-dockerfiles.sh` | Bash script run in CI to verify every workspace package is COPY'd into each app's Dockerfile. | + +## Adding a script + +1. Drop the file in this folder (`.ts` preferred; shell is fine for + filesystem/docker glue). +2. For TypeScript, `tsconfig.json` already picks up every `*.ts` in this + directory. +3. Run it with `node --experimental-strip-types scripts/.ts `. +4. Document purpose + invocation in the table above. + +## Why not per-package scripts? + +Some things (Dockerfile audits, legal-archive rendering, DB one-offs) don't +belong inside any single workspace. Keeping them here avoids cross-package +dependencies and keeps the app/package roots focused on product code. diff --git a/scripts/package.json b/scripts/package.json new file mode 100644 index 0000000..586b341 --- /dev/null +++ b/scripts/package.json @@ -0,0 +1,13 @@ +{ + "name": "@trails-cool/scripts", + "version": "0.0.1", + "private": true, + "type": "module", + "scripts": { + "typecheck": "tsc --noEmit", + "lint": "eslint ." + }, + "devDependencies": { + "@types/node": "catalog:" + } +} diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json new file mode 100644 index 0000000..fed7cdc --- /dev/null +++ b/scripts/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "types": ["node"], + "noEmit": true + }, + "include": ["*.ts"] +}