Skip to content

Commit

Permalink
Use different folders with integrity or without (#7586)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
arcanis committed Sep 30, 2019
1 parent 809fb48 commit 25d5526
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions __tests__/fixtures/install/install-production/yarn.lock
Expand Up @@ -5,7 +5,9 @@
is-array@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-array/-/is-array-1.0.1.tgz#e9850cc2cc860c3bc0977e84ccf0dd464584279a"
integrity sha1-6YUMwsyGDDvAl36EzPDdRkWEJ5o=

left-pad@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.1.3.tgz#612f61c033f3a9e08e939f1caebeea41b6f3199a"
integrity sha1-YS9hwDPzqeCOk58crr7qQbbzGZo=
2 changes: 1 addition & 1 deletion __tests__/package-resolver.js
Expand Up @@ -14,7 +14,7 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000;
const path = require('path');

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

async function createEnv(configOptions): Object {
const lockfile = new Lockfile();
Expand Down
5 changes: 5 additions & 0 deletions src/config.js
Expand Up @@ -17,6 +17,7 @@ import {registries, registryNames} from './registries/index.js';
import {NoopReporter} from './reporters/index.js';
import map from './util/map.js';

const crypto = require('crypto');
const detectIndent = require('detect-indent');
const invariant = require('invariant');
const path = require('path');
Expand Down Expand Up @@ -520,6 +521,10 @@ export default class Config {
slug += `-${hash}`;
}

if (pkg.remote.integrity) {
slug += `-integrity`;
}

return slug;
}

Expand Down

0 comments on commit 25d5526

Please sign in to comment.