Skip to content

Commit 52986be

Browse files
committed
Use different folders with integrity or without (#7586)
* Uses a different folder for pkgs with integrity or without * Fixes for when integrity is an object instance * Stores whether integrity exists or not * Updates a lockfile to reference the integrity * Fixes resolver check * Fixes cache pattern
1 parent c3d256f commit 52986be

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

__tests__/fixtures/install/install-production/yarn.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
is-array@^1.0.1:
66
version "1.0.1"
77
resolved "https://registry.yarnpkg.com/is-array/-/is-array-1.0.1.tgz#e9850cc2cc860c3bc0977e84ccf0dd464584279a"
8+
integrity sha1-6YUMwsyGDDvAl36EzPDdRkWEJ5o=
89

910
left-pad@^1.1.3:
1011
version "1.1.3"
1112
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.1.3.tgz#612f61c033f3a9e08e939f1caebeea41b6f3199a"
13+
integrity sha1-YS9hwDPzqeCOk58crr7qQbbzGZo=

__tests__/package-resolver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000;
1414
const path = require('path');
1515

1616
// regexp which verifies that the cache path contains a path component ending with semver + hash
17-
const cachePathRe = /-\d+\.\d+\.\d+-[\dabcdef]{40}[\\\/]/;
17+
const cachePathRe = /-\d+\.\d+\.\d+-[\dabcdef]{40}(?:-integrity)?[\\\/]/;
1818

1919
async function createEnv(configOptions): Object {
2020
const lockfile = new Lockfile();

src/config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {registries, registryNames} from './registries/index.js';
1717
import {NoopReporter} from './reporters/index.js';
1818
import map from './util/map.js';
1919

20+
const crypto = require('crypto');
2021
const detectIndent = require('detect-indent');
2122
const invariant = require('invariant');
2223
const path = require('path');
@@ -520,6 +521,10 @@ export default class Config {
520521
slug += `-${hash}`;
521522
}
522523

524+
if (pkg.remote.integrity) {
525+
slug += `-integrity`;
526+
}
527+
523528
return slug;
524529
}
525530

0 commit comments

Comments
 (0)