Skip to content

CLI: Use the right base when loading files from stdin#14522

Merged
philipp-spiess merged 2 commits into
nextfrom
fix/base-for-cli-when-read-from-stdin
Sep 26, 2024
Merged

CLI: Use the right base when loading files from stdin#14522
philipp-spiess merged 2 commits into
nextfrom
fix/base-for-cli-when-read-from-stdin

Conversation

@philipp-spiess

Copy link
Copy Markdown
Contributor

Fixes #14521

When using the CLI to read files from stdin like this:

npx tailwindcss  --input=- -o bar.css < foo.css

We need to set the base path to be the current working directory (process.cwd()). However, cwd() already is a directory and calling dirname() on it did go to the parent directory _which might not have the tailwindcss dependency installed.

@philipp-spiess philipp-spiess force-pushed the fix/base-for-cli-when-read-from-stdin branch from 676a362 to 98fe613 Compare September 26, 2024 09:22
@thecrypticace

Copy link
Copy Markdown
Contributor

We should add a test for this if we can

@philipp-spiess

Copy link
Copy Markdown
Contributor Author

@thecrypticace added ✅

@thecrypticace

thecrypticace commented Sep 26, 2024

Copy link
Copy Markdown
Contributor

@philipp-spiess I think the test should have a relative import to correctly catch this case yeah?

@thecrypticace

Copy link
Copy Markdown
Contributor

ah wait nvm this test is sufficient b/c the import for tailwind would fail too b/c node_modules in a different dir. LGTM

@philipp-spiess philipp-spiess merged commit 89f0047 into next Sep 26, 2024
@philipp-spiess philipp-spiess deleted the fix/base-for-cli-when-read-from-stdin branch September 26, 2024 10:32

@CharlesCowan CharlesCowan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

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.

cli: Reading from stdin is broken in 4.0.0-alpha.25

3 participants