-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.ts
34 lines (26 loc) · 863 Bytes
/
cli.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import sade from 'sade';
import { AsyncSeriesWaterfallHook, SyncWaterfallHook } from 'tapable';
import configureCommands from './commands';
import { registerHooks } from './utils/hooks';
const app = sade('gdu').option('--debug', 'Enable debug mode');
configureCommands(app);
export default (argv: string[]) => {
// -- SetupHooks
// Transpilation Related Hooks
registerHooks({
webpackConfig: new SyncWaterfallHook(['config']),
babelConfig: new SyncWaterfallHook(['config']),
});
// Server Hooks
registerHooks({
beforeServer: new AsyncSeriesWaterfallHook(['server']),
afterServer: new AsyncSeriesWaterfallHook(['server']),
});
// TODO: Move these hooks to next js something
// NextJS Hooks
registerHooks({
nextJSPrepare: new AsyncSeriesWaterfallHook(['app']),
nextJSConfig: new SyncWaterfallHook(['config']),
});
app.parse(argv);
};