Skip to content

fix: generate TypeScript declarations explicitly in build script - #357

Closed
llastflowers with Copilot wants to merge 7 commits into
mainfrom
copilot/fix-ci-lint-workflow
Closed

fix: generate TypeScript declarations explicitly in build script#357
llastflowers with Copilot wants to merge 7 commits into
mainfrom
copilot/fix-ci-lint-workflow

Conversation

Copilot AI commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

rollup-plugin-typescript2 v0.36.0 silently stopped generating .d.ts files when paired with TypeScript 5.9.3, causing publint --strict to fail with missing ./dist/esm/index.d.ts and ./dist/cjs/index.d.cts.

Changes

  • packages/live-region-element/script/build: Replace implicit declaration generation via rollup-plugin-typescript2 with an explicit tsc invocation, then copy and rename for CJS:
# Generate declarations into dist/esm
npx tsc --project tsconfig.build.json --outDir dist/esm

# Copy and rename as .d.cts for CJS consumers
for file in $(find ./dist/esm -maxdepth 1 -name '*.d.ts'); do
  basename=$(basename "$file")
  cp "$file" "./dist/cjs/${basename%.d.ts}.d.cts"
done
Original prompt

Fix the failing GitHub Actions workflow "CI / lint (pull_request)".
Analyze the workflow logs, identify the root cause of the failure, and implement a fix.
Job ID: 68962188992
Job URL: /primer/live-region-element/actions/runs/23670323424/job/68962188992?pr=356


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

dependabot Bot and others added 3 commits March 25, 2026 23:03
Bumps  and [picomatch](https://github.com/micromatch/picomatch). These dependencies needed to be updated together.

Updates `picomatch` from 2.3.1 to 2.3.2
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](micromatch/picomatch@2.3.1...2.3.2)

Updates `picomatch` from 4.0.3 to 4.0.4
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](micromatch/picomatch@2.3.1...2.3.2)

Updates `picomatch` from 4.0.2 to 4.0.4
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](micromatch/picomatch@2.3.1...2.3.2)

---
updated-dependencies:
- dependency-name: picomatch
  dependency-version: 2.3.2
  dependency-type: indirect
- dependency-name: picomatch
  dependency-version: 4.0.4
  dependency-type: indirect
- dependency-name: picomatch
  dependency-version: 4.0.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
@changeset-bot

changeset-bot Bot commented Mar 27, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3212bf6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI and others added 2 commits March 27, 2026 22:43
Agent-Logs-Url: https://github.com/primer/live-region-element/sessions/aaf39dcf-42d3-4ce0-962d-0e8aa60688c8

Co-authored-by: llastflowers <55068883+llastflowers@users.noreply.github.com>
…ix publint CI failure

Agent-Logs-Url: https://github.com/primer/live-region-element/sessions/aaf39dcf-42d3-4ce0-962d-0e8aa60688c8

Co-authored-by: llastflowers <55068883+llastflowers@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions workflow CI lint fix: generate TypeScript declarations explicitly in build script Mar 27, 2026
Copilot AI requested a review from llastflowers March 27, 2026 22:46
Base automatically changed from dependabot/npm_and_yarn/multi-5847bbe98b to main April 2, 2026 09:37
@llastflowers

Copy link
Copy Markdown
Contributor

@copilot Can you fix the formatting issue that is causing CI to fail here?

…prettier check

Agent-Logs-Url: https://github.com/primer/live-region-element/sessions/5a3b65f9-f5f4-4851-b6a3-f51abf30a994

Co-authored-by: llastflowers <55068883+llastflowers@users.noreply.github.com>

Copilot AI commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Can you fix the formatting issue that is causing CI to fail here?

Fixed in 3212bf6 — reverted the accidental change to website/next-env.d.ts that was modifying it to include an import statement from a .next/ build artifact, which caused prettier to flag it.

@llastflowers

Copy link
Copy Markdown
Contributor

@copilot can you review this PR again with consideration to the most recent commit?

Copilot AI commented Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

@copilot can you review this PR again with consideration to the most recent commit?

Here's a review of the PR with all commits included:

Changes:

  1. packages/live-region-element/script/build — Replaces implicit .d.ts generation via rollup-plugin-typescript2 (which silently broke in v0.36.0 + TypeScript 5.9.3) with an explicit npx tsc invocation. Declarations go to dist/esm, then get copied/renamed to dist/cjs as .d.cts for CommonJS consumers.

  2. packages/live-region-element/tsconfig.build.json — Adds "types": ["node"] to exclude the test-only vitest-dom/extend-expect type (from tsconfig.base.json) from production declaration outputs.

  3. website/next-env.d.ts (commit 3212bf6) — Reverts an accidental Next.js build artifact that had been committed and was causing the prettier CI check to fail.

Local verification:

  • npm run build → generates all expected .d.ts and .d.cts files ✅
  • npm run lint:npm (publint --strict) → "All good!" ✅
  • prettier --list-different → exits 0 (no issues) ✅

@llastflowers

Copy link
Copy Markdown
Contributor

closing in favor of #366

@llastflowers
llastflowers deleted the copilot/fix-ci-lint-workflow branch April 8, 2026 19:30
@llastflowers
llastflowers restored the copilot/fix-ci-lint-workflow branch April 8, 2026 19:36
@llastflowers
llastflowers deleted the copilot/fix-ci-lint-workflow branch April 8, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants