* The `_upgrade` method guarantees that the contents of the manifest are * allowed to drift in a SemVer compatible manner. It ensures that CI is * always running against the latest versions of all dependencies. * * @private * @method _upgrade * @param {String} label The label for t
(label, type)
| 533 | * @param {String} type The type of package cache. |
| 534 | */ |
| 535 | _upgrade(label, type) { |
| 536 | // Lock out upgrade calls after the first time upgrading the cache. |
| 537 | if (upgraded[label]) { |
| 538 | return; |
| 539 | } |
| 540 | |
| 541 | if (!this._canUpgrade(label, type)) { |
| 542 | // Only way to get repeatable behavior in npm: start over. |
| 543 | // We turn an `_upgrade` task into an `_install` task. |
| 544 | fs.removeSync(path.join(this.dirs[label], translate(type, 'path'))); |
| 545 | return this._install(label, type); |
| 546 | } |
| 547 | |
| 548 | this._removeLinks(label, type); |
| 549 | commands[type].invoke(translate(type, 'upgrade'), { cwd: this.dirs[label] }); |
| 550 | this._restoreLinks(label, type); |
| 551 | |
| 552 | upgraded[label] = true; |
| 553 | } |
| 554 | |
| 555 | _canUpgrade(label, type) { |
| 556 | return type === 'yarn' && fs.existsSync(path.join(this.dirs[label], 'yarn.lock')); |
no test coverage detected