Skip to content

Commit 5ec0354

Browse files
author
Ovidiu Barabula
committed
feat(core): add deps manager instance and pass to plugin manager
1 parent c5bcf5c commit 5ec0354

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

src/core.ts

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88
import ConfigManager, { IConfigManager } from './config-manager';
99
import ConfigManagerProxy from './config-manager/config-manager-proxy';
1010
import ConfigWizard from './config-wizard';
11+
import depsManager from './dependencies-manager';
1112
import PluginManager, { PluginManager as IPluginManager } from './plugin-manager';
1213
import TaskManager from './task-manager';
13-
import taskInitProject from './tasks/task-init-project';
14+
import tasks from './tasks';
1415
import Logger, { ILogger } from './util/logger';
1516

17+
18+
// Task Manager configuration
1619
const taskManagerConfig = {
20+
// Task hooks
1721
hooks: [
1822
'init',
1923
'config',
@@ -25,16 +29,22 @@ const taskManagerConfig = {
2529
],
2630
};
2731

28-
let internalPlugins = [
29-
taskInitProject,
30-
];
32+
// Internal plugins list
33+
let internalPlugins = [...tasks];
3134

3235
/* test:start */
3336
// Stop internal plugin loading in TEST environment
3437
internalPlugins = [];
3538
/* test:end */
3639

3740

41+
// Custom messages
42+
const MESSAGES = {
43+
INIT_COMPLETE: 'Components initialized.',
44+
INIT_COMPONENTS: 'Initializing components\u2026',
45+
};
46+
47+
3848
/**
3949
* Get list of plugins from init config and register them
4050
*/
@@ -49,13 +59,21 @@ export async function loadConfigPlugins(configManager: IConfigManager, pluginMan
4959
*/
5060
async function Frontvue() {
5161
const name = 'frontvue';
62+
63+
// Get logger constructor
5264
const logger = Logger.getInstance();
65+
// Create core logger instance and output message
66+
const coreLogger = logger('core');
67+
coreLogger.info(MESSAGES.INIT_COMPONENTS);
68+
69+
// Instatiate components
5370
const configManager = await ConfigManager(name);
5471
const configWizard = ConfigWizard(configManager);
5572
const taskManager = TaskManager(taskManagerConfig);
56-
const pluginManager = PluginManager(taskManager, configWizard);
73+
const pluginManager = PluginManager(taskManager, configWizard, depsManager);
5774
const { run } = taskManager;
5875

76+
5977
// Use internal plugin(s)
6078
await pluginManager.use(...internalPlugins);
6179

@@ -67,10 +85,18 @@ async function Frontvue() {
6785
/* test:end */
6886
await loadExternalPlugins(configManager, pluginManager);
6987

88+
89+
// Output component instatiation complete message
90+
coreLogger.debug(MESSAGES.INIT_COMPLETE);
91+
92+
7093
// Return public API
7194
return Object.freeze({
95+
// Named logger constructor
7296
logger,
97+
// Name of the app
7398
name,
99+
// TaskManager's run tasks method
74100
run,
75101
});
76102
}

0 commit comments

Comments
 (0)