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

import unenv-preset #7370

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

import unenv-preset #7370

wants to merge 1 commit into from

Conversation

vicb
Copy link
Contributor

@vicb vicb commented Nov 27, 2024

@pi0 @petebacondarwin This PR imports & sync the cloudflare preset.

#7366 lists (most of) the tasks that will need to be done.

--

Smoke tested with https://github.com/cloudflare/workers-sdk/tree/preset-test. In that branche, wrangler uses @cloudflare/unenv-preset and the hybrid test pass.

Next steps:

  • Add a way to test the dev version of the package (the plugin should resolve modules to the workspace version of the file)
  • Add tests
  • Setup the NPM release
  • ... see tracking issue

--

@pi0 I changed the license to MIT + Apache, is that ok with you?

@petebacondarwin do you think it would cause an issue to merge this before all of #7366 is done?

  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because: will be added in a follow up PR
  • E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because: newly created pkg not used yet
  • Public documentation
    • TODO (before merge)
    • Cloudflare docs PR(s):
    • Documentation not necessary because: there is no user facing change

@vicb vicb requested a review from a team as a code owner November 27, 2024 15:31
Copy link

changeset-bot bot commented Nov 27, 2024

⚠️ No Changeset found

Latest commit: da6fe7f

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

@vicb vicb requested a review from petebacondarwin November 27, 2024 15:34
@vicb vicb added the e2e Run e2e tests on a PR label Nov 27, 2024
Copy link

Choose a reason for hiding this comment

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

while personally recommand unbuild/mkdist, also a simple tsc would work if it is widely used in this repo.

Copy link

Choose a reason for hiding this comment

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

Do you have any other convention perhaps here?

Copy link
Contributor

github-actions bot commented Nov 27, 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/12278048534/npm-package-wrangler-7370

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

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

Or you can use npx with this latest build directly:

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

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.20241205.0
workerd 1.20241205.0 1.20241205.0
workerd --version 1.20241205.0 2024-12-05

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

@pi0
Copy link

pi0 commented Nov 28, 2024

@vicb I think you need to update deps.ts to include this new package.

@vicb
Copy link
Contributor Author

vicb commented Nov 29, 2024

@vicb I think you need to update deps.ts to include this new package.

Good point, thanks @pi0. I'll add that to the tracking issue for when we switch wrangler to using this package.

.gitignore Outdated Show resolved Hide resolved
packages/unenv-preset/package.json Show resolved Hide resolved
@vicb vicb force-pushed the unenv branch 6 times, most recently from 08eea47 to 708af56 Compare December 11, 2024 09:39
@vicb vicb requested a review from pi0 December 11, 2024 13:58
@vicb vicb removed the e2e Run e2e tests on a PR label Dec 11, 2024
@vicb vicb force-pushed the unenv branch 2 times, most recently from 0195bfd to 81019e0 Compare December 11, 2024 14:11
Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

Will need to update findPackageNames() in validate-changesets.test.ts.

packages/unenv-preset/build.config.ts Outdated Show resolved Hide resolved
packages/unenv-preset/src/index.ts Outdated Show resolved Hide resolved
@petebacondarwin
Copy link
Contributor

Still need to fix this test:

Will need to update findPackageNames() in validate-changesets.test.ts.

@petebacondarwin
Copy link
Contributor

And appears to be a problem with the lockfile?

"workerd": {
"optional": true
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If you add this here:

Suggested change
}
},
"workers-sdk": {
"prerelease": true
}

Then we should auto-generate pre-release builds per PR.

@petebacondarwin
Copy link
Contributor

I think to do the first deployment we need to mark it as public access:

npm publish --access public

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Approved
Development

Successfully merging this pull request may close these issues.

4 participants