1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | 'use strict';
|
8 |
|
9 | const ora = require( 'ora' );
|
10 | const chalk = require( 'chalk' );
|
11 | const cli = require( './cli' );
|
12 | const prePrint = require( './prePrint' );
|
13 | const initBlock = require( './initBlock' );
|
14 | const getBlockDir = require( './getBlockDir' );
|
15 | const clearConsole = require( './consoleClear' );
|
16 | const updateNotifier = require( './updateNotifier' );
|
17 | const createPluginDir = require( './createPluginDir' );
|
18 | const npmInstallScripts = require( './npmInstallScripts' );
|
19 |
|
20 | module.exports = async() => {
|
21 | clearConsole();
|
22 |
|
23 |
|
24 | updateNotifier();
|
25 |
|
26 |
|
27 | const blockName = cli();
|
28 |
|
29 |
|
30 | const blockDir = await getBlockDir( blockName );
|
31 |
|
32 |
|
33 | await prePrint( blockName, blockDir );
|
34 |
|
35 |
|
36 |
|
37 | const spinner = ora( { text: '' } );
|
38 |
|
39 | spinner.start(
|
40 | `1. Creating the plugin directory called → ${ chalk.black.bgWhite(
|
41 | ` ${ blockName } `
|
42 | ) }`
|
43 | );
|
44 | await createPluginDir( blockName, blockDir );
|
45 | spinner.succeed();
|
46 |
|
47 |
|
48 | spinner.start( '2. Installing npm packages...' );
|
49 | await npmInstallScripts( blockName, blockDir );
|
50 | spinner.succeed();
|
51 |
|
52 |
|
53 | await initBlock( blockName, blockDir );
|
54 | };
|