@@ -12,6 +12,8 @@ import * as path from 'path';
12
12
import ConfigManager , { Config , IConfigManager } from '../config-manager' ;
13
13
import ConfigManagerProxy from '../config-manager/config-manager-proxy' ;
14
14
import { ConfigQuestionnaire , QuestionnaireSubscriber } from '../config-wizard' ;
15
+ import { DependenciesSubscriber } from '../dependencies-manager' ;
16
+ import { DependenciesManifest } from '../dependencies-manager/dependencies-installer' ;
15
17
import { TaskSubscriber } from '../task-manager' ;
16
18
import Logger , { ILogger } from '../util/logger' ;
17
19
import { AnyFunction , AnyObject , getPrefix , isObject } from '../util/utility-functions' ;
@@ -23,6 +25,7 @@ export interface InstallableObject {
23
25
taskFn : AnyFunction ;
24
26
hook : string ;
25
27
name : string ;
28
+ dependencies ?: DependenciesManifest ;
26
29
description ?: string ;
27
30
configDefaults ?: Config ;
28
31
configQuestionnaire ?: ConfigQuestionnaire ;
@@ -81,7 +84,7 @@ export async function getUtilitiesProvider(name: string): Promise<PluginProvider
81
84
// TODO: Will have to make ConfigManager a Singleton
82
85
const configManager : IConfigManager = await ConfigManager ( ) ;
83
86
// Create logger instance with plugin's name as the channel
84
- const logger : ILogger = Logger . getInstance ( ) ( name ) ;
87
+ const logger : ILogger = Logger . getInstance ( ) ( `task ${ chalk . hex ( '#7AC0DA' ) ( name ) } ` ) ;
85
88
86
89
// Instantiate a config manager proxy with access to the plugin's configuration
87
90
const config : IConfigManager = ConfigManagerProxy ( configManager , getPrefix ( name ) ) ;
@@ -145,6 +148,7 @@ export async function provideUtilities(taskFn: AnyFunction, name: string): Promi
145
148
* Installable plugin factory
146
149
* @param configDefaults Configuration defaults object
147
150
* @param configQuestionnaire Configuration questionnaire object
151
+ * @param dependencies Dependencies manifest object
148
152
* @param description Task description
149
153
* @param hook Task registration hook
150
154
* @param name Task name
@@ -162,6 +166,7 @@ function Installable(plugin: Plugin | InstallableObject): Plugin {
162
166
const {
163
167
configDefaults,
164
168
configQuestionnaire,
169
+ dependencies,
165
170
description,
166
171
hook,
167
172
name,
@@ -186,10 +191,12 @@ function Installable(plugin: Plugin | InstallableObject): Plugin {
186
191
* Task plugin installer function
187
192
* @param taskSubscribers Hook subscribers object
188
193
* @param configSubscriber Configuration questionnaire subscriber
194
+ * @param dependenciesSubscriber Dependencies installer subscriber
189
195
*/
190
196
async function install (
191
197
taskSubscribers : TaskSubscriber ,
192
198
configSubscriber : QuestionnaireSubscriber ,
199
+ dependenciesSubscriber : DependenciesSubscriber ,
193
200
) : Promise < void > {
194
201
// Register Gulp task
195
202
gulp . task ( name , await provideUtilities ( taskFn , name ) ) ;
@@ -203,6 +210,11 @@ function Installable(plugin: Plugin | InstallableObject): Plugin {
203
210
) {
204
211
await configSubscriber ( configDefaults , configQuestionnaire ) ;
205
212
}
213
+
214
+ // Register plugin dependencies, if available
215
+ if ( typeof dependencies !== 'undefined' ) {
216
+ await dependenciesSubscriber ( dependencies , name ) ;
217
+ }
206
218
}
207
219
208
220
0 commit comments