Ensure files get purged when they should (#5054)

This commit is contained in:
Joe Haddad
2018-09-21 09:56:45 -04:00
committed by GitHub
parent 74c4baebf2
commit 0cfe758f27
4 changed files with 62 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
module.exports = function getCacheIdentifier(environment, packages) {
let cacheIdentifier = `${environment}`;
for (const packageName of packages) {
cacheIdentifier += `:${packageName}@`;
try {
cacheIdentifier += require(`${packageName}/package.json`).version;
} catch (_) {
// ignored
}
}
return cacheIdentifier;
};