Reloads package.json of the project. Clears and reloads the packageInfo and per-bundle addon cache, too. @private @method reloadPkg @return {Object} Package content
()
| 564 | @return {Object} Package content |
| 565 | */ |
| 566 | reloadPkg() { |
| 567 | let pkgPath = path.join(this.root, 'package.json'); |
| 568 | |
| 569 | // We use readFileSync instead of require to avoid the require cache. |
| 570 | this.pkg = fs.readJsonSync(pkgPath); |
| 571 | |
| 572 | this.packageInfoCache.reloadProjects(); |
| 573 | |
| 574 | // update `_packageInfo` after reloading projects from the `PackageInfoCache` instance |
| 575 | // if we don't do this we get into a state where `_packageInfo` is referencing the old |
| 576 | // pkginfo object that hasn't been updated/reloaded |
| 577 | this._packageInfo = this.packageInfoCache.loadProject(this); |
| 578 | |
| 579 | if (PerBundleAddonCache.isEnabled()) { |
| 580 | this.perBundleAddonCache = new PerBundleAddonCache(this); |
| 581 | } |
| 582 | |
| 583 | return this.pkg; |
| 584 | } |
| 585 | |
| 586 | /** |
| 587 | Re-initializes addons. |
no test coverage detected