Skip to content

feat: add path remap config for monorepo support - #3

Open
xusuxiang8 wants to merge 1 commit into
mxx1111:mainfrom
xusuxiang8:fix/remap-paths
Open

feat: add path remap config for monorepo support#3
xusuxiang8 wants to merge 1 commit into
mxx1111:mainfrom
xusuxiang8:fix/remap-paths

Conversation

@xusuxiang8

Copy link
Copy Markdown

Closes #10

Changes

  • Added remap config key to sparepack.yaml for path prefix remapping
  • Paths inside a pack can now be remapped, e.g. packages/api/src/src/
  • Added parseRemap() in config.mjs with validation
  • Remap is applied in buildPack before scanning
  • Added remap example to the init template

Example

remap:
  - from: packages/api/src/
    to: src/

Root Cause

Monorepo roots produce paths like packages/api/src/... inside packs.
The documented workaround ("run sparepack from the subdirectory") fails
when config, tests, and source don't share one useful root.

Verification

  • All existing tests should pass
  • Config validation rejects invalid remap entries
  • Remap rules compile to {from: string, to: string} with normalized trailing slashes

Closes #10

Adds a 'remap' config key for path prefix remapping
so packs from monorepo roots don't mirror repo paths.

Example:
  remap:
    - from: packages/api/src/
      to: src/
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