From 12a94b0ee141d8df9b39b179e86940e082ece54a Mon Sep 17 00:00:00 2001 From: Brian Muenzenmeyer Date: Fri, 14 Sep 2018 11:48:22 -0500 Subject: [PATCH 1/2] chore(README): remove backer --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 73d0fe020..dd81d9dce 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,6 @@ Pattern Lab / Node wouldn't be what it is today without the support of the commu * **[Brad Frost](http://bradfrost.com/)** * [Marcos Peebles](https://twitter.com/marcospeebles) * [Susan Simkins](https://twitter.com/susanmsimkins) -* [Wilfred Nas](https://twitter.com/wnas) ## Contributing From ceec673b1a9b473949534a444b4334c48bcdf5cd Mon Sep 17 00:00:00 2001 From: Brian Muenzenmeyer Date: Fri, 14 Sep 2018 11:49:14 -0500 Subject: [PATCH 2/2] feat(README): simplify README and add CLI configuration instructions --- README.md | 31 ++++-------------------------- packages/cli/readme.md | 43 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index dd81d9dce..07ff5607d 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,7 @@ Refer to the [core usage guidelines](https://github.com/pattern-lab/patternlab-n 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. -_0 to 60mph_ - -The below assume a new directory and project is required. +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. 1. Open a terminal window and following along below: ```bash @@ -36,31 +34,10 @@ The below assume a new directory and project is required. ``` > 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) 1. Follow the on-screen prompts to choose your Edition and a Starterkit should you want one. -1. Run `npm install` one last time to ensure any transient packages from the CLI are installed. -1. Open `package.json` and add the following to your `scripts` object - ```diff - "scripts": { - + "patternlab": "patternlab" - }, - ``` - This tells `npm` to look in the local `node_modules/.bin` directory for the `patternlab` CLI. -1. In your terminal, run `npm run patternlab `, where `` is a documented method on the CLI, such as `build`, `serve`, or `help`. - - -_Established npm projects_ + - If you chose `edition-node`, new commands in the "scripts" will be added in your `package.json`. + - If you chose `edition-node-gulp`, a `gulpfile.js` will be added to your project. -1. Run the following command from a terminal: - ```bash - npm install @pattern-lab/cli --save-dev - ``` -1. Open `package.json` and add the following to your `scripts` object - ```diff - "scripts": { - + "patternlab": "patternlab" - }, - ``` - This tells `npm` to look in the local `node_modules/.bin` directory for the `patternlab` CLI. -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. + > 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). ## Ecosystem diff --git a/packages/cli/readme.md b/packages/cli/readme.md index 921f4ccad..e5a9ae95e 100644 --- a/packages/cli/readme.md +++ b/packages/cli/readme.md @@ -14,11 +14,44 @@ #### Via Yarn `yarn add @pattern-lab/cli --dev` -## Getting Started -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. -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` -3. To view your patterns in the browser preview `patternlab serve` or again specify a custom config location `patternlab serve --config path/to/config` -4. To export your patterns in the browser preview `patternlab export` or again specify a custom config location `patternlab export --config path/to/config` +## Configuring Your Project to Use the CLI + +If the CLI is installed globally, you may call commands directly, such as `patternlab --version`. + +If the CLI is not installed globally, you need to tell `npm` where to find the executable when invoking commands. + +Open `package.json` and add the following to your `scripts` object: + +```diff +"scripts": { ++ "patternlab": "patternlab" +}, +``` +This tells `npm` to look in the local `node_modules/.bin` directory for the `patternlab` CLI. + +Subcommands and options can then be forwarded to the CLI like this: + +```bash +npm run patternlab -- serve +``` + +Installing [`edition-node`](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node) will add the following CLI commands for convenience: + +```diff + "scripts": { ++ "pl:build": "patternlab build --config ./patternlab-config.json", ++ "pl:help": "patternlab --help", ++ "pl:install": "patternlab install --config ./patternlab-config.json", ++ "pl:serve": "patternlab serve --config ./patternlab-config.json", ++ "pl:version": "patternlab --version" + }, +``` + +Then you can invoke any of these like this: + +``` +npm run pl:serve +``` ## API & Usage ### General usage