Skip to content

Commit 97948b2

Browse files
Merge pull request #943 from pattern-lab/940-simpler-readme
940 simpler readme
2 parents 8330127 + ceec673 commit 97948b2

File tree

2 files changed

+42
-33
lines changed

2 files changed

+42
-33
lines changed

README.md

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ Refer to the [core usage guidelines](https://github.com/pattern-lab/patternlab-n
2424

2525
As of Pattern Lab Node 3.0.0, installation of [Editions](http://patternlab.io/docs/advanced-ecosystem-overview.html) is accomplished via the command line interface.
2626

27-
_0 to 60mph_
28-
29-
The below assume a new directory and project is required.
27+
The below assumes a new directory and project is required. This is likely what you want to do if starting from scratch. You could also run this within an existing project. The CLI will ask you for the installation location.
3028

3129
1. Open a terminal window and following along below:
3230
```bash
@@ -36,31 +34,10 @@ The below assume a new directory and project is required.
3634
```
3735
> If you get an error stating that `npx` is not installed, ensure you are on `npm 5.2.0` or later by running `npm -v` or install it globally with `npm install -g npx`. [Learn more about npx.](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b)
3836
1. Follow the on-screen prompts to choose your Edition and a Starterkit should you want one.
39-
1. Run `npm install` one last time to ensure any transient packages from the CLI are installed.
40-
1. Open `package.json` and add the following to your `scripts` object
41-
```diff
42-
"scripts": {
43-
+ "patternlab": "patternlab"
44-
},
45-
```
46-
This tells `npm` to look in the local `node_modules/.bin` directory for the `patternlab` CLI.
47-
1. In your terminal, run `npm run patternlab <command>`, where `<command>` is a documented method on the CLI, such as `build`, `serve`, or `help`.
48-
49-
50-
_Established npm projects_
37+
- If you chose `edition-node`, new commands in the "scripts" will be added in your `package.json`.
38+
- If you chose `edition-node-gulp`, a `gulpfile.js` will be added to your project.
5139

52-
1. Run the following command from a terminal:
53-
```bash
54-
npm install @pattern-lab/cli --save-dev
55-
```
56-
1. Open `package.json` and add the following to your `scripts` object
57-
```diff
58-
"scripts": {
59-
+ "patternlab": "patternlab"
60-
},
61-
```
62-
This tells `npm` to look in the local `node_modules/.bin` directory for the `patternlab` CLI.
63-
1. In your terminal, run `npm run patternlab init`. Follow the on-screen prompts to choose your Edition and a Starterkit should you want one.
40+
> Notice that `@pattern-lab/cli` was installed as a depdendency. Learn how to further [use the cli in your own project](https://github.com/pattern-lab/patternlab-node/blob/dev/packages/cli/readme.md#configuring-your-project-to-use-the-cli).
6441

6542

6643
## Ecosystem
@@ -85,7 +62,6 @@ Pattern Lab / Node wouldn't be what it is today without the support of the commu
8562
* **[Brad Frost](http://bradfrost.com/)**
8663
* [Marcos Peebles](https://twitter.com/marcospeebles)
8764
* [Susan Simkins](https://twitter.com/susanmsimkins)
88-
* [Wilfred Nas](https://twitter.com/wnas)
8965
9066
## Contributing
9167

packages/cli/readme.md

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,44 @@
1414
#### Via Yarn
1515
`yarn add @pattern-lab/cli --dev`
1616

17-
## Getting Started
18-
1. In order to use Pattern Lab you need to initialize a Pattern Lab project with `patternlab init`. The CLI will ask you some setup question and scaffold your project based on it.
19-
2. Build your patterns use `patternlab build`. The Pattern Lab CLI will assume that the `patternlab-config.json` is in the project root. Othewise specify a custom path to config with `patternlab build --config path/to/config`
20-
3. To view your patterns in the browser preview `patternlab serve` or again specify a custom config location `patternlab serve --config path/to/config`
21-
4. To export your patterns in the browser preview `patternlab export` or again specify a custom config location `patternlab export --config path/to/config`
17+
## Configuring Your Project to Use the CLI
18+
19+
If the CLI is installed globally, you may call commands directly, such as `patternlab --version`.
20+
21+
If the CLI is not installed globally, you need to tell `npm` where to find the executable when invoking commands.
22+
23+
Open `package.json` and add the following to your `scripts` object:
24+
25+
```diff
26+
"scripts": {
27+
+ "patternlab": "patternlab"
28+
},
29+
```
30+
This tells `npm` to look in the local `node_modules/.bin` directory for the `patternlab` CLI.
31+
32+
Subcommands and options can then be forwarded to the CLI like this:
33+
34+
```bash
35+
npm run patternlab -- serve
36+
```
37+
38+
Installing [`edition-node`](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node) will add the following CLI commands for convenience:
39+
40+
```diff
41+
"scripts": {
42+
+ "pl:build": "patternlab build --config ./patternlab-config.json",
43+
+ "pl:help": "patternlab --help",
44+
+ "pl:install": "patternlab install --config ./patternlab-config.json",
45+
+ "pl:serve": "patternlab serve --config ./patternlab-config.json",
46+
+ "pl:version": "patternlab --version"
47+
},
48+
```
49+
50+
Then you can invoke any of these like this:
51+
52+
```
53+
npm run pl:serve
54+
```
2255

2356
## API & Usage
2457
### General usage

0 commit comments

Comments
 (0)