fix: move tsx to runtime dependencies and resolve from script dir#186
Open
fix: move tsx to runtime dependencies and resolve from script dir#186
Conversation
tsx is required at runtime by the qmd wrapper script via `node --import tsx`, but was listed in devDependencies. Global installs (npm install -g, bun install -g) skip devDependencies, so tsx was never available after install. Additionally, Node's ESM resolver walks up from the current working directory when resolving bare specifiers like `--import tsx`, so even a separate `npm install -g tsx` doesn't help. Fix both issues by: 1. Moving tsx from devDependencies to dependencies so it's always installed alongside qmd 2. Using an explicit path to tsx's ESM loader in the wrapper script instead of a bare specifier, so Node resolves it from qmd's own node_modules regardless of CWD Fixes tobi#182
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #182 —
tsxwas indevDependenciesbut is required at runtime by theqmdwrapper script. Global installs vianpm install -gorbun install -gskip devDependencies, causingERR_MODULE_NOT_FOUNDimmediately on anyqmdcommand.Changes:
tsxfromdevDependenciestodependenciesso it's always installed alongside qmdtsxESM loader ($SCRIPT_DIR/node_modules/tsx/dist/esm/index.mjs) instead of bare--import tsxspecifier, since Node's ESM resolver walks up from CWD — not from the script location — when resolving bare specifiersBoth changes are needed: moving to
dependenciesensurestsxis present in qmd'snode_modules, and the explicit path ensures Node finds it regardless of the user's current working directory.