Skip to content

Commit 7c49798

Browse files
committed
👌 IMPROVE: Format
1 parent ed59e80 commit 7c49798

1 file changed

Lines changed: 18 additions & 29 deletions

File tree

packages/create-guten-block/app/createPluginDir.js

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,34 @@
77

88
'use strict';
99

10-
const chalk = require( 'chalk' );
11-
const shell = require( 'shelljs' );
12-
const clearConsole = require( './consoleClear' );
13-
const directoryExists = require( 'directory-exists' );
14-
const createGitignore = require( './createGitignore' );
10+
const chalk = require('chalk');
11+
const shell = require('shelljs');
12+
const clearConsole = require('./consoleClear');
13+
const directoryExists = require('directory-exists');
14+
const createGitignore = require('./createGitignore');
1515

16-
module.exports = ( blockName, blockDir ) => {
16+
module.exports = (blockName, blockDir) => {
1717
// Check if the plugin dir is already presnet.
18-
const dirAlreadyExist = directoryExists.sync( `./${ blockName }` );
18+
const dirAlreadyExist = directoryExists.sync(`./${blockName}`);
1919

2020
// If exists then exit.
21-
if ( dirAlreadyExist ) {
21+
if (dirAlreadyExist) {
2222
clearConsole();
23-
console.log(
24-
'\n❌ ',
25-
chalk.black.bgRed(
26-
` A directory with this name already exists: ${ blockName } \n`
27-
)
28-
);
23+
console.log('\n❌ ', chalk.black.bgRed(` A directory with this name already exists: ${blockName} \n`));
2924

3025
console.log(
31-
` ${ chalk.dim(
32-
'Please move or delete it (maybe make a copy for backup) and run this command again.'
33-
) }`
34-
);
35-
console.log(
36-
` ${ chalk.dim( 'Or provide a different name for your block.' ) }`
37-
);
38-
console.log( chalk.dim( '\nFor example: \n' ) );
39-
console.log(
40-
` ${ chalk.dim( 'create-guten-block' ) } ${ chalk.green( 'new-block-name' ) }\n`
26+
` ${chalk.dim('Please move or delete it (maybe make a copy for backup) and run this command again.')}`
4127
);
42-
process.exit( 1 );
28+
console.log(` ${chalk.dim('Or provide a different name for your block.')}`);
29+
console.log(chalk.dim('\nFor example: \n'));
30+
console.log(` ${chalk.dim('create-guten-block')} ${chalk.green('new-block-name')}\n`);
31+
process.exit(1);
4332
} else {
44-
return new Promise( async resolve => {
33+
return new Promise(async resolve => {
4534
// Where user is at the moment.
46-
shell.mkdir( '-p', blockName );
47-
await createGitignore( blockDir );
35+
shell.mkdir('-p', blockName);
36+
await createGitignore(blockDir);
4837
resolve(true);
49-
} );
38+
});
5039
}
5140
};

0 commit comments

Comments
 (0)