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

refactor: move projectRoot computation to config validation #7415

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

petebacondarwin
Copy link
Contributor

@petebacondarwin petebacondarwin commented Dec 2, 2024

A refactor to move the projectRoot field to config (from entry) so that it can be used more flexibly.

Copy link

changeset-bot bot commented Dec 2, 2024

⚠️ No Changeset found

Latest commit: 94bcfcd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@petebacondarwin petebacondarwin force-pushed the pbd/refactor-pass-around-project-directory branch from 73b1fe9 to 9d271e9 Compare December 2, 2024 22:07
Copy link
Contributor

github-actions bot commented Dec 2, 2024

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/12136193054/npm-package-wrangler-7415

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7415/npm-package-wrangler-7415

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12136193054/npm-package-wrangler-7415 dev path/to/script.js
Additional artifacts:
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12136193054/npm-package-create-cloudflare-7415 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12136193054/npm-package-cloudflare-kv-asset-handler-7415
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12136193054/npm-package-miniflare-7415
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12136193054/npm-package-cloudflare-pages-shared-7415
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12136193054/npm-package-cloudflare-vitest-pool-workers-7415
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12136193054/npm-package-cloudflare-workers-editor-shared-7415
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12136193054/npm-package-cloudflare-workers-shared-7415
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12136193054/npm-package-cloudflare-workflows-shared-7415

Note that these links will no longer work once the GitHub Actions artifact expires.


[email protected] includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20241106.1
workerd 1.20241106.1 1.20241106.1
workerd --version 1.20241106.1 2024-11-06

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

@petebacondarwin petebacondarwin force-pushed the pbd/refactor-pass-around-project-directory branch from 9d271e9 to bc40775 Compare December 3, 2024 08:54
@petebacondarwin petebacondarwin force-pushed the pbd/refactor-pass-around-project-directory branch from bc40775 to 94bcfcd Compare December 3, 2024 08:58
@petebacondarwin petebacondarwin added the skip-pr-description-validation Skip validation of the required PR description format label Dec 3, 2024
@petebacondarwin petebacondarwin marked this pull request as ready for review December 3, 2024 09:11
@petebacondarwin petebacondarwin requested review from a team as code owners December 3, 2024 09:11
} else if (entryPoint) {
paths = resolveEntryWithEntryPoint(entryPoint, config.configPath);
paths = resolveEntryWithEntryPoint(entryPoint, config.projectRoot);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this isn't a type error, but I think the return value here is used further down, and should probably be changed to config.projectRoot as well:

89: const projectRoot = paths.projectRoot ?? process.cwd();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops I missed that one.
It is not a type error it is just redundant further down.

@@ -69,7 +69,6 @@ type Props = {
dryRun: boolean | undefined;
noBundle: boolean | undefined;
keepVars: boolean | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to this PR, but it looks like these props could do with some cleanup... They seem to take both config.rules and config as separate values?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So in the call site for versionsUpload() there is rules: getRules(config), which does som additional validation of deprecated rules options. That function is used in various places.

I think that whole function can be removed in Wrangler V4, since the deprecated fields might be removed?

@petebacondarwin petebacondarwin merged commit 4f1a46e into main Dec 3, 2024
36 of 37 checks passed
@petebacondarwin petebacondarwin deleted the pbd/refactor-pass-around-project-directory branch December 3, 2024 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-pr-description-validation Skip validation of the required PR description format
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants