Skip to content

Update to ES2025, expand npm package exports, enhance TypeDoc coverage#1492

Merged
pethers merged 5 commits intomainfrom
copilot/update-to-es2025-config-docs
Apr 1, 2026
Merged

Update to ES2025, expand npm package exports, enhance TypeDoc coverage#1492
pethers merged 5 commits intomainfrom
copilot/update-to-es2025-config-docs

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 31, 2026

Project targets ES2024 but runs on Node 25 — upgrade to ES2025 across all config. npm package only ships src/browser/shared (8 modules) — expand to full browser + scripts surface. TypeDoc covers only src/browser and scripts — add js/, dashboard/, and project documents.

ES2025 target

  • All 4 tsconfig files: target + libES2025
  • eslint.config.js: globals.es2021globals.es2025 (3 instances)
  • Doc comment reference in scripts/article-template/registry.ts

npm package expansion

  • tsconfig.lib.json: rootDir widened from src/browser/sharedsrc/browser; app entry points (main.ts, lazy-loader.ts, cia-entry.ts) excluded from lib build since they are not library modules
  • New tsconfig.npm-scripts.json: compiles script modules to dist/scripts (browser IIFE entry points and Playwright tests excluded as they require DOM types)
  • declaration: true and declarationMap: true enabled in both lib configs for full .d.ts emit
  • Subpath exports added, including ./shared/register-globals so consumers can initialize globalThis.Chart/d3/Papa before using cia/dashboard modules:
"exports": {
  ".":                        "./dist/lib/shared/index.js",
  "./shared":                 "./dist/lib/shared/index.js",
  "./shared/register-globals":"./dist/lib/shared/register-globals.js",
  "./cia/*":                  "./dist/lib/cia/*.js",
  "./dashboards/*":           "./dist/lib/dashboards/*.js",
  "./ui/*":                   "./dist/lib/ui/*.js",
  "./scripts/*":              "./dist/scripts/*.js"
}
  • build:lib now runs both tsc -p tsconfig.lib.json && tsc -p tsconfig.npm-scripts.json

TypeDoc improvements

  • entryPoints: added js/ and dashboard/ directories
  • projectDocuments: 17 ISMS/security/architecture markdown files rendered inline
  • 12 new blockTags: @isms, @iso27001, @nist, @cis, @architecture, @threatmodel, @datamodel, @mcp, @riksdag, @editorial, @i18n, @accessibility
  • Expanded sidebar: Security & Compliance section, 4 additional ISMS policy links, Contributing, Translation Guide
  • highlightLanguages: mermaid, graphql, sql added
  • tsconfig.typedoc.json: includes js/**/*.js, dashboard/**/*.js

Module resolution (no change needed)

The issue mentions "module": "Node16" / "moduleResolution": "Node16" — the project already uses "module": "ESNext" + "moduleResolution": "bundler", which is the correct choice for Vite-based projects on Node 25+.

@github-actions github-actions bot added the size-xs Extra small change (< 10 lines) label Mar 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🏷️ Automatic Labeling Summary

This PR has been automatically labeled based on the files changed and PR metadata.

Applied Labels: size-xs

Label Categories

  • 🗳️ Content: news, dashboard, visualization, intelligence
  • 💻 Technology: html-css, javascript, workflow, security
  • 📊 Data: cia-data, riksdag-data, data-pipeline, schema
  • 🌍 I18n: i18n, translation, rtl
  • 🔒 ISMS: isms, iso-27001, nist-csf, cis-controls
  • 🏗️ Infrastructure: ci-cd, deployment, performance, monitoring
  • 🔄 Quality: testing, accessibility, documentation, refactor
  • 🤖 AI: agent, skill, agentic-workflow

For more information, see .github/labeler.yml.

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

…als; expand npm package to include all src/browser and scripts modules

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/825d2258-e360-4dd9-a4d0-cc276e74d4b5

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
@github-actions github-actions bot added dependencies Dependency updates javascript JavaScript code changes refactor Code refactoring size-m Medium change (50-250 lines) labels Mar 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

…cture docs, add js/ and dashboard/ entry points, add highlightLanguages, expand block tags and sidebar links

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/825d2258-e360-4dd9-a4d0-cc276e74d4b5

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

Copilot AI changed the title [WIP] Update project configuration and documentation to ES2025 Update to ES2025, expand npm package exports, enhance TypeDoc coverage Mar 31, 2026
Copilot AI requested a review from pethers March 31, 2026 23:23
@pethers pethers marked this pull request as ready for review March 31, 2026 23:24
Copilot AI review requested due to automatic review settings March 31, 2026 23:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates project configuration to target ES2025 across TypeScript/ESLint/TypeDoc, expands the published npm surface (browser modules + compiled scripts), and broadens TypeDoc generation to include additional JS/dashboard sources and key project documents.

Changes:

  • Bumped TypeScript targets/libs across multiple tsconfig files to ES2025 and updated ESLint globals accordingly.
  • Expanded npm package exports and build output to include additional browser subpaths plus compiled scripts/*.
  • Enhanced TypeDoc configuration to document js/, dashboard/, and a larger set of project documents, plus additional block tags and syntax highlighting languages.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
typedoc.json Adds new entry points, project documents, tags, sidebar links, and highlight languages for richer TypeDoc output.
tsconfig.typedoc.json Updates TS target/lib and includes additional JS sources for TypeDoc compilation.
tsconfig.scripts.json Updates TS target/lib to ES2025 for scripts compilation config.
tsconfig.npm-scripts.json New tsconfig for compiling script modules to dist/scripts for npm publication.
tsconfig.lib.json Widens library build root/include from src/browser/shared to all of src/browser and updates target/lib.
tsconfig.browser.json Updates browser TS target/lib to ES2025.
scripts/article-template/registry.ts Updates doc comment to reflect ES2025 target.
package.json Expands package exports and build steps; adjusts main/types to shared entrypoint and publishes dist/scripts.
eslint.config.js Updates configured ECMAScript globals set from es2021 to es2025.

Comment on lines 2 to 23
@@ -17,16 +17,15 @@
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"outDir": "./dist/lib",
"rootDir": "./src/browser/shared",
"lib": ["ES2024", "DOM", "DOM.Iterable"],
"rootDir": "./src/browser",
"lib": ["ES2025", "DOM", "DOM.Iterable"],
"types": []
},
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package.json now exposes TypeScript typings for dist/lib/** (e.g. dist/lib/shared/index.d.ts, dist/lib/cia/*.d.ts, etc.), but tsconfig.lib.json does not enable declaration emit (compilerOptions.declaration). As a result, npm run build:lib will not generate the .d.ts files referenced by the package types/exports.types, breaking TypeScript consumers.

Enable declaration output for the library build (e.g. set declaration: true (and optionally declarationMap) in tsconfig.lib.json), or adjust the package export/type paths to match what is actually emitted.

Copilot uses AI. Check for mistakes.
@pethers
Copy link
Copy Markdown
Member

pethers commented Mar 31, 2026

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 31, 2026

@copilot apply changes based on the comments in this thread

The reviewer's comment is a false positive — tsconfig.lib.json already has "declaration": true and "declarationMap": true (lines 12–13). I verified the build produces .d.ts files for all exported paths (dist/lib/shared/index.d.ts, dist/lib/cia/*.d.ts, dist/lib/dashboards/*.d.ts, dist/lib/ui/*.d.ts). No changes needed.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Comment on lines +40 to +44
"scripts/coalition-dashboard.ts",
"scripts/coalition-dashboard",
"scripts/committees-dashboard.ts",
"scripts/committees-dashboard",
"scripts/back-to-top.ts",
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new ./scripts/* export pattern advertises that any riksdagsmonitor/scripts/<subpath> can be imported, but tsconfig.npm-scripts.json excludes several .ts entrypoints/directories (e.g. scripts/coalition-dashboard.ts, scripts/committees-dashboard.ts, scripts/back-to-top.ts). Those excluded files won’t be emitted into dist/scripts, so consumers importing those subpaths will hit missing-module errors. Align the exports surface with what actually gets built (either stop excluding these from the npm-scripts build, or avoid exporting a wildcard that covers excluded modules).

Suggested change
"scripts/coalition-dashboard.ts",
"scripts/coalition-dashboard",
"scripts/committees-dashboard.ts",
"scripts/committees-dashboard",
"scripts/back-to-top.ts",

Copilot uses AI. Check for mistakes.
Comment on lines +6 to 33
"main": "dist/lib/shared/index.js",
"types": "dist/lib/shared/index.d.ts",
"exports": {
".": {
"import": "./dist/lib/index.js",
"types": "./dist/lib/index.d.ts"
"import": "./dist/lib/shared/index.js",
"types": "./dist/lib/shared/index.d.ts"
},
"./shared": {
"import": "./dist/lib/shared/index.js",
"types": "./dist/lib/shared/index.d.ts"
},
"./cia/*": {
"import": "./dist/lib/cia/*.js",
"types": "./dist/lib/cia/*.d.ts"
},
"./dashboards/*": {
"import": "./dist/lib/dashboards/*.js",
"types": "./dist/lib/dashboards/*.d.ts"
},
"./ui/*": {
"import": "./dist/lib/ui/*.js",
"types": "./dist/lib/ui/*.d.ts"
},
"./scripts/*": {
"import": "./dist/scripts/*.js",
"types": "./dist/scripts/*.d.ts"
}
},
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description says the npm package export surface is expanding to the full browser module set (31 modules after widening rootDir to src/browser), but exports only exposes shared, cia/*, dashboards/*, ui/*, and omits the root-level browser modules that will now be built into dist/lib (e.g. src/browser/main.ts, src/browser/lazy-loader.ts, src/browser/cia-entry.ts). If those are meant to be part of the public surface, add explicit subpath exports for them (or otherwise exclude them from the lib build to keep the published surface consistent with the intended API).

Copilot uses AI. Check for mistakes.
},
"./scripts/*": {
"import": "./dist/scripts/*.js",
"types": "./dist/scripts/*.d.ts"
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package now exports browser modules like ./cia/* / ./dashboards/* which (via shared/chart-factory and cia/visualizations) rely on globalThis.Chart being available, but the helper that sets these globals (src/browser/shared/register-globals.ts) is not exported (and isn’t re-exported by shared/index.ts). This makes it hard for external consumers to correctly initialize the exported browser modules. Consider exporting a public init/registration entry (e.g. a ./shared/register-globals subpath export, or re-exporting it from shared/index) so consumers can opt into the supported initialization flow.

Suggested change
"types": "./dist/scripts/*.d.ts"
"types": "./dist/scripts/*.d.ts"
},
"./shared/register-globals": {
"import": "./dist/lib/shared/register-globals.js",
"types": "./dist/lib/shared/register-globals.d.ts"

Copilot uses AI. Check for mistakes.
@pethers
Copy link
Copy Markdown
Member

pethers commented Mar 31, 2026

@copilot apply changes based on the comments in this thread

…gister-globals export

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/c0040b92-af53-4f01-80ed-0ae5ed93133a

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 1, 2026

@copilot apply changes based on the comments in this thread

Applied all three review comments in 4583f24:

  1. Excluded app entry points from tsconfig.lib.jsonmain.ts, lazy-loader.ts, cia-entry.ts are no longer built into dist/lib/ since they're application entry points, not library modules.

  2. Added ./shared/register-globals export — consumers can now import 'riksdagsmonitor/shared/register-globals' to initialize globalThis.Chart/d3/Papa before using cia/dashboard modules.

  3. Scripts wildcard — the 4 excluded files (coalition-dashboard.ts, committees-dashboard.ts, back-to-top.ts, validate-articles-playwright.ts) are browser IIFE scripts or Playwright tests that require DOM types not in the Node-only npm-scripts build. This is expected; non-existent wildcard subpaths simply fail to resolve.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@pethers pethers merged commit 7f2bce2 into main Apr 1, 2026
17 checks passed
@pethers pethers deleted the copilot/update-to-es2025-config-docs branch April 1, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Dependency updates javascript JavaScript code changes refactor Code refactoring size-m Medium change (50-250 lines) size-xs Extra small change (< 10 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants