egoist / egoist/tsup

[Feature request] Lets add "cwd" option to JS API

Open
#1,292 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

1. Tsup is so fast that I would like to run it via JS API without wasting time on fork/exec.
2. At the same time, we use a monorepo and therefore run the build of several packages in parallel.
And here is where the problem occurs - tsup uses process.cwd() when building without the ability to override the working directory, so points 1 and 2 cannot be implemented simultaneously.

Can we add `cwd` option to allow this use case? Some components already have this functional:
- `absWorkingDir` in [esbuild](https://esbuild.github.io/api/#working-directory)
- typescript stuff should work relative to tsconfig.json
- there is some process.cwd calls relative to rollup (don't know yet if this will be a problem)

I may try to experiment a little and if everything goes well make a pull request if the general consensus is that this feature is needed.

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests; start by tracing the JavaScript API option handling and each process.cwd() use involved in builds. Compare the requested behavior with esbuild's absWorkingDir and tsconfig-relative behavior. Done means a cwd option supports parallel monorepo builds without breaking the stated Rollup-related paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.