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.
## 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
```
Install `@nrwl/cli` globally to invoke the command directly using `nx`, or use `npm run nx` or `yarn nx`.
## Options

View File

@ -1,11 +1,11 @@
# workspace-lint [files..]
# workspace-lint
Lint workspace or list of files
## Usage
```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`.

View File

@ -1,11 +1,11 @@
# workspace-schematic [name]
# workspace-schematic
Runs a workspace schematic from the tools/schematics directory
## Usage
```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`.

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
## Usage
```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`.

View File

@ -1,11 +1,11 @@
# workspace-schematic [name]
# workspace-schematic
Runs a workspace schematic from the tools/schematics directory
## Usage
```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`.

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
## Usage
```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`.

View File

@ -1,11 +1,11 @@
# workspace-schematic [name]
# workspace-schematic
Runs a workspace schematic from the tools/schematics directory
## Usage
```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`.

View File

@ -5,5 +5,5 @@ set -e
echo "Generating API documentation"
ts-node ./scripts/documentation/generate-builders-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'

View File

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