Skip to content

Commit

Permalink
revert: loadUnit.name (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
atian25 committed Jul 12, 2018
1 parent 1ec8218 commit 908d88c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
5 changes: 1 addition & 4 deletions lib/loader/egg_loader.js
Expand Up @@ -263,6 +263,7 @@ class EggLoader {
assert(proto.hasOwnProperty(Symbol.for('egg#eggPath')), 'Symbol.for(\'egg#eggPath\') is required on Application');
const eggPath = proto[Symbol.for('egg#eggPath')];
assert(eggPath && typeof eggPath === 'string', 'Symbol.for(\'egg#eggPath\') should be string');
assert(fs.existsSync(eggPath), `${eggPath} not exists`);
const realpath = fs.realpathSync(eggPath);
if (!eggPaths.includes(realpath)) {
eggPaths.unshift(realpath);
Expand Down Expand Up @@ -339,26 +340,22 @@ class EggLoader {
dirs.push({
path: plugin.path,
type: 'plugin',
name: plugin.name,
});
}
}

// framework or egg path
for (const eggPath of this.eggPaths) {
const frameworkInfo = require(path.join(eggPath, 'package.json'));
dirs.push({
path: eggPath,
type: 'framework',
name: frameworkInfo.name,
});
}

// application
dirs.push({
path: this.options.baseDir,
type: 'app',
name: this.pkg.name,
});

debug('Loaded dirs %j', dirs);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -68,7 +68,7 @@
},
"files": [
"index.js",
"index.d.ts",
"lib"
"lib",
"index.d.ts"
]
}
4 changes: 0 additions & 4 deletions test/loader/get_load_units.test.js
Expand Up @@ -16,14 +16,10 @@ describe('test/get_load_units.test.js', function() {
delete app.loader.dirs;
const units = app.loader.getLoadUnits();
assert(units.length === 12);
assert(units[2].type === 'plugin');
assert(units[2].name === 'package');
assert(units[10].type === 'framework');
assert(units[10].path === utils.getFilepath('egg'));
assert(units[10].name === 'egg');
assert(units[11].type === 'app');
assert(units[11].path === utils.getFilepath('plugin'));
assert(units[11].name === 'plugin');
});

it('should not get plugin dir', function() {
Expand Down

0 comments on commit 908d88c

Please sign in to comment.