-
Notifications
You must be signed in to change notification settings - Fork 758
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
fix: default watch_dir
to src
of project directory
#646
Conversation
🦋 Changeset detectedLatest commit: 2fb8e48 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.developers.workers.dev/runs/2010721608/npm-package-wrangler-646 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.developers.workers.dev/prs/646/npm-package-wrangler-646 Or you can use npx https://prerelease-registry.developers.workers.dev/runs/2010721608/npm-package-wrangler-646 dev path/to/script.js |
7840fcb
to
5c6485c
Compare
I tested the prerelease build with https://github.com/jahands/wrangler-dev-example and it worked! Nice. |
command | ||
? configPath | ||
? path.relative( | ||
process.cwd(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally I think we need to be making these paths relative to the wrangler.toml. The reason is that otherwise the following would have different results:
wrangler -c path/to/wrangler.toml ...
cd path/to
wrangler -c wrangler.toml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, I don't understand. what would be the difference with these two? they would both resolve a watch_dir config to the same path, unless I'm missing something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it does resolve against wrangler.toml's path in the next line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so I see my confusion now. You are saying that the configPath
is always, already, relative to the cwd()
(or it is absolute).
In that case there is no need for the relative(process.cwd(), ...)
bit then, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a personal preference, I don't like seeing absolute paths if and when I log this during development. Is that a problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is exactly how we normalised paths for wasm_modules and text_blobs too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK - it just really confused me, because if it is possible that configPath
is not relative to src
then this would break.
Happy to go with this for the timebeing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah of the wrangler.Tom isn't adjacent to a src directory then this won't work. Honestly I think there shouldn't have been a default for that field at all (much like upload.dir)
dammit forgot a changeset |
Via wrangler 1, when using custom builds in `wrangler dev`, `watch_dir` should default to `src` of the "project directory" (i.e - wherever the `wrangler.toml` is defined if it exists, else in the cwd. Fixes #631
5c6485c
to
2fb8e48
Compare
command | ||
? configPath | ||
? path.relative( | ||
process.cwd(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK - it just really confused me, because if it is possible that configPath
is not relative to src
then this would break.
Happy to go with this for the timebeing.
Via wrangler 1, when using custom builds in
wrangler dev
,watch_dir
should default tosrc
of the "project directory" (i.e - wherever thewrangler.toml
is defined if it exists, else in the cwd.Fixes #631