Skip to content

Convert all scripts/ to typescript - #233

Open
Maximo-Guk wants to merge 1 commit into
maximo/pr-previewsfrom
maximo/scripts-typescript
Open

Convert all scripts/ to typescript#233
Maximo-Guk wants to merge 1 commit into
maximo/pr-previewsfrom
maximo/scripts-typescript

Conversation

@Maximo-Guk

Copy link
Copy Markdown
Member

Running TypeScript Natively

Rather than having a bunch of untyped scripts, we can go ahead and convert all of them to typescript to align with the rest of the codebase. We don't even need a build step, simply by adding erasableSyntaxOnly to our tsconfig, and using node >= 22.18.0

@github-actions github-actions Bot added configurator Changes to gatekeeper configurator UI kernel Changes to the Workshop kernel delivery Changes to CI or release delivery gatekeeper Changes to a gatekeeper integration labels Aug 17, 2026
@ask-bonk

ask-bonk Bot commented Aug 17, 2026

Copy link
Copy Markdown

preview.ts is not part of this PR, so the stale build-release.mjs comment there is pre-existing and out of scope. Not a finding for this review.

I've thoroughly reviewed the PR. Let me summarize my findings. There are no actionable, blocking issues introduced by this change:

  • All 129 script tests pass under Node 22 native type stripping; types:scripts passes.
  • Only erasable syntax is used (enforced by erasableSyntaxOnly in scripts/tsconfig.json).
  • No orphaned .test.js/.test.mjs files remain that the narrowed test glob would skip.
  • No runtime-breaking .js/.mjs import specifiers of renamed files.
  • The run-dev-server.jsscripts/run-dev-server.ts move correctly recomputes ROOT.
  • The kill-process-tree / run-dev-server pid guard relocation is semantically equivalent.
  • Type dedup (moving wrangler-config shapes into manifest-lib.ts) is a genuine improvement.
  • The contribution-policy.ts dynamic import via actions/github-script@v9 (node24) is correctly reasoned and documented.
  • Docs (AGENTS.md, skills, READMEs) accurately updated.

One non-blocking observation worth raising to the author (not an inline finding, since it's a repo-wide concern rather than a specific defect on a changed line):

The approach depends on Node ≥22.18.0 for native type stripping, but the repo adds no engines field to package.json. CI is pinned to 24.19.0 so CI is safe, but a contributor on older Node will hit opaque failures running pnpm run-local, pnpm dev-server, or pnpm test. Adding "engines": { "node": ">=22.18.0" } would surface a clear error instead. This is optional and doesn't block the change.

LGTM!

github run

@Maximo-Guk
Maximo-Guk force-pushed the maximo/scripts-typescript branch from 51936c5 to 1f70be0 Compare August 17, 2026 03:11
@github-actions

Copy link
Copy Markdown

Preview: maximo-sc-258e62be

https://maximo-sc-258e62be-os-public-router.gadgets-staging.workers.dev

Dashboard · deleted when this PR closes

@ask-bonk

ask-bonk Bot commented Aug 17, 2026

Copy link
Copy Markdown

Pre-existing and unmodified — out of scope.

My review is complete. Let me summarize findings. I verified the substantive claims:

  • types:scripts passes (tsc clean).
  • All 129 script tests pass under Node native type stripping; the golden-manifest contract test passes; the gatekeeper-configurator test passes.
  • hash-lib.ts: the MODULE_TYPE_BY_EXTENSION lookup can now yield undefined, correctly guarded by the existing if (!type) throw (fail-closed semantics preserved).
  • run-dev-server.ts move into scripts/: ROOT correctly recomputed as join(SCRIPTS_DIR, ".."); all ROOT/SCRIPTS_DIR path references consistent.
  • kill-process-tree.ts: ESRCH handling preserved via cast; the watcher-kill pid guard relocation (filter → map returning null) is harmless under Promise.all.
  • dev-server-config.ts, contribution-policy.ts, and the release scripts: only type annotations/doc comments added, no logic drift.
  • Type consolidation (wrangler-config shapes moved into manifest-lib.ts, shared by preview generator) is a genuine dedup.
  • No orphaned .test.js/.test.mjs under the narrowed test glob; all .mjs/.js script references updated across configs, docs, workflow, .gitignore.
  • contribution-policy.ts runs via actions/github-script@v9 (node24), which supports type stripping.
  • The only remaining stale .mjs reference (preview.ts:202) is pre-existing and in a file this PR does not modify — out of scope.

No actionable, blocking issues introduced by this change. This aligns with the prior review's conclusion; I found nothing additional to add as inline findings.

LGTM!

github run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

configurator Changes to gatekeeper configurator UI delivery Changes to CI or release delivery gatekeeper Changes to a gatekeeper integration kernel Changes to the Workshop kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant