Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Pass project root as argument to functions that use relative paths #860

Closed
ashleymichal opened this issue Nov 8, 2019 · 8 comments
Closed

Comments

@ashleymichal
Copy link
Contributor

There are a lot of places in our code base where we have to reference a path relative to the root of the project. At the moment, we simply assume that wrangler is always being executed from the project root because that's the only place it will work (we look for the wrangler.toml in the current working directory).

One nice refactor to pave the way to monorepo support, or to simply be able to run wrangler from anywhere in the project, would be to refactor out all these calls to env::current_dir() and pass them in as arguments to the various functions that call them.

per #851 (comment)

@juanmrad
Copy link

This would be amazing.

we have been having problems because our project has a couple worker scripts and in order to use wrangler commands we have to go into the folder where the wrangler.toml file is in order to run publish or preview while it would be much nicer to pass just the path of where those files are hosted.

@ashleymichal
Copy link
Contributor Author

@juanmrad to be clear, this would be a refactor step where internal functions take this as an argument; we haven't quite got to designing how it should look to call wrangler from a directory other than the project root, but it's great to know this use case! are you in a monorepo setup where you cd one directory deeper to get to your wrangler.toml, or a situation where you need to cd a level or two up to get to it?

@juanmrad
Copy link

@ashleymichal Yes I understand, but wanted to give my side to help on feedback and also give a scenario where this is useful.

To clarify our use case: We have a monorepo project that contains both front and backend. We currently have 3 different cloudflare worker scripts that are deployed and were created on the UI and we were planning on moving them to the project.

So we added them into a specific folder where each worker scrip has its own folder with its own toml file. Which right now I have to cd two directories deep to each worker script folder in order to deploy them via the CLI.

@stale
Copy link

stale bot commented Jun 18, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 18, 2020
@stale
Copy link

stale bot commented Jun 25, 2020

This issue has been automatically closed because it has not had recent activity. You may re-open the issue if it is still relevant.

@stale stale bot closed this as completed Jun 25, 2020
@simonhaenisch
Copy link
Contributor

Would like this as well!

@stale stale bot removed the wontfix label Jul 27, 2020
@stale
Copy link

stale bot commented Jan 23, 2021

This issue has been automatically marked as stale because it has not had recent activity in the last 180 days. It will be closed if no further activity occurs in the next week. Please feel free to comment if you'd like it to remain open, and thank you for your contributions.

@Electroid
Copy link
Contributor

Going to close this in favor of #482. Effectively they are about the same thing: allowing developers to specify the workdir (which will involve the refactoring as described in this issue)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants