-
Notifications
You must be signed in to change notification settings - Fork 734
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 relative project root #7285
Conversation
🦋 Changeset detectedLatest commit: 79d10d0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
JSON.stringify(entry).replaceAll(process.cwd(), "/tmp/dir") | ||
); | ||
} | ||
describe("getEntry()", () => { |
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.
🙏 🙇
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11934954997/npm-package-wrangler-7285 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7285/npm-package-wrangler-7285 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11934954997/npm-package-wrangler-7285 dev path/to/script.js Additional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11934954997/npm-package-create-cloudflare-7285 --no-auto-update npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11934954997/npm-package-cloudflare-kv-asset-handler-7285 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11934954997/npm-package-miniflare-7285 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11934954997/npm-package-cloudflare-pages-shared-7285 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11934954997/npm-package-cloudflare-vitest-pool-workers-7285 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11934954997/npm-package-cloudflare-workers-editor-shared-7285 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11934954997/npm-package-cloudflare-workers-shared-7285 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11934954997/npm-package-cloudflare-workflows-shared-7285 Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
865d102
to
577f4b9
Compare
@@ -53,7 +53,9 @@ export async function getEntry( | |||
const directory = process.cwd(); | |||
const entryPoint = config.site?.["entry-point"]; | |||
|
|||
let paths: { absolutePath: string; relativePath: string } | undefined; | |||
let paths: | |||
| { absolutePath: string; relativePath: string; directory?: string } |
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.
| { absolutePath: string; relativePath: string; directory?: string } | |
| { absolutePath: string; relativePath: string; projectRoot?: string } |
@@ -16,11 +16,12 @@ export function resolveEntryWithMain( | |||
): { | |||
absolutePath: string; | |||
relativePath: string; | |||
directory: string; |
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.
Can we call this projectRoot
? Will simplify code elsewhere and is more descriptive than directory
which could be a directory of anything.
describe("getEntry()", () => { | ||
runInTempDir(); | ||
mockConsoleMethods(); | ||
it.each([ |
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.
I love that you added these tests, but if I am honest, using it.each()
here actually obscures what the tests are doing and doesn't save much boilerplate compared to writing out a bunch of separate it clauses, given how simple the test code is.
@petebacondarwin I've renamed |
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.
Cripes that rename had more blast radius than I thought!
Thanks.
A few unused imports to remove?
Haven't tested, but this maybe fixes [break autolink] #5481? |
It shouldn't I don't think—that looks older than this regression? Taking a look |
@GregBrimble it looks like it might be a workspaces thing? #5481 (comment) |
#6971 introduced a small regression in the
getEntry()
function that meant thatEntry.directory
was alwaysprocess.cwd()
rather than relative to the foundwrangler.toml
file. This PR fixes the regression & adds a regression test that fails onmain
but passes prior to #6971.