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

fix: overrides in release option #345

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Aslemammad
Copy link
Contributor

@Aslemammad Aslemammad commented Dec 14, 2024

With #313, few tests like the marko tests were failing to invalid overrides! those overrides were relying on the vite workspace, even though with pkg.pr.new, there's no vite cloning, so that was wrong.

In this pr, we install vite from pkg.pr.new and we use rollup/esbuild versions from there as overrides for tests like marko!

@dominikg
Copy link
Collaborator

i would prefer not to run additional pnpm calls, esp. pnpm remove. is there an equivalent of npm info implemented by pr.pkg.new? or should we install first, then read vite package.json, add overrides and install again?

@Aslemammad
Copy link
Contributor Author

is there an equivalent of npm info implemented by pr.pkg.new?

no we do not have that.

that's why we should install first!

@dominikg
Copy link
Collaborator

what would it take to add that? tbh the changes needed to accommodate pr.pkg.new start to get me to believe that just always building vite is the way to go, or investigate a separate persisted hosted registry where ecosystem-ci can cache its own builds and query dependencies as needed (vue-ecosystem-ci does that i believe)

@Aslemammad
Copy link
Contributor Author

what would it take to add that?

I'm trying to find a way to skip the current pnpm add that was added in this PR! if i do not find a way, I'll investigate it on our end too.

utils.ts Outdated
@@ -274,6 +274,19 @@ export async function runInRepo(options: RunOptions & RepoOptions) {
} else {
overrides.vite = options.release
}
const viteManifest = JSON.parse(
await $`pnpm dlx pacote manifest ${options.release} --json`,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dominikg pacote is what npm info uses, so i added a call for it here to get the manifest of the release.

Copy link
Collaborator

Choose a reason for hiding this comment

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

why dlx instead of adding it to the repo as dev dependency and calling manifest directly? But i thought you said that pkg.pr.new didn't support the info service?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why dlx instead of adding it to the repo as dev dependency and calling manifest directly?

I can do it if you want! let me send a commit.

But i thought you said that pkg.pr.new didn't support the info service?

pacote does not rely on any service, it supports standalone tarballs and also packages from the registry.

Copy link
Collaborator

Choose a reason for hiding this comment

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

this would allow adding the override without running install first at the expense of downloading the full tarball just to inspect its package.json 🙈 . I was under the impression that npm info had a more elegant way to get to that information.

Copy link
Collaborator

Choose a reason for hiding this comment

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

and yes, please don't use dlx, we want control over the version of pacote that is used and its more efficient to take it from local.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was under the impression that npm info had a more elegant way to get to that information.

Yea, that'd be costly for servers if they want to consume the tarball themselves and parse the json! good for small packages, but for heavy packages, that's too much to unpack a tarball in the memory. Specially if that's cloudflare workers, which is what pkg.pr.new uses :)

we want control over the version of pacote that is used and its more efficient to take it from local.

Noted, in the last commit.

Copy link
Member

Choose a reason for hiding this comment

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

but for heavy packages, that's too much to unpack a tarball in the memory.

I think you can process it in stream and only extract the package.json so that you won't need to keep the whole unpacked tarball. It's a bit hard though.

utils.ts Outdated
@@ -274,6 +275,17 @@ export async function runInRepo(options: RunOptions & RepoOptions) {
} else {
overrides.vite = options.release
}
const viteManifest = await pacote.manifest(options.release)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should only be called if we need the manifest to determine the value for an override.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok pushed a new change, we'd have to call pacote in each if statement, but i think that's ok since it caches the results!

utils.ts Outdated Show resolved Hide resolved
utils.ts Outdated
@@ -274,6 +274,19 @@ export async function runInRepo(options: RunOptions & RepoOptions) {
} else {
overrides.vite = options.release
}
const viteManifest = JSON.parse(
await $`pnpm dlx pacote manifest ${options.release} --json`,
Copy link
Member

Choose a reason for hiding this comment

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

but for heavy packages, that's too much to unpack a tarball in the memory.

I think you can process it in stream and only extract the package.json so that you won't need to keep the whole unpacked tarball. It's a bit hard though.

@Aslemammad
Copy link
Contributor Author

I think you can process it in stream and only extract the package.json so that you won't need to keep the whole unpacked tarball. It's a bit hard though.

that's an interesting idea! I think that'd be doable, but it takes time as you say. maybe we can have a different service that extracts specific files from a tarball on the fly :)

@dominikg
Copy link
Collaborator

do we really want to treat rollup and esbuild override flags differently (one must be explicit false the other explicit true?) from a usage perspective it would be nicer if they behaved the same.

for pacote even if it caches internally (how, where?) i'd prefer making that call only once, so checking both conditions first, if either is met then run pacote, then act on the output.

@sapphi-red
Copy link
Member

do we really want to treat rollup and esbuild override flags differently (one must be explicit false the other explicit true?) from a usage perspective it would be nicer if they behaved the same.

My rationale here is to minimize the difference from the actual users. Since we only override esbuild for marko, I think it's better not to override esbuild for others.

BTW I wonder if we can remove the need of overriding rollup in most cases by calling pnpm dedupe and alternatives.

@Aslemammad Aslemammad requested a review from dominikg December 18, 2024 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants