Skip to content

Commit

Permalink
improve read-file
Browse files Browse the repository at this point in the history
  • Loading branch information
runspired committed Nov 26, 2019
1 parent 77e97f5 commit 0952f7c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bin/-tarball-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,11 @@ function generatePackageReference(version, tarballName) {
function insertTarballsToPackageJson(fileLocation, options = {}) {
// in some flows we have the potential to have previously written
// to the package.json already prior to calling this method.
// this ensures we get the latest and not a stale module
// reading it in this way this ensures we get the latest and not
// a stale module from require
const location = require.resolve(fileLocation);
delete require.cache[location];
const pkgInfo = require(location);
const pkgInfo = JSON.parse(fs.readFileSync(location, 'utf8'));

if (options.isRelativeTarball) {
pkgInfo.version = `${pkgInfo.version}-sha.${CurrentSha}`;
}
Expand Down

0 comments on commit 0952f7c

Please sign in to comment.