Skip to content

Commit 2e1218c

Browse files
author
Ahmad Awais
committed
📦 NEW: Commander.js
1 parent f638250 commit 2e1218c

4 files changed

Lines changed: 67 additions & 27 deletions

File tree

‎packages/create-guten-block/README.md‎

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,39 @@
1-
# Create-Guten-Block
1+
<img width="300" src="http://on.ahmda.ws/osSb/c" alt="CGB Create Guten Block by Ahmad Awais">
22

3-
This package includes the global command for [Create Guten Block](https://github.com/ahmadawais/create-guten-block).<br>
3+
<br>
44

5-
Create-Guten-Block is a zero configuration dev-toolkit through which you can start developing WordPress Gutenberg block in a matter of minutes. It's not like other starter-kits or boilerplates. It's a versioned, updateable, sane-defaults CLI utility which is constantly updated.
5+
<img src="http://on.ahmda.ws/orxb/c" alt="Create Guten Block">
6+
7+
<br>
8+
9+
<table width='100%' align="center">
10+
<tr>
11+
<td align='left' width='100%' colspan='2'>
12+
<strong><code>create-guten-block</code></strong><br />
13+
A zero-configuration developer toolkit for building WordPress Gutenberg block plugins.
14+
</td>
15+
</tr>
16+
<tr>
17+
<td>
18+
A FOSS (Free & Open Source Software) project developed by <a href='https://github.com/ahmadawais'>Ahmad Awais</a>.
19+
</td>
20+
<td align='center'>
21+
<a href='https://AhmadAwais.com/'>
22+
<img src='https://i.imgur.com/Asg4d3k.png' width='100' />
23+
</a>
24+
</td>
25+
</tr>
26+
<tr><td><sup> Follow Ahmad's #FOSS work on GitHub <a href='https://github.com/ahmadawais'>@AhmadAwais</a> — Say Hi on Twitter <a href="https://twitter.com/mrahmadawais/">@MrAhmadAwais</a></sup></td><td align='center'>👋</td></tr>
27+
</table>
28+
<br>
29+
30+
# 📦 `create-guten-block`
31+
32+
>`create-guten-block` is _zero configuration dev-toolkit_ (#0CJS) to develop WordPress Gutenberg blocks in a matter of minutes without configuring `React`, `Webpack`, `ES6/7/8/Next`, `ESLint`, `Babel`, etc.
33+
34+
👉 This package includes the global command for [Create Guten Block](https://github.com/ahmadawais/create-guten-block).
35+
36+
<br>
37+
38+
👉 Kindly, read the up to date documentation at this link → [Create Guten Block](https://github.com/ahmadawais/create-guten-block)
639

7-
Kindly, read the up to date documentation at this link → [Create Guten Block](https://github.com/ahmadawais/create-guten-block)

‎packages/create-guten-block/createGutenBlock.js‎

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,35 @@
11
#!/usr/bin/env node
22
// create-guten-block CLI!
3+
4+
'use strict';
5+
36
const ora = require( 'ora' );
47
const path = require( 'path' );
58
const chalk = require( 'chalk' );
69
const fs = require( 'fs-extra' );
710
const execa = require( 'execa' );
811
const shell = require( 'shelljs' );
12+
const commander = require( 'commander' );
913
const directoryExists = require( 'directory-exists' );
14+
const packageJson = require( './package.json' );
15+
16+
// The Project name we're building.
17+
let projectName;
18+
19+
// Commander.js program.
20+
const program = new commander.Command( packageJson.name )
21+
.version( packageJson.version, '-v, --version' )
22+
.arguments( '<block-name>' )
23+
.usage( `${ chalk.green( '<block-name>' ) }` )
24+
.action( name => {
25+
projectName = name;
26+
} )
27+
.allowUnknownOption()
28+
.on( '--help', () => {
29+
console.log( ` Only ${ chalk.green( '<block-name>' ) } is required.` );
30+
console.log();
31+
} )
32+
.parse( process.argv );
1033

1134
// Makes the script crash on unhandled rejections instead of silently
1235
// ignoring them. In the future, promise rejections that are not handled will
@@ -256,8 +279,7 @@ clearConsole();
256279

257280
// Update notifier.
258281
const updateNotifier = require( 'update-notifier' );
259-
const pkg = require( './package.json' );
260-
updateNotifier( { pkg } ).notify();
282+
updateNotifier( { packageJson } ).notify();
261283

262284
// Run the CLI.
263285
run();

‎packages/create-guten-block/package-lock.json‎

Lines changed: 6 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/create-guten-block/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"homepage": "https://github.com/ahmadawais/create-guten-block#readme",
2121
"dependencies": {
2222
"chalk": "^2.3.0",
23+
"commander": "^2.13.0",
2324
"directory-exists": "^1.0.2",
2425
"execa": "^0.9.0",
2526
"fs-extra": "^5.0.0",

0 commit comments

Comments
 (0)