fix: prevent browserslist config resolution error with pnpm#2043
Open
pannous wants to merge 1 commit intoasyncapi:masterfrom
Open
fix: prevent browserslist config resolution error with pnpm#2043pannous wants to merge 1 commit intoasyncapi:masterfrom
pannous wants to merge 1 commit intoasyncapi:masterfrom
Conversation
When asyncapi CLI is installed globally via pnpm, the global bin directory contains a shell wrapper script named "browserslist". The browserslist package walks up directories looking for config files and mistakenly parses this shell script as a config, causing: "Unknown browser query 'basedir=$(dirname "$(echo "$0" | sed -e 's'" Fix: set BROWSERSLIST=defaults env var before generation to prevent the directory walk. The env var is restored afterward in a finally block to avoid side effects. Fixes asyncapi#1781
|
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
Unknown browser query 'basedir=$(dirname ...'when CLI is installed globally via pnpmBROWSERSLIST=defaultsenv var before generation to prevent browserslist from walking directories and mistakenly parsing pnpm's shell wrapper script as a config filefinallyblock to avoid side effectsRoot Cause
When installed via pnpm, the global
bin/directory contains a shell wrapper script namedbrowserslist. The browserslist package walks up directories looking for config files, finds this shell script, and tries to parse it as a browserslist query — causing the error.Test plan
pnpm add -g @asyncapi/cli)asyncapi generate fromTemplate <spec.yaml> @asyncapi/html-template -o docsnpm test)