Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose cwd in input options #692

Merged
merged 2 commits into from
Mar 29, 2024

Conversation

jwnx
Copy link
Contributor

@jwnx jwnx commented Mar 29, 2024

Exposes cwd prop in InputOptions and updates rolldown tests to
leverage it. Closes #687

Copy link

netlify bot commented Mar 29, 2024

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 0dffe3c
🔍 Latest deploy log https://app.netlify.com/sites/rolldown-rs/deploys/6606f33dd1eb570008d44f62

@jwnx
Copy link
Contributor Author

jwnx commented Mar 29, 2024

@hyf0 I refactored rolldown tests to use cwd for testing purposes, but if you find it unnecessary I can remove this change.

@@ -4,7 +4,8 @@ import { expect } from 'vitest'
import { getOutputChunkNames } from '@tests/utils'

const config: RollupOptions = {
input: [path.join(__dirname, 'main.js'), path.join(__dirname, 'entry.js')],
input: ['main.js', 'entry.js'],
cwd: __dirname,
Copy link
Member

Choose a reason for hiding this comment

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

Since you already pass cwd in packages/rolldown/tests/fixture.test.ts, this is unnessary to pass it again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Copy link
Member

Choose a reason for hiding this comment

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

You could also remove this line

dir: outputOptions.dir ?? nodePath.join(fixturePath, 'dist'),

Rolldown will emit to <CWD>/dist by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

@hyf0 hyf0 self-assigned this Mar 29, 2024
Exposes `cwd` prop in `InputOptions` and updates rolldown tests to
leverage it. Closes rolldown#687
@jwnx jwnx force-pushed the jwnx/feat/expose-cwd-in-input-options branch from 3a36c55 to 0dffe3c Compare March 29, 2024 16:58
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@hyf0 I was able to remove a lot of path manipulation from this file and tests are passing just fine. Let me know if you think we should keep the old code.

Copy link
Member

@hyf0 hyf0 left a comment

Choose a reason for hiding this comment

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

Well done!

@hyf0 hyf0 merged commit ba42b29 into rolldown:main Mar 29, 2024
15 checks passed
@jwnx jwnx deleted the jwnx/feat/expose-cwd-in-input-options branch March 29, 2024 17:34
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.

Allow to pass cwd option via InputOptions
2 participants