3
3
4
4
var path = require ( 'path' ) ;
5
5
var diveSync = require ( 'diveSync' ) ;
6
+ const chalk = require ( 'chalk' ) ;
6
7
var engineMatcher = / ^ p a t t e r n e n g i n e - n o d e - ( .* ) $ / ;
7
8
var enginesDirectories = [
8
9
{
@@ -53,17 +54,15 @@ function findEngineModulesInDirectory(dir) {
53
54
// Try to load engines! We scan for engines at each path specified above. This
54
55
// function is kind of a big deal.
55
56
function loadAllEngines ( enginesObject ) {
56
- console . log ( '\nLoading engines...' ) ;
57
-
58
57
enginesDirectories . forEach ( function ( engineDirectory ) {
59
58
var enginesInThisDir = findEngineModulesInDirectory ( engineDirectory . path ) ;
60
- console . log ( "...scanning for engines in" , engineDirectory . displayName + " ..." ) ;
59
+ console . log ( chalk . bold ( `Loading engines from ${ engineDirectory . displayName } ...\n` ) ) ;
61
60
62
61
// find all engine-named things in this directory and try to load them,
63
62
// unless it's already been loaded.
64
63
enginesInThisDir . forEach ( function ( engineDiscovery ) {
65
64
var errorMessage ;
66
- var successMessage = "good to go" ;
65
+ var successMessage = chalk . green ( "good to go" ) ;
67
66
68
67
try {
69
68
// give it a try! load 'er up. But not if we already have, of course.
@@ -75,16 +74,17 @@ function loadAllEngines(enginesObject) {
75
74
errorMessage = err . message ;
76
75
} finally {
77
76
// report on the status of the engine, one way or another!
78
- console . log ( '-' , engineDiscovery . name , 'engine:' , errorMessage ? errorMessage : successMessage ) ;
77
+ console . log ( ` ${ engineDiscovery . name } :` , errorMessage ? chalk . red ( errorMessage ) : successMessage ) ;
79
78
}
80
79
} ) ;
80
+ console . log ( '' ) ;
81
81
} ) ;
82
82
83
83
// Complain if for some reason we haven't loaded any engines.
84
84
if ( Object . keys ( enginesObject ) . length === 0 ) {
85
85
throw new Error ( 'No engines loaded! Something is seriously wrong.' ) ;
86
86
}
87
- console . log ( '...done loading engines.\n') ;
87
+ console . log ( chalk . bold ( 'Done loading engines.\n') ) ;
88
88
}
89
89
90
90
0 commit comments