MCPcopy Create free account
hub / github.com/ember-cli/ember-cli / reloadPkg

Method reloadPkg

lib/models/project.js:566–584  ·  view source on GitHub ↗

Reloads package.json of the project. Clears and reloads the packageInfo and per-bundle addon cache, too. @private @method reloadPkg @return {Object} Package content

()

Source from the content-addressed store, hash-verified

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.

Callers 2

reloadAddonsMethod · 0.95
project-test.jsFile · 0.80

Calls 3

reloadProjectsMethod · 0.80
loadProjectMethod · 0.80
isEnabledMethod · 0.80

Tested by

no test coverage detected