Skip to content

fix: NPM packages dump for scoped packages#275

Open
corderop wants to merge 1 commit intoCodelyTV:mainfrom
corderop:fix-274
Open

fix: NPM packages dump for scoped packages#275
corderop wants to merge 1 commit intoCodelyTV:mainfrom
corderop:fix-274

Conversation

@corderop
Copy link

@corderop corderop commented Mar 6, 2026

As described in the issue, for scoped packages (like @google/gemini-cli), the package path in node_modules follows the following structure:

├── @google
│   └── gemini-cli

What with the current version, generates the following package dump

@google

This doesn't contain the whole package name and the import will fail later. With the proposed solution, we will save the whole package name:

@google/gemini-cli

Solution explained

In the original ls command, I have excluded any package/folder that start with @:
ls -1 "$HOMEBREW_PREFIX/lib/node_modules" | grep -v npm | grep -v '^@'

Then we iterate through the folders that start by @:
for scope in "$HOMEBREW_PREFIX/lib/node_modules/@"*/; do

For every folder, we dump every single directory (actual packages) there with ls -1, adding the scope (@... (e.g. @google)) at the start of every package.
[ -d "$scope" ] && ls -1 "$scope" | sed "s|^|$(basename "$scope")/|"

AI disclaimer

Solution assisted by Claude Code

Closes: #274

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.

Wrong NPM export for scoped packages

1 participant