Berry: [Feature] Local cache files should be removed when upgrading a package

Created on 8 Aug 2019  路  8Comments  路  Source: yarnpkg/berry

Describe the user story

I'm a user; I always forget to run yarn cache clean, and I see little point to do it manually because Yarn should know that the old files aren't needed anymore after a package upgrade.

Describe the solution you'd like

Yarn should simply clean the unused cache files when it detects that new packages have been added to the project (probably not when nothing changed).

``js repro const {readdirSync} = require(fs`);

await packageJsonAndInstall({
dependencies: {
'object-assign': '3.0.0',
},
});

expect(readdirSync(.yarn/cache)).toHaveLength(2);

await packageJsonAndInstall({
dependencies: {
'object-assign': '4.0.0',
},
});

expect(readdirSync(.yarn/cache)).toHaveLength(2);

```

enhancement in progress unreproducible

Most helpful comment

We couldn't reproduce your issue (all the assertions passed on master).

All 8 comments

This issue reproduces on master:

Error: expect(received).toHaveLength(expected)

Expected length: 2
Received length: 3
Received array:  [".gitignore", "object-assign-npm-3.0.0-c4b883869c3a701bb10ead76c0aa46298e32a09f4131b9b265cd647e51f5e08c.zip", "object-assign-npm-4.0.0-006c3e1caa126e19d769614863f240982c25840c9d5311278e98cf2e726247b6.zip"]
    at module.exports (evalmachine.<anonymous>:18:36)
    at process._tickCallback (internal/process/next_tick.js:68:7)

This issue reproduces on master:

Error: expect(received).toHaveLength(expected)

Expected length: 2
Received length: 3
Received array:  [".gitignore", "object-assign-npm-3.0.0-c4b883869c.zip", "object-assign-npm-4.0.0-006c3e1caa.zip"]
    at module.exports (evalmachine.<anonymous>:18:36)
    at process._tickCallback (internal/process/next_tick.js:68:7)

We couldn't reproduce your issue (all the assertions passed on master).

Thanks @deini!

We couldn't reproduce your issue (all the assertions passed on master).

@arcanis I'm sorry for pinging on this closed issue, but I've watched your talk about actions on YouTube a few times and am super interested in how you created this action. Do you have the action somewhere you can share? I'd like to use a "special code fence" to pull out some code from a github issue as well!

@loganpowell you mean Sherlock? It's developed here: arcanis/sherlock 馃檪

@arcanis YES! 馃檹 馃檹

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thealjey picture thealjey  路  4Comments

dzintars picture dzintars  路  3Comments

juanpicado picture juanpicado  路  4Comments

bradleyayers picture bradleyayers  路  3Comments

joshmeads picture joshmeads  路  4Comments