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

Prevents cache removal when running an install #7699

Merged
merged 4 commits into from Nov 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions CHANGELOG.md
Expand Up @@ -4,19 +4,22 @@ Please add one entry in this file for each change in Yarn's behavior. Use the sa

## Master

- Folders like `.cache` won't be pruned from the `node_modules` after each install.

[#7699](https://github.com/yarnpkg/yarn/pull/7699) - [**Maël Nison**](https://twitter.com/arcanis)

- Correctly installs workspace child dependencies when workspace child not symlinked to root.

[#7289](https://github.com/yarnpkg/yarn/pull/7289) - [**Daniel Tschinder**](https://github.com/danez)

- Makes running scripts with Plug'n Play possible on node 13
- Makes running scripts with Plug'n Play possible on node 13.

[#7650](https://github.com/yarnpkg/yarn/pull/7650) - [**Sander Verweij**](https://github.com/sverweij)

- Change run command to check cwd/node_modules/.bin for commands. Fixes run in workspaces.

[#7151](https://github.com/yarnpkg/yarn/pull/7151) - [**Jeff Valore**](https://twitter.com/codingwithspike)


## 1.19.1

**Important:** This release contains a cache bump. It will cause the very first install following the upgrade to take slightly more time, especially if you don't use the [Offline Mirror](https://yarnpkg.com/blog/2016/11/24/offline-mirror/) feature. After that everything will be back to normal.
Expand Down
10 changes: 10 additions & 0 deletions __tests__/commands/install/integration.js
Expand Up @@ -117,6 +117,16 @@ test('installing a package with a renamed file should not delete it', () =>
expect(await fs.exists(`${config.cwd}/node_modules/pkg/state.js`)).toEqual(true);
}));

test("installing a tree shouldn't remove preexisting cache directories", () =>
runInstall({}, 'cache-folder-nm', async (config, reporter): Promise<void> => {
expect(await fs.exists(`${config.cwd}/node_modules/.cache/hello.txt`)).toEqual(true);

const reInstall = new Install({}, config, reporter, await Lockfile.fromDirectory(config.cwd));
await reInstall.init();

expect(await fs.exists(`${config.cwd}/node_modules/.cache/hello.txt`)).toEqual(true);
}));

test("installing a new package should correctly update it, even if the files mtime didn't change", () =>
runInstall({}, 'mtime-same', async (config, reporter): Promise<void> => {
await misc.sleep(2000);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions __tests__/fixtures/install/cache-folder-nm/package.json
@@ -0,0 +1,5 @@
{
"dependencies": {
"feed": "0.3.0"
}
}
13 changes: 13 additions & 0 deletions __tests__/fixtures/install/cache-folder-nm/yarn.lock
@@ -0,0 +1,13 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


feed@0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/feed/-/feed-0.3.0.tgz#65bcc4c9c57fde8e277faf4afff80c2d1d90e82d"
dependencies:
xml ">= 0.0.5"

"xml@>= 0.0.5":
version "1.0.1"
resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"
4 changes: 4 additions & 0 deletions src/package-linker.js
Expand Up @@ -346,6 +346,10 @@ export default class PackageLinker {
for (const subfile of await fs.readdir(filepath)) {
possibleExtraneous.add(path.join(filepath, subfile));
}
} else if (file[0] === '.' && file !== '.bin') {
if (!(await fs.lstat(filepath)).isDirectory()) {
possibleExtraneous.add(filepath);
}
} else {
possibleExtraneous.add(filepath);
}
Expand Down