docs(core): update documentation to reflect nx commands (#2403)

This commit is contained in:
Benjamin Cabanes 2020-02-25 11:55:59 -05:00 committed by GitHub
parent a433035eca
commit e45b7a6124
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
55 changed files with 81 additions and 124 deletions

View File

@ -1,41 +0,0 @@
# list [plugin]
Lists installed plugins, capabilities of installed plugins and other available plugins.
## Usage
```bash
nx list [plugin]
```
Install `@nrwl/cli` globally to invoke the command directly using `nx`, or use `npm run nx` or `yarn nx`.
### Examples
List the plugins installed in the current workspace:
```bash
nx list
```
List the schematics and builders available in the `@nrwl/web` plugin if it is installed (If the plugin is not installed `nx` will show advice on how to add it to your workspace):
```bash
nx list @nrwl/web
```
## Options
### help
Show help
### plugin
Default: `null`
The name of an installed plugin to query
### version
Show version number

View File

@ -1,28 +1,14 @@
# list [plugin] # list
Lists installed plugins, capabilities of installed plugins and other available plugins. Lists installed plugins, capabilities of installed plugins and other available plugins.
## Usage ## Usage
```bash
nx list [plugin]
```
Install `@nrwl/cli` globally to invoke the command directly using `nx`, or use `npm run nx` or `yarn nx`.
### Examples
List the plugins installed in the current workspace:
```bash ```bash
nx list nx list
``` ```
List the schematics and builders available in the `@nrwl/web` plugin if it is installed (If the plugin is not installed `nx` will show advice on how to add it to your workspace): Install `@nrwl/cli` globally to invoke the command directly using `nx`, or use `npm run nx` or `yarn nx`.
```bash
nx list @nrwl/web
```
## Options ## Options

View File

@ -1,11 +1,11 @@
# workspace-lint [files..] # workspace-lint
Lint workspace or list of files Lint workspace or list of files
## Usage ## Usage
```bash ```bash
nx workspace-lint [files..] nx workspace-lint
``` ```
Install `@nrwl/cli` globally to invoke the command directly using `nx`, or use `npm run nx` or `yarn nx`. Install `@nrwl/cli` globally to invoke the command directly using `nx`, or use `npm run nx` or `yarn nx`.

View File

@ -1,11 +1,11 @@
# workspace-schematic [name] # workspace-schematic
Runs a workspace schematic from the tools/schematics directory Runs a workspace schematic from the tools/schematics directory
## Usage ## Usage
```bash ```bash
nx workspace-schematic [name] nx workspace-schematic
``` ```
Install `@nrwl/cli` globally to invoke the command directly using `nx`, or use `npm run nx` or `yarn nx`. Install `@nrwl/cli` globally to invoke the command directly using `nx`, or use `npm run nx` or `yarn nx`.

View File

@ -0,0 +1,27 @@
# list
Lists installed plugins, capabilities of installed plugins and other available plugins.
## Usage
```bash
nx list
```
Install `@nrwl/cli` globally to invoke the command directly using `nx`, or use `npm run nx` or `yarn nx`.
## Options
### help
Show help
### plugin
Default: `null`
The name of an installed plugin to query
### version
Show version number

View File

@ -1,11 +1,11 @@
# workspace-lint [files..] # workspace-lint
Lint workspace or list of files Lint workspace or list of files
## Usage ## Usage
```bash ```bash
nx workspace-lint [files..] nx workspace-lint
``` ```
Install `@nrwl/cli` globally to invoke the command directly using `nx`, or use `npm run nx` or `yarn nx`. Install `@nrwl/cli` globally to invoke the command directly using `nx`, or use `npm run nx` or `yarn nx`.

View File

@ -1,11 +1,11 @@
# workspace-schematic [name] # workspace-schematic
Runs a workspace schematic from the tools/schematics directory Runs a workspace schematic from the tools/schematics directory
## Usage ## Usage
```bash ```bash
nx workspace-schematic [name] nx workspace-schematic
``` ```
Install `@nrwl/cli` globally to invoke the command directly using `nx`, or use `npm run nx` or `yarn nx`. Install `@nrwl/cli` globally to invoke the command directly using `nx`, or use `npm run nx` or `yarn nx`.

View File

@ -1,41 +0,0 @@
# list [plugin]
Lists installed plugins, capabilities of installed plugins and other available plugins.
## Usage
```bash
nx list [plugin]
```
Install `@nrwl/cli` globally to invoke the command directly using `nx`, or use `npm run nx` or `yarn nx`.
### Examples
List the plugins installed in the current workspace:
```bash
nx list
```
List the schematics and builders available in the `@nrwl/web` plugin if it is installed (If the plugin is not installed `nx` will show advice on how to add it to your workspace):
```bash
nx list @nrwl/web
```
## Options
### help
Show help
### plugin
Default: `null`
The name of an installed plugin to query
### version
Show version number

View File

@ -0,0 +1,27 @@
# list
Lists installed plugins, capabilities of installed plugins and other available plugins.
## Usage
```bash
nx list
```
Install `@nrwl/cli` globally to invoke the command directly using `nx`, or use `npm run nx` or `yarn nx`.
## Options
### help
Show help
### plugin
Default: `null`
The name of an installed plugin to query
### version
Show version number

View File

@ -1,11 +1,11 @@
# workspace-lint [files..] # workspace-lint
Lint workspace or list of files Lint workspace or list of files
## Usage ## Usage
```bash ```bash
nx workspace-lint [files..] nx workspace-lint
``` ```
Install `@nrwl/cli` globally to invoke the command directly using `nx`, or use `npm run nx` or `yarn nx`. Install `@nrwl/cli` globally to invoke the command directly using `nx`, or use `npm run nx` or `yarn nx`.

View File

@ -1,11 +1,11 @@
# workspace-schematic [name] # workspace-schematic
Runs a workspace schematic from the tools/schematics directory Runs a workspace schematic from the tools/schematics directory
## Usage ## Usage
```bash ```bash
nx workspace-schematic [name] nx workspace-schematic
``` ```
Install `@nrwl/cli` globally to invoke the command directly using `nx`, or use `npm run nx` or `yarn nx`. Install `@nrwl/cli` globally to invoke the command directly using `nx`, or use `npm run nx` or `yarn nx`.

View File

@ -5,5 +5,5 @@ set -e
echo "Generating API documentation" echo "Generating API documentation"
ts-node ./scripts/documentation/generate-builders-data.ts ts-node ./scripts/documentation/generate-builders-data.ts
ts-node ./scripts/documentation/generate-schematics-data.ts ts-node ./scripts/documentation/generate-schematics-data.ts
ts-node ./scripts/documentation/generate-npmscripts-data.ts ts-node ./scripts/documentation/generate-nx-commands-data.ts
echo 'Done generating all Documentation' echo 'Done generating all Documentation'

View File

@ -358,14 +358,14 @@ const examples = {
} }
] ]
}; };
console.log('Generating npmscript Documentation'); console.log('Generating Nx Commands Documentation');
Promise.all( Promise.all(
['web', 'angular', 'react'].map(async framework => { ['web', 'angular', 'react'].map(async framework => {
const commandsOutputDirectory = path.join( const commandsOutputDirectory = path.join(
__dirname, __dirname,
'../../docs/', '../../docs/',
framework, framework,
'api-workspace/npmscripts' 'nx-commands'
); );
fs.removeSync(commandsOutputDirectory); fs.removeSync(commandsOutputDirectory);
function getCommands(command) { function getCommands(command) {
@ -376,15 +376,15 @@ Promise.all(
const builderDescriptions = builder.getUsageInstance().getDescriptions(); const builderDescriptions = builder.getUsageInstance().getDescriptions();
const builderDefaultOptions = builder.getOptions().default; const builderDefaultOptions = builder.getOptions().default;
return { return {
command: command['original'], command: name,
description: command['description'], description: command['description'],
options: options:
Object.keys(builderDescriptions).map(name => ({ Object.keys(builderDescriptions).map(key => ({
command: '--'.concat(name), command: '--'.concat(key),
description: builderDescriptions[name] description: builderDescriptions[key]
? builderDescriptions[name].replace('__yargsString__:', '') ? builderDescriptions[key].replace('__yargsString__:', '')
: '', : '',
default: builderDefaultOptions[name] default: builderDefaultOptions[key]
})) || null })) || null
}; };
} }
@ -446,12 +446,11 @@ Promise.all(
} }
// TODO: Try to add option's type, examples, and group? // TODO: Try to add option's type, examples, and group?
// TODO: split one command per page / Create an index const nxCommands = getCommands(commandsObject);
const npmscripts = getCommands(commandsObject);
await Promise.all( await Promise.all(
Object.keys(npmscripts) Object.keys(nxCommands)
.filter(name => !name.startsWith('run') && !name.startsWith('generate')) .filter(name => !name.startsWith('run') && !name.startsWith('generate'))
.map(name => parseCommandInstance(name, npmscripts[name])) .map(name => parseCommandInstance(name, nxCommands[name]))
.map(command => generateMarkdown(command)) .map(command => generateMarkdown(command))
.map(templateObject => .map(templateObject =>
generateMarkdownFile(commandsOutputDirectory, templateObject) generateMarkdownFile(commandsOutputDirectory, templateObject)
@ -459,5 +458,5 @@ Promise.all(
); );
}) })
).then(() => { ).then(() => {
console.log('Finished generating npmscripts Documentation'); console.log('Finished generating Nx Commands Documentation');
}); });