5
5
// https://github.com/ProjectEvergreen/greenwood/issues/141
6
6
process . setMaxListeners ( 0 ) ;
7
7
8
- require ( 'colors' ) ;
8
+ // TODO require('colors');
9
9
10
- const chalk = require ( 'chalk' ) ;
11
10
const program = require ( 'commander' ) ;
12
11
const generateCompilation = require ( './lifecycles/compile' ) ;
13
- const runProdBuild = require ( './tasks/build' ) ;
12
+ // const runProdBuild = require('./tasks/build');
14
13
const runDevServer = require ( './tasks/develop' ) ;
15
- const ejectConfigFiles = require ( './tasks/eject' ) ;
16
- const scriptPkg = require ( '../package.json' ) ;
17
- let compilation = { } ;
18
- let cmdOption = { } ;
14
+ // const ejectConfigFiles = require('./tasks/eject');
15
+ const greenwoodPackageJson = require ( '../package.json' ) ;
16
+ // let compilation = {};
17
+ // let cmdOption = {};
19
18
let MODE = '' ;
20
19
21
- console . log ( `${ chalk . rgb ( 175 , 207 , 71 ) ( '-------------------------------------------------------' ) } ` ) ;
22
- console . log ( `${ chalk . rgb ( 175 , 207 , 71 ) ( 'Welcome to Greenwood ♻️' ) } ` ) ;
23
- console . log ( `${ chalk . rgb ( 175 , 207 , 71 ) ( '-------------------------------------------------------' ) } ` ) ;
20
+ // TODO
21
+ // console.log(`${chalk.rgb(175, 207, 71)('-------------------------------------------------------')}`);
22
+ // console.log(`${chalk.rgb(175, 207, 71)('Welcome to Greenwood ♻️')}`);
23
+ // console.log(`${chalk.rgb(175, 207, 71)('-------------------------------------------------------')}`);
24
+ console . info ( '-------------------------------------------------------' ) ;
25
+ console . info ( 'Welcome to Greenwood ♻️' ) ;
26
+ console . info ( '-------------------------------------------------------' ) ;
24
27
25
28
program
26
- . version ( scriptPkg . version )
29
+ . version ( greenwoodPackageJson . version )
27
30
. arguments ( '<script-mode>' )
28
- . usage ( `${ chalk . green ( '<script-mode>' ) } [options]` ) ;
31
+ . usage ( '<script-mode> [options]' ) ;
32
+ // TODO .usage(`${chalk.green('<script-mode>')} [options]`);
29
33
30
34
program
31
35
. command ( 'build' )
@@ -51,56 +55,62 @@ program
51
55
52
56
program . parse ( process . argv ) ;
53
57
58
+ // TODO pick build by default? Thinking of npx usage...
54
59
if ( program . parse . length === 0 ) {
55
60
program . help ( ) ;
56
61
}
57
62
58
63
const run = async ( ) => {
64
+ let compilation = { } ;
59
65
60
66
try {
61
67
62
68
switch ( MODE ) {
63
-
64
- case 'build' :
65
- compilation = await generateCompilation ( ) ;
66
69
67
- console . log ( 'Building project for production.' . yellow ) ;
70
+ // TODO
71
+ // case 'build':
72
+ // compilation = await generateCompilation();
73
+
74
+ // console.log('Building project for production.'.yellow);
68
75
69
- await runProdBuild ( compilation ) ;
76
+ // await runProdBuild(compilation);
70
77
71
- console . log ( '...................................' . yellow ) ;
72
- console . log ( 'Static site generation complete!' ) ;
73
- console . log ( '...................................' . yellow ) ;
78
+ // console.log('...................................'.yellow);
79
+ // console.log('Static site generation complete!');
80
+ // console.log('...................................'.yellow);
74
81
75
- break ;
82
+ // break;
76
83
case 'develop' :
77
84
compilation = await generateCompilation ( ) ;
85
+ // console.debug('compilation', compilation);
78
86
79
- console . log ( 'Starting local development server' . yellow ) ;
80
-
87
+ console . info ( 'Starting local development server...' ) ;
81
88
await runDevServer ( compilation ) ;
82
-
83
- console . log ( 'Development mode activiated' . green ) ;
84
89
85
90
break ;
86
- case 'eject' :
87
- console . log ( 'Ejecting configurations' . yellow ) ;
91
+ // TODO
92
+ // case 'eject':
93
+ // console.log('Ejecting configurations'.yellow);
88
94
89
- await ejectConfigFiles ( cmdOption . all ) ;
90
-
91
- console . log ( `Configurations ejected successfully to ${ process . cwd ( ) } ` . green ) ;
95
+ // await ejectConfigFiles(cmdOption.all);
96
+
97
+ // console.log(`Configurations ejected successfully to ${process.cwd()}`.green);
92
98
93
- break ;
99
+ // break;
94
100
default :
95
- console . log ( 'Error: missing command. try checking --help if you\'re encountering issues' ) ;
101
+ console . info ( `
102
+ Error: missing command. try using the --help flag if
103
+ you're encountering issues running Greenwood. Visit our docs for more
104
+ info: https://www.greenwoodjs.io/docs/
105
+ ` ) ;
96
106
break ;
97
107
98
108
}
99
109
process . exit ( 0 ) ; // eslint-disable-line no-process-exit
100
110
} catch ( err ) {
101
- console . error ( ` ${ err } ` . red ) ;
111
+ console . error ( err ) ;
102
112
process . exit ( 1 ) ; // eslint-disable-line no-process-exit
103
113
}
104
114
} ;
105
115
106
- run ( ) ;
116
+ run ( ) ;
0 commit comments