* The `_writeManifest` method generates the on-disk folder for the package cache * and saves the manifest into it. If it is a yarn package cache it will remove * the existing lock file. * * @private * @method _writeManifest * @param {String} label The label for the cache. * @par
(label, type, manifest)
| 318 | * @param {String} manifest The contents of the manifest file to write to disk. |
| 319 | */ |
| 320 | _writeManifest(label, type, manifest) { |
| 321 | process.chdir(this.rootPath); |
| 322 | let outputDir = quickTemp.makeOrReuse(this.dirs, label); |
| 323 | process.chdir(originalWorkingDirectory); |
| 324 | |
| 325 | this._conf.set(label, outputDir); |
| 326 | |
| 327 | let outputFile = path.join(outputDir, translate(type, 'manifest')); |
| 328 | fs.outputFileSync(outputFile, manifest); |
| 329 | |
| 330 | // Remove any existing yarn.lock file so that it doesn't try to incorrectly use it as a base. |
| 331 | if (type === 'yarn') { |
| 332 | try { |
| 333 | fs.unlinkSync(path.join(outputDir, 'yarn.lock')); |
| 334 | } catch (error) { |
| 335 | // Catch unexceptional error but rethrow if something is truly wrong. |
| 336 | if (error.code !== 'ENOENT') { |
| 337 | throw error; |
| 338 | } |
| 339 | } |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | /** |
| 344 | * The `_removeLinks` method removes from the dependencies of the manifest the |
no test coverage detected