fix: Correctly zip local (and aliased) packages#1685
Open
darthmaim wants to merge 1 commit intowxt-dev:mainfrom
Open
fix: Correctly zip local (and aliased) packages#1685darthmaim wants to merge 1 commit intowxt-dev:mainfrom
darthmaim wants to merge 1 commit intowxt-dev:mainfrom
Conversation
✅ Deploy Preview for creative-fairy-df92c4 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
8038445 to
961f783
Compare
961f783 to
4e52907
Compare
Author
|
I did some more tests today, and while this does fix the handling of The generated package.json will look like this: "dependencies": {
"@local/dependency": "workspace:*",
},
"resolutions": {
"@local/dependency@link:../../packages/dependency": "file://./.wxt/local_modules/local-dependency-0.0.1.tgz"
}Trying to install this with I'll look into adding special handling for Maybe downloaded "dependencies": {
"@local/dependency": "file://./.wxt/local_modules/local-dependency-0.0.1.tgz",
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
I've fixed handling of local (and aliased) packages when building the zip.
Before this fix it was not possible to include local dependencies in the sources zip, which for example can often happen in monorepos.
Testing
I've added a test case that tests the new behavior, and I've also tested this with a combination of scoped and unscoped packages.
Notes
should download local packages and produce a valid build when zipping sourcestest case is basically just a copy/paste of the existingshould download packages and produce a valid build when zipping sourcestest, the only difference being the local dependencies. It might be nicer to just include the local dependencies in the original test case?e2e/tests/__fixtures__/local-package. I originally wanted to create it withproject.addFile('local/package.json'), butpnpm.listDependenciescould not parse the output with the nested dependencies. This could be fixed by removing the-roption, but it was explicitly added in fix(zip): List all private packages correctly in a PNPM workspace #520, so I opted to store the local package outside of the extension directory.downloadDependencyneeds to be able to resolve relative dependencies, so I've added a newcwdoption similar to the one inlistDependenciesfile:(usual default for local dependencies) andlink:(whatpnpmresolvesworkspace:to),pnpmcreates an alias for one of them.downloadPrivatePackagesdid not create valid overrides for aliased packages, so I had to fix this too.npm-package-argfor parsing the package ids than using regex. Edit:npm-package-argdoesn't support parsing aliases.