Skip to content

Commit d1a026f

Browse files
author
Ovidiu Barabula
committed
feat(core): decorate plugin task function and output task duration
1 parent 0f36826 commit d1a026f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/plugin-manager/installable.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
* @since 0.1.0
66
*/
77

8+
import chalk from 'chalk';
89
import * as gulp from 'gulp';
9-
import { Config } from '../config-manager';
10+
import ConfigManager, { Config } from '../config-manager';
11+
import ConfigManagerProxy from '../config-manager/config-manager-proxy';
1012
import { ConfigQuestionnaire, QuestionnaireSubscriber } from '../config-wizard';
1113
import { TaskSubscriber } from '../task-manager';
1214
import Logger, { ILogger } from '../util/logger';
@@ -39,7 +41,7 @@ export const ERRORS = {
3941

4042

4143
/**
42-
* Validate plugin
44+
* Check if object is an installable Plugin
4345
* @param object Plugin object to be tested
4446
*/
4547
export function isInstallable(object: {[key: string]: any}): boolean | void {
@@ -69,6 +71,8 @@ export function isInstallable(object: {[key: string]: any}): boolean | void {
6971
*/
7072
export function getUtilitiesProvider(name: string): PluginProvider {
7173
const logger = Logger('frontvue')(name);
74+
// TODO: Implement config manager proxy for plugin
75+
// const config = ConfigManagerProxy();
7276

7377
return Object.freeze({
7478
logger,
@@ -85,9 +89,10 @@ export function provideUtilities(taskFn: AnyFunction, name: string): AnyFunction
8589
const provider = getUtilitiesProvider(name);
8690

8791
return async function (cb) {
88-
provider.logger.debug(`Started...`);
92+
const startTime = Date.now();
8993
await taskFn(cb, provider);
90-
provider.logger.debug(`Finished...`);
94+
const duration = (Date.now() - startTime) / 1000;
95+
provider.logger.debug(chalk.bold(`took ${duration.toFixed(1)}s`));
9196
};
9297
}
9398

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