Allow for installing dependencies without manifest#3624
Conversation
| const manifest = await this.config.readManifest(loc, this.registry); | ||
| const manifest: Manifest = await (async () => { | ||
| try { | ||
| return await await this.config.readManifest(loc, this.registry); |
| async readManifest(dir: string, priorityRegistry?: RegistryNames, isRoot?: boolean = false): Promise<Manifest> { | ||
| const manifest = await this.maybeReadManifest(dir, priorityRegistry, isRoot); | ||
| readManifest(dir: string, priorityRegistry?: RegistryNames, isRoot?: boolean = false): Promise<Manifest> { | ||
| return this.getCache(`manifest-${dir}`, async (): Promise<Manifest> => { |
There was a problem hiding this comment.
What is the reason to move getCache from maybeReadManifest here?
There was a problem hiding this comment.
yes, it's because maybeReadManifest was called few times in the same process, and the getCache there memoized "nil" return value. base-fetcher/fetch method writes the manifest between these calls, so nil was returned even after manifest was written.
moving cache to readManifest fixes the issue as getCache doesn't cache rejected promises (as opposed to resolved nil values)
There was a problem hiding this comment.
Actually this was always a bug, but didn't surface. With this PR I actually expect manifest to change (be created) across reads, so I needed to fix this.
|
@sheerun, thanks for catching this up. |
Now that we allow for installing packages without package.json, shallow integrity check will succeed if it's removed from package. I fix the test by removing installed director instead.
|
@bestander I fixed the test. It's behavior changed, as if we allow for installing packages without package.json, simply removing package.json from installed dependency is not enough to fail shallow integrity check, we need to remove whole directory, and that's what I did to fix this test. |
|
Great work, @sheerun! |
Allow for installing dependencies without manifest (yarnpkg#3624)
|
Oh wow! Thank you for that! |
|
@bestander How about support for selecting a tag from git repository by semver selector? Something like |
|
Probably
in case of git repositories, the registry is repository itself, so makes sense as it adds jquery in version 1.x from "jquery/jquery" registry (git tags), and installs version 1.x from default "npm" registry |
|
The problem is that # is used for git hashes in git resolution logic. |
|
This probably wouldn't be an issue as hashes look much different than semver. In Bower there's simple check for hash (4+ more word characters), and nobody had any issues: https://github.com/bower/bower/blob/master/lib/core/resolvers/GitResolver.js#L178 |
|
@sheerun, that would be really great to have this feature. |
|
@bestander There was some change since my PRs on master branch, and now yarn add bestander/chrome-app-livereload fails with: An unexpected error occurred: "https://github.com/bestander/chrome-app-livereload.git: Request failed "406 Not Acceptable"". |
|
@sheerun, there were not that many changes since the merge and latest CI build shows the tests passing https://circleci.com/gh/yarnpkg/yarn/4198 |
|
@sheerun, looks like the tests at |
|
Yeah I was surprised these tests weren't e2e |
|
@bestander @andreypopp Thanks to this patch bower-away can work: https://twitter.com/bower/status/914828104727703553 :) |
|
Thanks for sharing, @sheerun! |
This is continuation of #2651. Changes:
.gitextension won't get into waypackage.json, store default manifest in .yarn-metadata.json instead.Bonus: Cache normalized
package.jsonin in .yarn-metadata.json, so installs should get faster.foobar@https://github.com/foo/bar.gitfile:resolver as wellyarn checkso it allows for no package.json in installed dependenciesAny comments?