Open
Conversation
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the @grafana/create-plugin scaffold and update-migrations to avoid the TypeScript 6 deprecation warning for compilerOptions.baseUrl, while preserving equivalent module-resolution behavior via a paths catch-all.
Changes:
- Update the common scaffold
.config/tsconfig.jsonto replace deprecatedbaseUrlwithcompilerOptions.paths["*"] = ["../src/*"]. - Add migration
008-remove-tsconfig-baseurlto apply the same change to existing plugins’.config/tsconfig.jsonwhile preserving JSONC comments/formatting viajsonc-parser. - Add unit tests covering the migration’s expected behavior (happy path, idempotency, guards, and merging with existing
pathsentries).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/create-plugin/templates/common/.config/tsconfig.json | Removes baseUrl from the scaffolded tsconfig and adds a paths catch-all to keep TS resolution working without the deprecated option. |
| packages/create-plugin/src/codemods/migrations/scripts/008-remove-tsconfig-baseurl.ts | New migration script to remove baseUrl and inject paths["*"] using JSONC edit operations. |
| packages/create-plugin/src/codemods/migrations/scripts/008-remove-tsconfig-baseurl.test.ts | Tests verifying migration correctness, idempotency, guards, and non-destructive merge with existing paths. |
| packages/create-plugin/src/codemods/migrations/migrations.ts | Registers the new migration with version metadata and script path. |
Member
|
👀 Would now not be the best time to look at encouraging using |
25cd42a to
dd5c24a
Compare
Updates module, moduleResolution, and target inside ts-node compilerOptions in scaffolded plugins' .config/tsconfig.json so they remain compatible with the latest @grafana/tsconfig (TypeScript 5/6).
Update module, moduleResolution, and target to nodenext/nodenext/es2022 so newly scaffolded plugins are compatible with the latest @grafana/tsconfig (TypeScript 5/6).
The grafana/grafana NPM package publishing issue that caused this job to fail has been resolved, so the job can run again. It exercises the create-plugin update command end-to-end on a 5.27.1-scaffolded plugin, validating every registered migration in sequence.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two changes that together get scaffolded plugins ready for TypeScript 6:
baseUrl→paths"baseUrl": "../src"with"paths": { "*": ["../src/*"] }in the scaffold template, so newly-created plugins are clean on TS 6 (baseUrlis deprecated — TS error TS5101).008-remove-tsconfig-baseurlso existing plugins can apply the same fix vianpx @grafana/create-plugin@latest update.pathswithoutbaseUrlis supported in TS 5.0+ withmoduleResolution: bundler, which@grafana/tsconfigalready requires.ts-node
compilerOptionsoverridesmodule/moduleResolution/targetin the ts-node block fromcommonjs/node/es5tonodenext/nodenext/es2022in the scaffold template, so newly-created plugins build under the latest@grafana/tsconfigon Node 22+ / TS 5–6.009-ts-node-nodenextto apply the same fix to existing plugins. Idempotent and only touches keys still at their known-old scaffolded values.CI
test-updatesjob inci.ymlthat was temporarily disabled due to the grafana/grafana NPM publishing issue. It scaffolds a plugin fromcreate-plugin@5.27.1, runsupdate --force, then lint/typecheck/build/test/e2e — exercising both migrations end-to-end.Both migrations use
jsonc-parserto edit in-place, preserving the DO-NOT-EDIT comment header and any user customisations.Fixes: #2613
Test plan
npm run test -w @grafana/create-plugin— 242 tests passnpm run lint -w @grafana/create-plugin— cleannpm run typecheck -w @grafana/create-plugin— cleantest-updatesjob passes end-to-end after force-push🤖 Generated with Claude Code
📦 Published PR as canary version:
Canary Versions✨ Test out this PR locally via:
npm install website@5.6.0-canary.2614.25425808460.0 npm install @grafana/create-plugin@7.4.0-canary.2614.25425808460.0 npm install @grafana/plugin-e2e@3.8.0-canary.2614.25425808460.0 # or yarn add website@5.6.0-canary.2614.25425808460.0 yarn add @grafana/create-plugin@7.4.0-canary.2614.25425808460.0 yarn add @grafana/plugin-e2e@3.8.0-canary.2614.25425808460.0