Skip to content

chore(build): Remove source maps from npm package#1092

Merged
yamadashy merged 2 commits intomainfrom
chore/remove-source-maps-from-npm-package
Jan 15, 2026
Merged

chore(build): Remove source maps from npm package#1092
yamadashy merged 2 commits intomainfrom
chore/remove-source-maps-from-npm-package

Conversation

@yamadashy
Copy link
Copy Markdown
Owner

Summary

  • Remove unused source maps (.js.map, .d.ts.map) from the npm package
  • These maps were not functional since the original .ts source files are not included in the package
  • Add removeComments: true to further reduce package size

Result: lib/ size reduced from 2.4MB to 1.2MB (~50% reduction)

Background

Source maps only work when:

  1. sourcesContent is embedded in the map (like minimatch does), OR
  2. Original .ts files are included in the package

Since Repomix does neither, the maps served no purpose and only increased package size.

Checklist

  • Run npm run test
  • Run npm run lint

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @yamadashy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly optimizes the npm package size by eliminating unnecessary build artifacts. It focuses on removing source maps that were not functional in the current build setup and further reduces the footprint by stripping comments from the compiled JavaScript, resulting in a substantial decrease in the distributed package's size.

Highlights

  • Package Size Reduction: Removed unused and non-functional source maps (.js.map, .d.ts.map) from the npm package, as the original .ts source files were not included, rendering the maps ineffective.
  • Build Configuration Update: Added removeComments: true to the TypeScript build configuration (tsconfig.build.json) to further minimize the package size by stripping comments from compiled output.
  • Significant Impact: These changes collectively reduced the lib/ directory size from 2.4MB to 1.2MB, achieving approximately a 50% reduction in the npm package size.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 15, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Configuration updates to TypeScript compiler options in build files and addition of a new JSON schema file documenting Repomix configuration structure at version 1.11.1.

Changes

Cohort / File(s) Summary
Build Configuration
package.json, tsconfig.build.json
Relocated TypeScript compiler options (sourceMap, declarationMap, removeComments) from build script invocation to tsconfig.build.json, removing explicit flags from tsc command.
Schema Definition
website/client/src/public/schemas/1.11.1/schema.json
New JSON Schema file defining Repomix configuration structure with comprehensive property definitions for input, output, include, ignore, security, and tokenCount sections.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • yamadashy
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main objective of the PR: removing source maps from the npm package to reduce its size.
Description check ✅ Passed The description includes a clear summary of changes, background context, measurable results, and a completed checklist matching the repository template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/remove-source-maps-from-npm-package

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Jan 15, 2026

Deploying repomix with  Cloudflare Pages  Cloudflare Pages

Latest commit: 84a6f51
Status: ✅  Deploy successful!
Preview URL: https://770b31df.repomix.pages.dev
Branch Preview URL: https://chore-remove-source-maps-fro.repomix.pages.dev

View logs

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a great optimization, removing source maps from the npm package to significantly reduce its size. The changes in package.json and tsconfig.build.json correctly disable the generation of .js.map and .d.ts.map files and also remove comments from the output JavaScript. I have one suggestion to make the build configuration more robust by explicitly enabling declaration file generation in tsconfig.build.json to prevent accidental breakage in the future.

@claude
Copy link
Copy Markdown
Contributor

claude bot commented Jan 15, 2026

Code Review

Reviewer: Claude (AI)

Summary

This is a clean, well-structured PR that achieves a significant package size optimization (~50% reduction) by removing unused build artifacts.

Assessment: ✅ Approve

The changes are minimal, focused, and achieve the stated goal effectively.

Detailed Analysis

Code Quality

  • tsconfig.build.json changes are well-organized, properly extending the base config and explicitly disabling source maps
  • package.json change simplifies the build command by moving configuration to tsconfig where it belongs
  • The commit message follows Conventional Commits format as specified in CLAUDE.md

Build Configuration Review

The TypeScript configuration changes are correct:

  • sourceMap: false - Disables JavaScript source maps
  • declarationMap: false - Disables TypeScript declaration maps
  • removeComments: true - Strips comments from output

These settings properly override the base tsconfig.json which has sourceMap: true and declarationMap: true.

Correctness

The PR author's reasoning is sound:

  • Source maps require either sourcesContent embedded OR the original .ts files present
  • Since neither condition is met in the published package, the maps were non-functional
  • Removing them reduces package size without losing functionality
Premortem Analysis - Potential Failure Scenarios
Scenario Risk Level Mitigation
Debugging npm package issues Low Users debugging published code would need to debug compiled JS. This is acceptable since source maps weren't working anyway.
IDE "Go to Definition" Low Declaration files (.d.ts) are still generated, so type information is preserved. Only .d.ts.map files (for source linking) are removed.
Breaking consumers Very Low Only affects package size, not API. No behavioral changes to the library.
CI/CD build differences Very Low The changes are self-contained in tsconfig.build.json, isolating production builds from development.
Minor Observations
  1. Auto-generated schema file: The PR includes website/client/src/public/schemas/1.11.1/schema.json which appears to be auto-generated (chore(schema): auto generate schema commit). This is fine as it's part of the standard workflow.

  2. Development vs Production config: The base tsconfig.json still has sourceMap: true and declarationMap: true, which is correct - these are useful during development/testing. Only the build config disables them.

Checklist

  • Code follows project conventions (Airbnb style, Conventional Commits)
  • Changes are minimal and focused
  • No security concerns introduced
  • No breaking changes to public API
  • Tests and lint pass (per PR checklist)

Verdict: Ready to merge. Great optimization with minimal risk.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@website/client/src/public/schemas/1.11.1/schema.json`:
- Around line 1-168: The generated schema lacks a trailing newline and some
integer-like fields in the source Zod schema are using floating number types;
update generateSchema.ts to append '\n' to the JSON.stringify(...) write so
output ends with a newline, and in configSchema.ts change the Zod definitions
for maxFileSize, topFilesLength, sortByChangesMaxCommits, and includeLogsCount
from z.number() to z.number().int() (splitOutput already uses .int() and should
remain unchanged) so the generated JSON schema marks those fields as integers.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e59a4eb and d9b5492.

📒 Files selected for processing (3)
  • package.json
  • tsconfig.build.json
  • website/client/src/public/schemas/1.11.1/schema.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (2)
package.json (1)

23-23: LGTM! Clean consolidation of build configuration.

Moving source map and declaration handling from CLI flags to tsconfig.build.json improves maintainability by keeping all compiler options in one place.

tsconfig.build.json (1)

3-8: LGTM! Configuration changes align well with the package size reduction goal.

The combination of sourceMap: false, declarationMap: false, and removeComments: true effectively reduces the build output size while maintaining the essential .d.ts declaration files (inherited from base config) needed for TypeScript consumers.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@yamadashy yamadashy force-pushed the chore/remove-source-maps-from-npm-package branch from d9b5492 to e04aee4 Compare January 15, 2026 14:34
Source maps (.js.map, .d.ts.map) were included in the npm package but
served no purpose since the original TypeScript source files are not
published. Without sourcesContent or the actual .ts files, these maps
cannot be used for debugging or "Go to Definition" functionality.

Changes:
- Disable sourceMap and declarationMap in tsconfig.build.json
- Enable removeComments to further reduce package size
- Explicitly set declaration: true for clarity
- Remove --sourceMap flag from build script (now handled by tsconfig)

This reduces the lib/ directory size from 2.4MB to 1.2MB (~50% reduction).
@yamadashy yamadashy force-pushed the chore/remove-source-maps-from-npm-package branch from e04aee4 to 0fd09f1 Compare January 15, 2026 14:35
@claude
Copy link
Copy Markdown
Contributor

claude bot commented Jan 15, 2026

Code Review (Update)

Reviewer: Claude (AI)

AI Bot Comment Evaluation

I reviewed the AI bot feedback on this PR:

Gemini Code Assist - Suggestion to explicitly add `declaration: true`

Priority: Not needed

The declaration: true setting is already inherited from the base tsconfig.json (line 14). Adding it explicitly in tsconfig.build.json would be redundant. The TypeScript compiler correctly applies inheritance, and the current configuration works as intended.

CodeRabbit - Missing trailing newline & integer type suggestions for schema

Priority: Not needed (for this PR)

  1. Trailing newline: The schema file is auto-generated by CI automation. The missing trailing newline is a pre-existing condition (also absent in 1.11.0/schema.json and earlier versions). This is out of scope for this PR.

  2. Integer types for number fields: While technically valid, changing Zod definitions would require:

    • Modifying configSchema.ts source
    • Regenerating all affected schemas
    • This is unrelated to the source map removal objective

These are valid improvement suggestions but should be tracked as separate issues rather than blocking this PR.

Updated Assessment

My previous review stands: ✅ Ready to merge

The PR achieves its stated goal (50% package size reduction) with minimal, focused changes. The AI bot suggestions are either incorrect (Gemini) or out of scope (CodeRabbit).


Note: I could not access the inline review comment API directly, so I evaluated the bot comments based on their summary descriptions in the review bodies.

@claude
Copy link
Copy Markdown
Contributor

claude bot commented Jan 15, 2026

Follow-up Review

Reviewer: Claude (AI)

Previous Review Status

I previously reviewed this PR and approved it. Looking at the current state, my assessment remains unchanged - this is a clean PR ready for merge.

AI Bot Feedback Evaluation

CodeRabbit's Feedback on Schema File

CodeRabbit flagged that the generated schema file (website/client/src/public/schemas/1.11.1/schema.json) lacks a trailing newline. While technically valid, this is:

  1. Not introduced by this PR - The schema is auto-generated by CI (chore(schema): auto generate schema) using the existing generateSchema.ts script
  2. Pre-existing in the codebase - The latest/schema.json already lacks a trailing newline
  3. Out of scope - Fixing this would require changes to website/client/scripts/generateSchema.ts, which is unrelated to the PR's goal of reducing package size

Verdict: This is a valid observation but should be addressed in a separate PR if desired.

Gemini's Suggestion on Explicit Declaration

Gemini suggested explicitly enabling declaration file generation. Looking at the current tsconfig.build.json:

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "rootDir": "./src",
    "declaration": true,  // ✅ Already added in this PR
    "sourceMap": false,
    "declarationMap": false,
    "removeComments": true
  }
}

The author has already addressed this by adding "declaration": true explicitly.

Verdict: Already resolved.

Summary

No new issues found. The PR achieves its goal of ~50% package size reduction with minimal risk.

Recommendation: ✅ Ready to merge

@yamadashy yamadashy merged commit a829581 into main Jan 15, 2026
2 checks passed
@yamadashy yamadashy deleted the chore/remove-source-maps-from-npm-package branch January 15, 2026 14:45
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.

1 participant