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: ✨ add cwd option #47

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jfirebaugh
Copy link

I want to use esbuild-runner in contexts where the current directory is not the directory containing the package.json whose dependencies should be used to chose externals. This makes the location for package.json configurable. It's roughly equivalent to the cwd option from ts-node: https://github.com/TypeStrong/ts-node/blob/abc616ece2a8cdb066439a4e5c6fc7d493aa4612/src/index.ts#L191-L196.

I want to use esbuild-runner in contexts where the current directory is not the directory containing the package.json whose dependencies should be used to chose externals. This makes the location for package.json configurable. It's roughly equivalent to the `cwd` option from ts-node: https://github.com/TypeStrong/ts-node/blob/abc616ece2a8cdb066439a4e5c6fc7d493aa4612/src/index.ts#L191-L196.
@romanlamsal
Copy link

Why not just make use of process.chdir?

@jfirebaugh
Copy link
Author

It would change the execution environment of the code that the runner is running, which may be expecting the current directory to be the one where the command was executed.

@romanlamsal
Copy link

Yes, but is that not the intention of a --cwd flag? For example, running ts-node --cwd /some/where your-script.ts will try to execute /some/where/your-script.ts. I'm just saying, cwd as flag is confusing if the actual goal is to just tell esbuild-runner to read from another package.json.

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.

2 participants