Stephansama/ste 190 add badge action to auto readme for auto generating package#280
Conversation
🦋 Changeset detectedLatest commit: b6f0a14 The changes in this PR will be included in the next version bump. This PR includes changesets to release 25 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis pull request introduces badge generation support to ChangesBadge Generation Feature
Dependencies & Configuration
Documentation & README Updates
Release Metadata
🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly Related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces a new BADGE action to the auto-readme utility, enabling the automatic generation of dependency badges in README files. The implementation includes new modules for color contrast calculation, icon mapping using simple-icons, and support for resolving versions from workspace catalogs. Review feedback highlights several areas for improvement: addressing a potential crash in the badge zone logic due to strict comment parsing, removing a debug console.log, and fixing broken badge URLs by correctly escaping special characters for Shields.io. Suggestions were also provided to use more idiomatic TypeScript for icon lookups, implement safer JSON parsing for package files, and refine the markdown output formatting.
|
|
||
| const rootJsonPath = path.join(rootDir, "package.json"); | ||
| const rootJsonFile = await fs.promises.readFile(rootJsonPath, "utf8"); | ||
| const rootPackageJson = JSON.parse(rootJsonFile) as BunWorkspace; |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
@stephansama/ai-commit-msg
@stephansama/alfred-kaomoji
@stephansama/astro-iconify-svgmap
@stephansama/auto-readme
@stephansama/catppuccin-jsonresume-theme
@stephansama/catppuccin-opml
@stephansama/catppuccin-rss
@stephansama/catppuccin-typedoc
@stephansama/catppuccin-xsl
@stephansama/eslint-config
create-stephansama-example
@stephansama/find-makefile-targets
@stephansama/github-env
@stephansama/multipublish
@stephansama/pnpm-hooks
@stephansama/prettier-plugin-handlebars
@stephansama/remark-asciinema
@stephansama/single-file
@stephansama/svelte-social-share-links
@stephansama/typed-env
@stephansama/typed-events
@stephansama/typed-nocodb-api
@stephansama/typed-templates
@stephansama/types-github-action-env
@stephansama/types-lhci
commit: |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@core/auto-readme/src/data.ts`:
- Line 61: Remove the noisy stdout debug logging by deleting the
console.log(catalogs) call in data.ts (the code path that runs while loading
BADGE/PKG actions and handling the catalogs variable); instead, if you need
retained visibility for debugging, replace it with a proper logger at
debug/trace level (using the existing logger instance) or guard it behind a
verbose/debug flag so CLI output remains clean. Ensure no other direct console.*
calls remain in the action-loading logic.
In `@core/auto-readme/src/plugin.ts`:
- Around line 105-112: The badge URL breaks with special characters because
badgeKey only replaces the first underscore and the version (from
resolveVersion) and other segments are not URL-escaped; update the badge
construction so badgeKey uses replaceAll for both "-" and "_" (e.g., badgeKey =
key.replaceAll("-", "--").replaceAll("_", "__")) and then URL-encode all
interpolated segments when building imageUrl (encode the resolved version from
resolveVersion(...), badgeKey, slug, contrastText and color/labelColor) so
scoped package names, slashes and other special chars are safely escaped before
forming imageUrl.
In `@core/prettier-plugin-handlebars/README.md`:
- Around line 40-41: The README usage example imports the built artifact with a
relative path; update the import to use the package name instead (replace the
"../dist/index.mjs" import in the example with the published package import,
e.g., import prettierPluginHandlebars from "prettier-plugin-handlebars") so
consumers import from the package rather than a local build artifact.
In `@core/remark-asciinema/README.md`:
- Around line 58-61: The README usage example is importing the built artifact
via a relative path; update the import statement that currently reads import
asciinema from "../dist/index.mjs" to import asciinema from "remark-asciinema"
(i.e., the package name) so consumers import the published package rather than
an internal build artifact.
- Around line 74-77: Update the pinned asciinema-player version in the README
where it references asciinema-player@3.9.0 (the two UNPKG URLs for
asciinema-player.css and asciinema-player.min.js); replace the version with
`@3.15.1` or with the looser `@3` tag so the links become either
asciinema-player@3.15.1/... or asciinema-player@3/... to ensure the docs point
to the latest/minor-compatible release.
In `@core/types-github-action-env/README.md`:
- Around line 5-8: Remove the empty HTML BADGE comment block in README.md (the
"<!-- BADGE start -->" / "<!-- BADGE end -->" lines) to eliminate the
unnecessary blank lines in the header; if badges are needed later, replace this
empty block with the actual badge markdown instead of leaving an empty comment
block.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 3f3f1296-b150-472d-9c93-b928bcbfe658
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (30)
.config/.cspell.json.config/www/README.mdREADME.mdcore/ai-commit-msg/README.mdcore/astro-iconify-svgmap/README.mdcore/auto-readme/README.mdcore/auto-readme/__snapshots__/tsnapi/schema.snapshot.d.tscore/auto-readme/__snapshots__/tsnapi/schema.snapshot.jscore/auto-readme/package.jsoncore/auto-readme/src/color.tscore/auto-readme/src/data.tscore/auto-readme/src/icon.tscore/auto-readme/src/plugin.tscore/auto-readme/src/schema.tscore/auto-readme/src/utilities.tscore/catppuccin-xsl/README.mdcore/eslint-config/README.mdcore/example/README.mdcore/prettier-plugin-handlebars/README.mdcore/remark-asciinema/README.mdcore/single-file/README.mdcore/svelte-social-share-links/README.mdcore/typed-env/README.mdcore/typed-events/README.mdcore/typed-nocodb-api/README.mdcore/typed-templates/README.mdcore/typed-templates/src/map.tscore/types-github-action-env/README.mdcore/types-lhci/README.mdpnpm-workspace.yaml
| **Note**: After integrating the Remark plugin, ensure you include the necessary asciinema JavaScript and CSS files to enable proper playback and styling. You can load them via [UNPKG](https://unpkg.com/): | ||
|
|
||
| - <https://unpkg.com/asciinema-player@3.9.0/dist/bundle/asciinema-player.css> | ||
| - <https://unpkg.com/asciinema-player@3.9.0/dist/bundle/asciinema-player.min.js> |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial | 💤 Low value
🧩 Analysis chain
🌐 Web query:
What is the latest version of asciinema-player?
💡 Result:
The latest version of asciinema-player is v3.15.1, which was released on February 27, 2026 [1].
Citations:
Update asciinema-player version to the latest release.
The documentation pins asciinema-player to version 3.9.0, but the latest version is v3.15.1 (released February 27, 2026). Update the UNPKG URLs to use @3.15.1 or consider using @3 to automatically receive patch and minor updates:
https://unpkg.com/asciinema-player@3.15.1/dist/bundle/asciinema-player.csshttps://unpkg.com/asciinema-player@3.15.1/dist/bundle/asciinema-player.min.js
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@core/remark-asciinema/README.md` around lines 74 - 77, Update the pinned
asciinema-player version in the README where it references
asciinema-player@3.9.0 (the two UNPKG URLs for asciinema-player.css and
asciinema-player.min.js); replace the version with `@3.15.1` or with the looser `@3`
tag so the links become either asciinema-player@3.15.1/... or
asciinema-player@3/... to ensure the docs point to the latest/minor-compatible
release.
There was a problem hiding this comment.
Actionable comments posted: 7
♻️ Duplicate comments (1)
core/prettier-plugin-handlebars/README.md (1)
23-23:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winFix heading-level jump to satisfy markdownlint.
#####skips levels after the H1 title and triggers MD001. Use##(or###) here.Suggested fix
-##### Table of contents +## Table of contents🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@core/prettier-plugin-handlebars/README.md` at line 23, The heading "##### Table of contents" jumps levels after the H1 and triggers markdownlint MD001; fix it by changing that heading to a lower-level heading (e.g., replace "##### Table of contents" with "## Table of contents" or "### Table of contents") so it follows the H1 properly, then save the README.md and re-run markdownlint to confirm the warning is resolved.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.config/autoreadmerc.json:
- Line 8: The "url" template is producing double slashes because the placeholder
unscoped_name can include a leading slash; update the template so unscoped_name
is normalized before interpolation (strip any leading slashes or whitespace) to
avoid core//<package> paths. Locate the "url" entry and replace the raw
"{{unscoped_name}}" usage with a normalized variant (use the template engine's
trim/replace helper or a small pre-processing step that applies something like
removeLeadingSlashes/unscoped_name.replace(/^\/+/, '')), ensuring the final
string becomes
"https://github.com/stephansama/packages/tree/main/core/{{normalized_unscoped_name}}".
In `@core/ai-commit-msg/README.md`:
- Around line 5-22: Remove the duplicated legacy badge list so only the
generated badge block remains: keep the entire generated badges between the <!--
BADGE start --> and <!-- BADGE end --> markers and delete the older static badge
list that appears elsewhere in the README (the secondary badge list following
the generated block) to avoid rendering badges twice.
In `@core/astro-iconify-svgmap/README.md`:
- Line 7: Update the badge URL in README.md to remove the duplicated slash in
the repository path: replace the string "core//astro-iconify-svgmap" with
"core/astro-iconify-svgmap" in the Markdown badge link so the Source badge
points to the normalized GitHub path.
In `@core/auto-readme/README.md`:
- Line 7: The badge URL generation in the auto-readme template is creating a
double slash before the package name; fix the template logic (e.g., in the badge
template used by generateReadme / renderBadge or the template file that builds
the GitHub badge URL) so path segments are joined without introducing an extra
"/"—either trim any leading "/" from the package name variable (e.g.,
packageName) or use a safe join function when interpolating into the URL (ensure
the template that emits
"https://github.com/stephansama/packages/tree/main/core/{{packageName}}" never
results in "core//..."). Ensure the change is made in the central
template/function that generates badges so all README files regenerate
correctly.
In `@core/catppuccin-jsonresume-theme/README.md`:
- Line 7: The badge link in README.md contains a double slash in the repository
path ("core//catppuccin-jsonresume-theme"); update the markdown link target so
the path is normalized to a single slash ("core/catppuccin-jsonresume-theme") in
the badge URL (the line starting with []) to ensure the generated link is
correct.
In `@core/example/README.md`:
- Line 7: The README badge currently links to the wrong repository directory;
update the markdown link target in the badge line (the line that starts with
[](...) ) to point to the actual directory for this README
(change the URL from .../tree/main/core/create-stephansama-example to
.../tree/main/core/example), preserving the badge image URL and label text.
In `@core/typed-events/README.md`:
- Line 7: The README badge URL contains a malformed path with a double slash
("core//typed-events"); update the badge link in README.md by normalizing the
path to a single slash ("core/typed-events") so the href and image reference use
"https://github.com/stephansama/packages/tree/main/core/typed-events".
---
Duplicate comments:
In `@core/prettier-plugin-handlebars/README.md`:
- Line 23: The heading "##### Table of contents" jumps levels after the H1 and
triggers markdownlint MD001; fix it by changing that heading to a lower-level
heading (e.g., replace "##### Table of contents" with "## Table of contents" or
"### Table of contents") so it follows the H1 properly, then save the README.md
and re-run markdownlint to confirm the warning is resolved.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 17304010-a668-4edb-99e8-479e0f3d346a
📒 Files selected for processing (33)
.config/autoreadmerc.jsonREADME.mdcore/ai-commit-msg/README.mdcore/alfred-kaomoji/README.mdcore/astro-iconify-svgmap/README.mdcore/auto-readme/README.mdcore/auto-readme/__snapshots__/tsnapi/schema.snapshot.d.tscore/auto-readme/src/data.tscore/auto-readme/src/icon.tscore/auto-readme/src/plugin.tscore/auto-readme/src/schema.tscore/catppuccin-jsonresume-theme/README.mdcore/catppuccin-opml/README.mdcore/catppuccin-rss/README.mdcore/catppuccin-typedoc/README.mdcore/catppuccin-xsl/README.mdcore/eslint-config/README.mdcore/eslint-config/example/remark-usage-example-f53juete64xnd32naai-5.jscore/example/README.mdcore/find-makefile-targets/README.mdcore/github-env/README.mdcore/multipublish/README.mdcore/pnpm-hooks/README.mdcore/prettier-plugin-handlebars/README.mdcore/remark-asciinema/README.mdcore/single-file/README.mdcore/svelte-social-share-links/README.mdcore/typed-env/README.mdcore/typed-events/README.mdcore/typed-nocodb-api/README.mdcore/typed-templates/README.mdcore/types-github-action-env/README.mdcore/types-lhci/README.md
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (2)
core/remark-asciinema/README.md (1)
76-77:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winUpdate pinned
asciinema-playerCDN version in docs.These links are pinned to
3.9.0; this is likely stale and should be bumped (or switched to@3) to avoid documenting outdated assets.What is the latest stable release of `asciinema-player`, and what are the recommended UNPKG URLs for its CSS and JS bundle?🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@core/remark-asciinema/README.md` around lines 76 - 77, Replace the pinned asciinema-player@3.9.0 CDN links in README.md (the two lines containing "asciinema-player@3.9.0/dist/bundle/asciinema-player.css" and "asciinema-player@3.9.0/dist/bundle/asciinema-player.min.js") with either a non-pinned major tag to stay current (use `@3`) or with the project's latest stable release; the recommended UNPKG URL patterns are: https://unpkg.com/asciinema-player@3/dist/bundle/asciinema-player.css and https://unpkg.com/asciinema-player@3/dist/bundle/asciinema-player.min.js (or replace `@3` with the explicit latest version string if you prefer a pinned release).core/auto-readme/src/plugin.ts (1)
131-142:⚠️ Potential issue | 🟠 Major | ⚡ Quick winEscape badge URL path/query parts before interpolation.
Line 135 builds Shields URL parts from raw values. Scoped names (
@scope/pkg) and special characters in resolved versions can break the badge URL and render invalid badges. This is the same root issue previously raised and is still present.Suggested fix
const contrastText = getContrastText(color); - const linkUrl = `https://npmx.dev/package/${key}`; - const badgeKey = key - .replaceAll("-", "--") - .replaceAll("_", "__"); - const imageUrl = `https://img.shields.io/badge/${badgeKey}-${resolveVersion( + const linkUrl = `https://npmx.dev/package/${encodeURIComponent(key)}`; + const escapeBadgePart = (value: string) => + encodeURIComponent(value) + .replaceAll("-", "--") + .replaceAll("_", "__"); + const badgeKey = escapeBadgePart(key); + const badgeVersion = escapeBadgePart( + resolveVersion( { catalogs: first?.catalogs, name: key, version, }, - )}-${color}.svg?logo=${slug}&logoColor=${contrastText}&labelColor=${color}`; + ), + ); + const imageUrl = `https://img.shields.io/badge/${badgeKey}-${badgeVersion}-${encodeURIComponent(color)}.svg?logo=${encodeURIComponent(slug)}&logoColor=${encodeURIComponent(contrastText)}&labelColor=${encodeURIComponent(color)}`; packageBadges.push(md`[](${linkUrl})`); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@core/auto-readme/src/plugin.ts` around lines 131 - 142, The Shields badge URL is built from raw values and can break for scoped package names and special characters; update the construction around badgeKey, imageUrl and linkUrl (where packageBadges is pushed and resolveVersion is used) to URL-encode path and query parts before interpolation: ensure you encode the package name/key (including scoped names), the resolved version from resolveVersion, and any query values like slug, contrastText and color using a safe encoder (e.g., encodeURIComponent) appropriate for path vs query segments, then build imageUrl and linkUrl from those encoded pieces so badges render reliably.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@core/prettier-plugin-handlebars/README.md`:
- Line 23: The "Table of contents" heading currently uses an h5 marker ("#####
Table of contents") which can violate markdown heading-order lint rules; update
that heading to a higher-level marker such as "## Table of contents" (or "###
Table of contents") so the heading level is normalized and consistent with
surrounding headings in README.md.
In `@core/typed-env/package.json`:
- Around line 23-26: The package root currently only exports a JS entry
(exports: { ".": "./dist/index.mjs", ... }) but lacks an explicit TypeScript
declaration mapping; update package.json to add a top-level "types" field
pointing to the generated declaration (e.g., "./dist/index.d.ts") and ensure the
root exports (the "." key) conceptually aligns with that types entry so
consumers and TS resolvers can locate declarations produced by dts: true.
---
Duplicate comments:
In `@core/auto-readme/src/plugin.ts`:
- Around line 131-142: The Shields badge URL is built from raw values and can
break for scoped package names and special characters; update the construction
around badgeKey, imageUrl and linkUrl (where packageBadges is pushed and
resolveVersion is used) to URL-encode path and query parts before interpolation:
ensure you encode the package name/key (including scoped names), the resolved
version from resolveVersion, and any query values like slug, contrastText and
color using a safe encoder (e.g., encodeURIComponent) appropriate for path vs
query segments, then build imageUrl and linkUrl from those encoded pieces so
badges render reliably.
In `@core/remark-asciinema/README.md`:
- Around line 76-77: Replace the pinned asciinema-player@3.9.0 CDN links in
README.md (the two lines containing
"asciinema-player@3.9.0/dist/bundle/asciinema-player.css" and
"asciinema-player@3.9.0/dist/bundle/asciinema-player.min.js") with either a
non-pinned major tag to stay current (use `@3`) or with the project's latest
stable release; the recommended UNPKG URL patterns are:
https://unpkg.com/asciinema-player@3/dist/bundle/asciinema-player.css and
https://unpkg.com/asciinema-player@3/dist/bundle/asciinema-player.min.js (or
replace `@3` with the explicit latest version string if you prefer a pinned
release).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4304d19e-ce58-41ca-b432-9b123e7c6530
📒 Files selected for processing (36)
.changeset/hip-lemons-join.mdcore/ai-commit-msg/README.mdcore/alfred-kaomoji/README.mdcore/astro-iconify-svgmap/README.mdcore/auto-readme/README.mdcore/auto-readme/src/icon.test.tscore/auto-readme/src/icon.tscore/auto-readme/src/pipeline.test.tscore/auto-readme/src/plugin.test.tscore/auto-readme/src/plugin.tscore/catppuccin-jsonresume-theme/README.mdcore/catppuccin-opml/README.mdcore/catppuccin-rss/README.mdcore/catppuccin-typedoc/README.mdcore/catppuccin-xsl/README.mdcore/eslint-config/README.mdcore/find-makefile-targets/README.mdcore/github-env/README.mdcore/multipublish/README.mdcore/pnpm-hooks/README.mdcore/prettier-plugin-handlebars/README.mdcore/prettier-plugin-handlebars/example/index.jscore/remark-asciinema/README.mdcore/remark-asciinema/example/index.jscore/single-file/README.mdcore/svelte-social-share-links/README.mdcore/typed-env/README.mdcore/typed-env/__snapshots__/tsnapi/index.snapshot.d.tscore/typed-env/__snapshots__/tsnapi/index.snapshot.jscore/typed-env/package.jsoncore/typed-env/tsdown.config.tscore/typed-events/README.mdcore/typed-nocodb-api/README.mdcore/typed-templates/README.mdcore/types-github-action-env/README.mdcore/types-lhci/README.md
| "exports": { | ||
| ".": { | ||
| "import": "./dist/index.mjs", | ||
| "require": "./dist/index.cjs" | ||
| }, | ||
| ".": "./dist/index.mjs", | ||
| "./package.json": "./package.json" | ||
| }, |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify current manifest entrypoints and presence of declaration artifacts.
jq '{exports, types, main, module}' core/typed-env/package.json
fd -HI --glob 'index.d.ts' core/typed-env
fd -HI --glob 'index.d.mts' core/typed-envRepository: stephansama/packages
Length of output: 252
🏁 Script executed:
#!/bin/bash
# Verify current manifest entrypoints and presence of declaration artifacts
cat core/typed-env/package.json | jq '.exports, .types, .main, .module'
echo "---"
echo "Looking for declaration files in core/typed-env/dist/:"
find core/typed-env/dist -name "*.d.ts" -o -name "*.d.mts" 2>/dev/null || echo "No dist directory or no .d.ts/.d.mts files found"
echo "---"
echo "Full package.json content:"
cat core/typed-env/package.jsonRepository: stephansama/packages
Length of output: 1754
🏁 Script executed:
#!/bin/bash
# Check tsdown configuration
echo "=== Looking for tsdown config ==="
find core/typed-env -maxdepth 2 -name "tsdown*" -o -name "tsconfig*"
echo ""
echo "=== Checking for tsconfig.json in core/typed-env ==="
if [ -f core/typed-env/tsconfig.json ]; then
cat core/typed-env/tsconfig.json
else
echo "No tsconfig.json in core/typed-env"
fi
echo ""
echo "=== Checking parent tsconfig or root config ==="
if [ -f tsconfig.json ]; then
jq '.compilerOptions.declaration, .compilerOptions.declarationMap, .compilerOptions.emitDeclarationOnly' tsconfig.json
fi
echo ""
echo "=== Checking for any TypeScript output settings ==="
cat core/typed-env/package.json | jq '.scripts'Repository: stephansama/packages
Length of output: 713
🏁 Script executed:
#!/bin/bash
# Get tsdown and base tsconfig settings
echo "=== tsdown.config.ts ==="
cat core/typed-env/tsdown.config.ts
echo ""
echo "=== tsconfig.base.json ==="
cat tsconfig.base.jsonRepository: stephansama/packages
Length of output: 918
Add explicit types field for better TypeScript compatibility.
While tsdown is configured to generate declarations (dts: true), the package.json lacks an explicit types mapping in the root exports. Modern TypeScript with moduleResolution: "Bundler" can often resolve this, but adding an explicit types entry improves compatibility across different resolver modes and consumer tooling.
Suggested adjustment
"exports": {
- ".": "./dist/index.mjs",
+ ".": {
+ "types": "./dist/index.d.ts",
+ "default": "./dist/index.mjs"
+ },
"./package.json": "./package.json"
},
+ "types": "./dist/index.d.ts",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "exports": { | |
| ".": { | |
| "import": "./dist/index.mjs", | |
| "require": "./dist/index.cjs" | |
| }, | |
| ".": "./dist/index.mjs", | |
| "./package.json": "./package.json" | |
| }, | |
| "exports": { | |
| ".": { | |
| "types": "./dist/index.d.ts", | |
| "default": "./dist/index.mjs" | |
| }, | |
| "./package.json": "./package.json" | |
| }, | |
| "types": "./dist/index.d.ts", |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@core/typed-env/package.json` around lines 23 - 26, The package root currently
only exports a JS entry (exports: { ".": "./dist/index.mjs", ... }) but lacks an
explicit TypeScript declaration mapping; update package.json to add a top-level
"types" field pointing to the generated declaration (e.g., "./dist/index.d.ts")
and ensure the root exports (the "." key) conceptually aligns with that types
entry so consumers and TS resolvers can locate declarations produced by dts:
true.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Checklist
mainhave been mergedmain