Skip to content

feat: ✨ add cwd option#47

Open
jfirebaugh wants to merge 1 commit into
folke:mainfrom
figma:jfirebaugh/configurable-dir
Open

feat: ✨ add cwd option#47
jfirebaugh wants to merge 1 commit into
folke:mainfrom
figma:jfirebaugh/configurable-dir

Conversation

@jfirebaugh

Copy link
Copy Markdown

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
Copy Markdown

Why not just make use of process.chdir?

@jfirebaugh

Copy link
Copy Markdown
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
Copy Markdown

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