Skip to content

Include lib/actions/rename.cjs in published package (fixes #2)#4

Open
shackstack wants to merge 1 commit into
Leuconoe:mainfrom
shackstack:fix/include-rename-cjs
Open

Include lib/actions/rename.cjs in published package (fixes #2)#4
shackstack wants to merge 1 commit into
Leuconoe:mainfrom
shackstack:fix/include-rename-cjs

Conversation

@shackstack

Copy link
Copy Markdown

Problem

cc-switch.cjs does require('./lib/actions/rename.cjs') at load time, so the file is needed for the CLI to start at all. But package.json's files allow-list omits lib/actions/rename.cjs (it lists sync, usage, remove, list, switch but not rename).

The file exists in the repo, so it works from a git checkout — but the published npm package drops it, and every cc-switch invocation then crashes:

Error: Cannot find module './lib/actions/rename.cjs'
  code: 'MODULE_NOT_FOUND'

This takes down the whole CLI, not just the rename subcommand.

Fix

Add lib/actions/rename.cjs to the files array. Verified with npm pack --dry-run:

npm notice 1.3kB lib/actions/rename.cjs

Fixes #2

cc-switch.cjs requires ./lib/actions/rename.cjs at load time (the
--rename / rename path), but rename.cjs was missing from the package.json
"files" allow-list. As a result the published npm package omits it and
every cc-switch invocation crashes with MODULE_NOT_FOUND, not just the
rename subcommand.

Add lib/actions/rename.cjs to "files" so it ships.

Fixes Leuconoe#2
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.

Published package missing bin/lib/actions/rename.cjs → cc-switch crashes with MODULE_NOT_FOUND

1 participant