Skip to content

Commit 27a50eb

Browse files
ntwbAhmad Awais ⚑️
authored andcommitted
πŸ‘Œ IMPROVE: Install via npx (#13)
* βœ… Drop Step 1 * πŸ‘Œ IMPROVE: Install via npx Install via `npx` to always use the latest `create-guten-block` toolkit.
1 parent 6afedf3 commit 27a50eb

1 file changed

Lines changed: 27 additions & 28 deletions

File tree

β€ŽREADME.mdβ€Ž

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,24 @@ Create Guten Block is not like other [starter-kits](https://github.com/ahmadawai
4747

4848
## GETTING STARTED!
4949

50-
It's really easy to get started with `create-guten-block`. Just install it as a global module and run it to create your next-gen Gutenberg block plugin for WordPress.
50+
Let's create a WordPress block plugin...
51+
52+
#### ⚑️ Quick Overview
53+
54+
Run step `#1` and `#2` quickly in one go β€” Run inside local WP install E.g. `/wp.local/wp-content/plugins/` directory.
55+
```sh
56+
npx create-guten-block my-block
57+
cd my-block
58+
npm start
59+
```
60+
([npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) comes with npm 5.2+ and higher, see [instructions for older npm versions](https://gist.github.com/ahmadawais/e4c69b22561c7079c9d99faba90e3b23))
61+
62+
63+
> πŸŽ› _If you want to study the detailed installation of step `#1` and `#2` β€” then take a look at the steps below_.
5164
52-
_Let's get you started!_
5365

5466
<details>
55-
<summary><strong> STEP #0</strong> β€” If you don't have <code>Node.js</code> + <code>npm</code> installed then read this. (CLICK TO EXPAND!)</summary>
67+
<summary><strong> STEP #0</strong> β€” Don't have <code>Node.js</code> + <code>npm</code> installed? Read this. (CLICK TO EXPAND!)</summary>
5668

5769
In case you are an absolute beginner to the world of `Node.js`, JavaScript, and `npm` packages β€” all you need to do is go to the Node's site [download + install](https://nodejs.org/en/download/) Node on your system. This will install both `Node.js` and `npm`, i.e., node package manager β€” the command line interface of Node.js.
5870

@@ -70,29 +82,21 @@ npm -v
7082

7183
### β†’ STEP #1
7284

73-
Install `create-guten-block` globally on your system.
85+
All you have to do is run the following command and it will create a WordPress block plugin. It's done by installing and running the `create-guten-block` command and providing it with a unique name for a WordPress plugin that will get created.
7486

75-
You’ll need to have Node >= 8 on your local development machine (but it’s not required on the server). You can use [nvm](https://github.com/creationix/nvm#installation) (macOS/Linux) or [nvm-windows](https://github.com/coreybutler/nvm-windows#node-version-manager-nvm-for-windows) to easily switch Node versions between different projects.
7687

88+
> ⚠️ Make sure run this command in your local WordPress install's plugins folder i.e. `/local_dev_site.tld/wp-content/plugins/` folder β€” since this command will produce a WordPress plugin that you can go to `WP Admin` β–ΆοΈŽ `Plugins` to activate.
7789
7890
```sh
79-
npm install create-guten-block --global
91+
npx create-guten-block my-block
8092
```
93+
([npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) comes with npm 5.2+ and higher, see [instructions for older npm versions](https://gist.github.com/ahmadawais/e4c69b22561c7079c9d99faba90e3b23))
8194

82-
![install cgb](http://on.ahmda.ws/orvI/c)
95+
![npx block](http://on.ahmda.ws/p89T/c)
8396

8497
_It'll take a couple of minutes to install._
8598

86-
### β†’ STEP #2
87-
88-
Now all you have to do is create a gutenberg block and start building. It's done by running the `create-guten-block` command and providing it with a unique name for a WordPress plugin that will get created.
89-
90-
> ⚠️ Make sure run this command in your local WordPress install's plugins folder i.e. `/local_dev_site.tld/wp-content/plugins/` folder β€” since this command will produce a WordPress plugin that you can go to `WP Admin` β–ΆοΈŽ `Plugins` to activate.
91-
92-
```sh
93-
create-guten-block my-block
94-
```
95-
![cgb block](http://on.ahmda.ws/osOD/c)
99+
>You’ll need to have Node >= 8 and npm >= 5.3 on your local development machine (but it’s not required on the server). You can use [nvm](https://github.com/creationix/nvm#installation) (macOS/Linux) or [nvm-windows](https://github.com/coreybutler/nvm-windows#node-version-manager-nvm-for-windows) to easily switch Node versions between different projects.
96100
97101
It will create a directory called `my-block` inside the current folder.
98102
Inside that directory, it will generate the initial project structure and install the transitive dependencies:
@@ -121,7 +125,7 @@ INSIDE: /local_dev_site.tld/wp-content/plugins/my-block
121125
```
122126
No configuration or complicated folder structures, just the files you need to build your app.
123127

124-
### β†’ STEP #3
128+
### β†’ STEP #2
125129

126130
Once the installation is done, you can open your project folder and run the start script.
127131

@@ -131,7 +135,7 @@ _Let's do that._
131135
cd my-block
132136
npm start
133137
```
134-
_You can also use `yarn start` if that's your jam_
138+
_You can also use `yarn start` if that's your jam_.
135139

136140
![cgb-npm-start](http://on.ahmda.ws/orrh/c)
137141

@@ -214,8 +218,7 @@ Well, it's really hard to configure things like webpack, React, ES 6/7/8/Next, E
214218
215219
Open the terminal app and run the following commands.
216220

217-
- βœ… **Install/Update**: `npm install create-guten-block --global`
218-
- πŸ”° **Create**: `create-guten-block my-block` β€” Run inside local WP install E.g. `/wp.local/wp-content/plugins/` directory.
221+
- πŸ”° **Install/Create**: `npx create-guten-block my-block` β€” Run inside local WP install E.g. `/wp.local/wp-content/plugins/` directory.
219222
- πŸ“‚ **Browse**: `cd my-block` β€” Open the newly created plugin directory.
220223
- ♻️ **Run**: `npm start` β€” For development.
221224
- πŸ“¦ **Run**: `npm run build` β€” For production build.
@@ -234,14 +237,10 @@ If something doesn’t work, kindly file [an issue β†’](https://github.com/ahmad
234237

235238
Create Guten Block is divided into two packages:
236239

237-
1. **`create-guten-block`** is a global command-line utility that you use to create new WP Gutenberg plugins.
240+
1. **`create-guten-block`** is a command-line utility that you use to create new WP Gutenberg plugins.
238241
1. **`cgb-scripts`** is a development dependency in the generated plugin projects.
239242

240-
You almost never need to update `create-guten-block` itself: it delegates all the setup to `cgb-scripts`. But as this project matures, there might be a few changes over time and you can re-run the global install.
241-
242-
```js
243-
npm install create-guten-block --global
244-
```
243+
You never need to update `create-guten-block` itself as it's run via [`npx`](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) and it delegates all the setup to `cgb-scripts`.
245244

246245
When you run `create-guten-block`, it always creates the project with the latest version of `cgb-scripts` so you’ll get all the new features and improvements in newly created plugins automatically.
247246

@@ -335,4 +334,4 @@ This FOSS (free and open source software) project is updated and maintained with
335334
336335
MIT Β© [Ahmad Awais](https://AhmadAwais.com/).
337336
338-
This project is inspired by the work of more people than I could mention here. But thank you, [Dan Abramov](https://twitter.com/dan_abramov) for Create React App, [Andrew Clark](https://twitter.com/acdlite), and [Christopher Chedeau](https://twitter.com/vjeux), [Sophie Alpert](https://twitter.com/sophiebits) from React.js team, [Wes Bos](https://twitter.com/wesbos) for awesome courses for [React](https://ReactForBeginners.com/friend/AHMADAWAIS), [ES6](https://ES6.io/friend/AHMADAWAIS), and [Node](https://LearnNode.com/friend/AHMADAWAIS) beginners. [Kent C. Dodds](https://twitter.com/kentcdodds) for his open source evangelism, WordPress Core Contributors, [Gary](https://twitter.com/GaryPendergast) for keeping everyone sane, [Gutenberg](http://github.com/wordpress/gutenberg) developers [Matias](https://twitter.com/matias_ventura), [Riad](https://github.com/youknowriad), [Andrew](https://github.com/aduth), [Ella](https://twitter.com/ellaiseulde), [Joen](https://github.com/jasmussen), [Tammie](https://twitter.com/karmatosed), [Greg](https://twitter.com/gziolo) and contributors, and other WordPress community members like [Zac](https://twitter.com/zgordon) for his [course on Gutenberg](https://ahmda.ws/ZacGutenbergCourse), and also my friend [Morten](https://twitter.com/mor10) for all the #Guten-motivation, [Icons8](https://icons8.com/) for the awesome icons, [Maedah](https://twitter.com/MaedahBatool/) for managing this project, and to everyone I forgot.
337+
This project is inspired by the work of more people than I could mention here. But thank you, [Dan Abramov](https://twitter.com/dan_abramov) for Create React App, [Andrew Clark](https://twitter.com/acdlite), and [Christopher Chedeau](https://twitter.com/vjeux), [Sophie Alpert](https://twitter.com/sophiebits) from React.js team, [Wes Bos](https://twitter.com/wesbos) for awesome courses for [React](https://ReactForBeginners.com/friend/AHMADAWAIS), [ES6](https://ES6.io/friend/AHMADAWAIS), and [Node](https://LearnNode.com/friend/AHMADAWAIS) beginners. [Kent C. Dodds](https://twitter.com/kentcdodds) for his open source evangelism, WordPress Core Contributors, [Gary](https://twitter.com/GaryPendergast) for keeping everyone sane, [Gutenberg](http://github.com/wordpress/gutenberg) developers [Matias](https://twitter.com/matias_ventura), [Riad](https://github.com/youknowriad), [Andrew](https://github.com/aduth), [Ella](https://twitter.com/ellaiseulde), [Joen](https://github.com/jasmussen), [Tammie](https://twitter.com/karmatosed), [Greg](https://twitter.com/gziolo) and contributors, and other WordPress community members like [Zac](https://twitter.com/zgordon) for his [course on Gutenberg](https://ahmda.ws/ZacGutenbergCourse), and also my friend [Morten](https://twitter.com/mor10) for all the #Guten-motivation, [Icons8](https://icons8.com/) for the awesome icons, [Maedah](https://twitter.com/MaedahBatool/) for managing this project, and to everyone I forgot.

0 commit comments

Comments
Β (0)