UNPKG

523 BJavaScriptView Raw
1/**
2 * Handle if there's block name is not valid.
3 */
4
5'use strict';
6
7const chalk = require( 'chalk' );
8
9module.exports = () => {
10 // Stop if given block name is not valid.
11 console.log(
12 '\n❌ ',
13 chalk.black.bgRed( ' Please provide a valid block name: \n' )
14 );
15 console.log(
16 `${ chalk.dim(
17 '⚠️ A block name can only contain lowercase alphanumeric characters and dashes.'
18 ) }`
19 );
20 console.log( `${ chalk.dim( '⚠️ A block name must begin with a letter.' ) }` );
21 console.log();
22 process.exit( 1 );
23};