Explorar el Código

docs: Add docs on CLI

Michael Bromley hace 2 años
padre
commit
9cb3c6387a

+ 53 - 0
docs/docs/guides/developer-guide/cli/index.md

@@ -0,0 +1,53 @@
+---
+title: "CLI"
+---
+
+The Vendure CLI is a command-line tool for boosting your productivity as a developer.
+
+Currently, it provides functionality for rapidly scaffolding a new plugin, and in future we will be expanding the capabilities to include other common tasks.
+
+:::info
+The Vendure CLI package was introduced with Vendure v2.1.0
+:::
+
+## Installation
+
+You can install the CLI locally in your Vendure project, or you can run it without installation using `npx`. The advantage of installing locally is that you can more easily control the installed version, and you can reference the CLI using the `vendure` command.
+
+```bash
+npm install -D @vendure/cli
+
+# or 
+
+yarn add -D @vendure/cli
+```
+
+and then from your project directory you can run:
+
+```bash
+vendure --version
+```
+
+### Running without installation
+
+If you want to use the Vendure CLI without installing it in your project, you can run
+
+```bash
+npx @vendure/cli --version
+```
+
+## Scaffold a new plugin
+
+The Vendure CLI can be used to quickly scaffold a new [plugin](/guides/developer-guide/plugins).
+
+1. Navigate to your plugins directory
+   ```bash
+   cd src/plugins
+   ```
+2. Run the `new plugin` command
+   ```bash
+   vendure new plugin
+   ```
+3. Answer the questions to configure your new plugin
+
+![Plugin creation flow](./new-plugin.webp)

BIN
docs/docs/guides/developer-guide/cli/new-plugin.webp


+ 2 - 0
docs/docs/guides/developer-guide/plugins/index.mdx

@@ -154,6 +154,8 @@ For any unit of functionality that you need to add to your project, you'll be wr
 :::info
 For a complete working example of a Vendure plugin, see the [real-world-vendure Reviews plugin](https://github.com/vendure-ecommerce/real-world-vendure/tree/master/src/plugins/reviews)
 
+You can also use the [Vendure CLI](/guides/developer-guide/cli) to quickly scaffold a new plugin.
+
 If you intend to write a shared plugin to be distributed as an npm package, see the [vendure plugin-template repo](https://github.com/vendure-ecommerce/plugin-template)
 :::
 

+ 1 - 0
docs/sidebars.js

@@ -65,6 +65,7 @@ const sidebars = {
                     value: 'Fundamentals',
                     className: 'sidebar-section-header',
                 },
+                'guides/developer-guide/cli/index',
                 'guides/developer-guide/configuration/index',
                 'guides/developer-guide/custom-fields/index',
                 'guides/developer-guide/error-handling/index',