Skip to content

Commit 65ac477

Browse files
author
Ovidiu Barabula
committed
feat(core): implement plugin manager in frontvue instance
1 parent 2ad0313 commit 65ac477

File tree

2 files changed

+34
-7
lines changed

2 files changed

+34
-7
lines changed

src/core.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { expect } from 'chai';
22
import 'mocha';
3+
import frontvue from './core';
34

45
describe('Frontvue', () => {
5-
it('instantiates');
6+
it('instantiates', async () => {
7+
const instance = await frontvue;
8+
expect(instance).to.be.an('object');
9+
});
610
});

src/core.ts

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,34 @@
55
* @since 0.1.0
66
*/
77

8-
import ConfigManagerFactory from './config-manager/index';
9-
import TaskManager from './task-manager/index';
8+
import ConfigManager from './config-manager';
9+
import PluginManager from './plugin-manager';
10+
import TaskManager from './task-manager';
11+
import taskInitProject from './tasks/task-init-project';
1012

11-
(async function frontvue() {
13+
14+
/**
15+
* Main Frontvue constructor
16+
*/
17+
async function Frontvue() {
1218
const name = 'frontvue';
13-
const configManager = await ConfigManagerFactory(name);
14-
const taskManager = TaskManager();
15-
}());
19+
const configManager = await ConfigManager(name);
20+
const taskManager = TaskManager({
21+
hooks: [
22+
'init',
23+
],
24+
});
25+
const pluginManager = PluginManager(taskManager);
26+
const { run } = taskManager;
27+
28+
// Use custom plugin
29+
pluginManager.use(taskInitProject);
30+
31+
// Return public API
32+
return Object.freeze({
33+
name,
34+
run,
35+
});
36+
}
37+
38+
export default Frontvue();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy