899 lines
41 KiB
JSON
899 lines
41 KiB
JSON
{
|
|
"githubRoot": "https://github.com/nrwl/nx/blob/master",
|
|
"name": "workspace",
|
|
"description": "Smart, Fast and Extensible Build System.",
|
|
"root": "/packages/workspace",
|
|
"source": "/packages/workspace/src",
|
|
"documentation": [
|
|
{
|
|
"name": "Overview",
|
|
"id": "overview",
|
|
"path": "/packages/workspace",
|
|
"file": "shared/workspace-plugin",
|
|
"content": "The workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and other plugins build on it.\n\n## Creating Workspace Generators\n\nCodifying your organization's best practices into workspace generators is a great way to ensure that the best practices are easy to follow and implement. Running `nx g @nrwl/workspace:workspace-generator feature` will create a workspace generator which is written the same way generators are written for Nx plugins. The workspace generator can then be run with `nx workspace-generator feature`.\n\n> See more about [workspace generators](/generators/workspace-generators)\n\n## Reorganizing Projects\n\nAfter some time of working within a workspace, projects might need to be moved or sometimes even removed.\nThe workspace plugin provides the [`@nrwl/workspace:move`](/workspace/move) and [`@nrwl/workspace:remove`](/workspace/remove) generators to help aid with this.\n\n### Moving Projects\n\nRunning `nx g @nrwl/workspace:move new/location/my-lib --projectName my-lib` will move the `my-lib` library to `libs/new/location/my-lib`.\n\nMoving the files manually can be done easily but a lot of steps are often missed when projects are moved. This generator will also handle the following:\n\n1. The project's files will be moved\n2. The project will be renamed to `new-location-my-lib`\n3. The path mapping in `tsconfig.base.json` will be changed to `@npmScope/new/location/my-lib`\n4. Imports in other projects will be changed to `@npmScope/new/location/my-lib`\n5. Paths in target options such as output path will be changed\n6. Other configuration will be updated too such as `extends` in `tsconfig.json`, the name of the project in `jest.config.js`, and the extends in `.eslintrc.json`\n\n> See more about [`@nrwl/workspace:move`](/workspace/move)\n\n### Removing Projects\n\nRunning `nx g @nrwl/workspace:remove my-lib` will remove the `my-lib` from the workspace. It is important to note that sometimes, projects cannot be removed if they are still depended on by other projects.\n\nLike when moving projects, some steps are often missed when removing projects. This generator will also handle the following:\n\n1. Checks if other projects depend on the project being removed. This can be ignored via the `--forceRemove` flag.\n2. The project's files will be deleted.\n3. The project's configuration will be removed.\n4. The path mapping in `tsconfig.base.json` will be removed.\n\n> See more about [`@nrwl/workspace:remove`](/workspace/remove)\n\n## Running custom commands\n\nExecutors provide an optimized way of running targets but unfortunately, not every target has an executor written for it. The [`nx:run-commands`](/packages/nx/executors/run-commands) executor is an executor that runs any command or multiple commands in the shell. This can be useful when integrating with other tools which do not have an executor provided. There is also a generator to help configure this executor.\n\nRunning `nx g nx:run-commands printhello --project my-feature-lib --command 'echo hello'` will create a `my-feature-lib:printhello` target that executes `echo hello` in the shell.\n\n> See more about [`nx:run-commands`](/packages/nx/executors/run-commands)\n"
|
|
}
|
|
],
|
|
"generators": [
|
|
{
|
|
"name": "workspace",
|
|
"factory": "./src/generators/workspace/workspace#workspaceGenerator",
|
|
"schema": {
|
|
"$schema": "http://json-schema.org/schema",
|
|
"$id": "SchematicsNxNgNew",
|
|
"cli": "nx",
|
|
"title": "Create an empty workspace",
|
|
"description": "Create an empty workspace.",
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"description": "The name of the workspace.",
|
|
"type": "string",
|
|
"$default": { "$source": "argv", "index": 0 },
|
|
"x-prompt": "What name would you like to use for the workspace?"
|
|
},
|
|
"style": {
|
|
"description": "The file extension to be used for style files.",
|
|
"type": "string",
|
|
"default": "css",
|
|
"x-prompt": {
|
|
"message": "Which stylesheet format would you like to use?",
|
|
"type": "list",
|
|
"items": [
|
|
{ "value": "css", "label": "CSS" },
|
|
{
|
|
"value": "scss",
|
|
"label": "SASS(.scss) [ http://sass-lang.com ]"
|
|
},
|
|
{
|
|
"value": "styl",
|
|
"label": "Stylus(.styl)[ http://stylus-lang.com ]"
|
|
},
|
|
{
|
|
"value": "less",
|
|
"label": "LESS [ http://lesscss.org ]"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"directory": {
|
|
"type": "string",
|
|
"format": "path",
|
|
"description": "The directory name to create the workspace in.",
|
|
"default": ""
|
|
},
|
|
"preset": {
|
|
"type": "string",
|
|
"description": "Preset of the workspace."
|
|
},
|
|
"npmScope": {
|
|
"type": "string",
|
|
"description": "Npm scope for importing libs."
|
|
},
|
|
"defaultBase": {
|
|
"type": "string",
|
|
"description": "Default base branch for affected."
|
|
},
|
|
"skipInstall": {
|
|
"description": "Skip installing dependency packages.",
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"skipGit": {
|
|
"description": "Skip initializing a git repository.",
|
|
"type": "boolean",
|
|
"default": false,
|
|
"alias": "g"
|
|
},
|
|
"commit": {
|
|
"description": "Initial repository commit information.",
|
|
"oneOf": [
|
|
{ "type": "boolean" },
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"name": { "type": "string" },
|
|
"email": { "type": "string", "format": "email" },
|
|
"message": { "type": "string" }
|
|
},
|
|
"required": ["name", "email"]
|
|
}
|
|
],
|
|
"default": true
|
|
},
|
|
"packageManager": {
|
|
"description": "The package manager used to install dependencies.",
|
|
"type": "string",
|
|
"enum": ["npm", "yarn", "pnpm"]
|
|
},
|
|
"cli": {
|
|
"description": "CLI used for generating code and running tasks",
|
|
"type": "string",
|
|
"enum": ["nx", "angular"],
|
|
"default": "nx"
|
|
}
|
|
},
|
|
"presets": []
|
|
},
|
|
"description": "Create an empty workspace.",
|
|
"hidden": true,
|
|
"implementation": "/packages/workspace/src/generators/workspace/workspace#workspaceGenerator.ts",
|
|
"aliases": [],
|
|
"path": "/packages/workspace/src/generators/workspace/schema.json"
|
|
},
|
|
{
|
|
"name": "preset",
|
|
"factory": "./src/generators/preset/preset#presetGenerator",
|
|
"schema": {
|
|
"$schema": "http://json-schema.org/schema",
|
|
"$id": "NxWorkspacePreset",
|
|
"cli": "nx",
|
|
"title": "Creates applications in a new workspace",
|
|
"description": "Creates applications in a new workspace.",
|
|
"type": "object",
|
|
"properties": {
|
|
"preset": {
|
|
"description": "The name of the preset.",
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"description": "The name of the application.",
|
|
"type": "string"
|
|
},
|
|
"npmScope": {
|
|
"description": "Npm scope for importing libs.",
|
|
"type": "string"
|
|
},
|
|
"cli": {
|
|
"description": "CLI powering the workspace.",
|
|
"type": "string"
|
|
},
|
|
"linter": {
|
|
"description": "The tool to use for running lint checks.",
|
|
"type": "string",
|
|
"enum": ["tslint", "eslint"],
|
|
"default": "eslint"
|
|
},
|
|
"style": {
|
|
"description": "The file extension to be used for style files.",
|
|
"type": "string",
|
|
"default": "css",
|
|
"x-prompt": {
|
|
"message": "Which stylesheet format would you like to use?",
|
|
"type": "list",
|
|
"items": [
|
|
{ "value": "css", "label": "CSS" },
|
|
{
|
|
"value": "scss",
|
|
"label": "SASS(.scss) [ http://sass-lang.com ]"
|
|
},
|
|
{
|
|
"value": "styl",
|
|
"label": "Stylus(.styl)[ http://stylus-lang.com ]"
|
|
},
|
|
{
|
|
"value": "less",
|
|
"label": "LESS [ http://lesscss.org ]"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"standaloneConfig": {
|
|
"description": "Split the project configurations into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
|
|
"type": "boolean"
|
|
},
|
|
"packageManager": {
|
|
"description": "The package manager used to install dependencies.",
|
|
"type": "string",
|
|
"enum": ["npm", "yarn", "pnpm"]
|
|
}
|
|
},
|
|
"presets": []
|
|
},
|
|
"description": "Create application in an empty workspace.",
|
|
"hidden": true,
|
|
"implementation": "/packages/workspace/src/generators/preset/preset#presetGenerator.ts",
|
|
"aliases": [],
|
|
"path": "/packages/workspace/src/generators/preset/schema.json"
|
|
},
|
|
{
|
|
"name": "move",
|
|
"factory": "./src/generators/move/move#moveGenerator",
|
|
"schema": {
|
|
"$schema": "http://json-schema.org/schema",
|
|
"$id": "NxWorkspaceMove",
|
|
"cli": "nx",
|
|
"title": "Nx Move",
|
|
"description": "Move a project to another folder in the workspace.",
|
|
"type": "object",
|
|
"examples": [
|
|
{
|
|
"command": "nx g @nrwl/workspace:move --project my-feature-lib shared/my-feature-lib",
|
|
"description": "Move `libs/my-feature-lib` to `libs/shared/my-feature-lib`"
|
|
}
|
|
],
|
|
"properties": {
|
|
"projectName": {
|
|
"type": "string",
|
|
"alias": "project",
|
|
"description": "The name of the project to move."
|
|
},
|
|
"destination": {
|
|
"type": "string",
|
|
"description": "The folder to move the project into.",
|
|
"$default": { "$source": "argv", "index": 0 }
|
|
},
|
|
"importPath": {
|
|
"type": "string",
|
|
"description": "The new import path to use in the `tsconfig.base.json`."
|
|
},
|
|
"updateImportPath": {
|
|
"type": "boolean",
|
|
"description": "Should the generator update the import path to reflect the new location?",
|
|
"default": true
|
|
},
|
|
"skipFormat": {
|
|
"type": "boolean",
|
|
"aliases": ["skip-format"],
|
|
"description": "Skip formatting files.",
|
|
"default": false
|
|
}
|
|
},
|
|
"required": ["projectName", "destination"],
|
|
"presets": []
|
|
},
|
|
"aliases": ["mv"],
|
|
"description": "Move an application or library to another folder.",
|
|
"implementation": "/packages/workspace/src/generators/move/move#moveGenerator.ts",
|
|
"hidden": false,
|
|
"path": "/packages/workspace/src/generators/move/schema.json"
|
|
},
|
|
{
|
|
"name": "remove",
|
|
"factory": "./src/generators/remove/remove#removeGenerator",
|
|
"schema": {
|
|
"$schema": "http://json-schema.org/schema",
|
|
"$id": "NxWorkspaceRemove",
|
|
"cli": "nx",
|
|
"title": "Nx Remove",
|
|
"description": "Remove a project from the workspace.",
|
|
"type": "object",
|
|
"examples": [
|
|
{
|
|
"command": "nx g @nrwl/workspace:remove my-feature-lib",
|
|
"description": "Remove `my-feature-lib` from the workspace"
|
|
},
|
|
{
|
|
"command": "nx g @nrwl/workspace:remove my-feature-lib --forceRemove",
|
|
"description": "Force removal of `my-feature-lib` from the workspace"
|
|
}
|
|
],
|
|
"properties": {
|
|
"projectName": {
|
|
"type": "string",
|
|
"alias": "project",
|
|
"description": "The name of the project to remove.",
|
|
"$default": { "$source": "argv", "index": 0 }
|
|
},
|
|
"forceRemove": {
|
|
"type": "boolean",
|
|
"aliases": ["force-remove"],
|
|
"description": "When `true`, forces removal even if the project is still in use.",
|
|
"default": false
|
|
},
|
|
"skipFormat": {
|
|
"type": "boolean",
|
|
"aliases": ["skip-format"],
|
|
"description": "Skip formatting files.",
|
|
"default": false
|
|
},
|
|
"importPath": {
|
|
"type": "string",
|
|
"description": "The library name used at creation time"
|
|
}
|
|
},
|
|
"required": ["projectName"],
|
|
"presets": []
|
|
},
|
|
"aliases": ["rm"],
|
|
"description": "Remove an application or library.",
|
|
"implementation": "/packages/workspace/src/generators/remove/remove#removeGenerator.ts",
|
|
"hidden": false,
|
|
"path": "/packages/workspace/src/generators/remove/schema.json"
|
|
},
|
|
{
|
|
"name": "new",
|
|
"factory": "./src/generators/new/new#newGenerator",
|
|
"schema": {
|
|
"$schema": "http://json-schema.org/schema",
|
|
"$id": "NxWorkspaceNew",
|
|
"title": "Create an empty workspace",
|
|
"description": "Create an empty workspace.",
|
|
"type": "object",
|
|
"cli": "nx",
|
|
"properties": {
|
|
"name": {
|
|
"description": "The name of the workspace.",
|
|
"type": "string",
|
|
"$default": { "$source": "argv", "index": 0 },
|
|
"x-prompt": "What name would you like to use for the workspace?"
|
|
},
|
|
"cli": {
|
|
"description": "CLI used for generating code and running tasks.",
|
|
"type": "string",
|
|
"enum": ["nx", "angular"],
|
|
"default": "nx"
|
|
},
|
|
"style": {
|
|
"description": "The file extension to be used for style files.",
|
|
"type": "string",
|
|
"default": "css"
|
|
},
|
|
"npmScope": {
|
|
"type": "string",
|
|
"description": "Npm scope for importing libs."
|
|
},
|
|
"defaultBase": {
|
|
"type": "string",
|
|
"description": "Default base branch for affected."
|
|
},
|
|
"skipInstall": {
|
|
"description": "Skip installing dependency packages.",
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"skipGit": {
|
|
"description": "Skip initializing a git repository.",
|
|
"type": "boolean",
|
|
"default": false,
|
|
"alias": "g"
|
|
},
|
|
"commit": {
|
|
"description": "Initial repository commit information.",
|
|
"oneOf": [
|
|
{ "type": "boolean" },
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"name": { "type": "string" },
|
|
"email": { "type": "string", "format": "email" },
|
|
"message": { "type": "string" }
|
|
},
|
|
"required": ["name", "email"]
|
|
}
|
|
],
|
|
"default": true
|
|
},
|
|
"preset": {
|
|
"description": "What to create in the new workspace.",
|
|
"type": "string"
|
|
},
|
|
"appName": { "type": "string", "description": "Application name." },
|
|
"nxCloud": {
|
|
"description": "Connect the workspace to the free tier of the distributed cache provided by Nx Cloud.",
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"linter": {
|
|
"description": "The tool to use for running lint checks.",
|
|
"type": "string",
|
|
"enum": ["tslint", "eslint"],
|
|
"default": "eslint"
|
|
},
|
|
"packageManager": {
|
|
"description": "The package manager used to install dependencies.",
|
|
"type": "string",
|
|
"enum": ["npm", "yarn", "pnpm"]
|
|
}
|
|
},
|
|
"additionalProperties": true,
|
|
"presets": []
|
|
},
|
|
"description": "Create a workspace.",
|
|
"hidden": true,
|
|
"implementation": "/packages/workspace/src/generators/new/new#newGenerator.ts",
|
|
"aliases": [],
|
|
"path": "/packages/workspace/src/generators/new/schema.json"
|
|
},
|
|
{
|
|
"name": "library",
|
|
"factory": "./src/generators/library/library#libraryGenerator",
|
|
"schema": {
|
|
"$schema": "http://json-schema.org/schema",
|
|
"$id": "NxTypescriptLibrary",
|
|
"cli": "nx",
|
|
"title": "Create a TypeScript Library",
|
|
"description": "Create a TypeScript Library.",
|
|
"type": "object",
|
|
"examples": [
|
|
{
|
|
"command": "nx g lib mylib --directory=myapp",
|
|
"description": "Generate `libs/myapp/mylib`"
|
|
}
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Library name.",
|
|
"$default": { "$source": "argv", "index": 0 },
|
|
"x-prompt": "What name would you like to use for the library?",
|
|
"pattern": "^[a-zA-Z].*$"
|
|
},
|
|
"directory": {
|
|
"type": "string",
|
|
"description": "A directory where the lib is placed."
|
|
},
|
|
"linter": {
|
|
"description": "The tool to use for running lint checks.",
|
|
"type": "string",
|
|
"enum": ["eslint"],
|
|
"default": "eslint"
|
|
},
|
|
"unitTestRunner": {
|
|
"type": "string",
|
|
"enum": ["jest", "none"],
|
|
"description": "Test runner to use for unit tests.",
|
|
"default": "jest"
|
|
},
|
|
"tags": {
|
|
"type": "string",
|
|
"description": "Add tags to the library (used for linting)."
|
|
},
|
|
"skipFormat": {
|
|
"description": "Skip formatting files.",
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"skipTsConfig": {
|
|
"type": "boolean",
|
|
"description": "Do not update `tsconfig.json` for development experience.",
|
|
"default": false
|
|
},
|
|
"testEnvironment": {
|
|
"type": "string",
|
|
"enum": ["jsdom", "node"],
|
|
"description": "The test environment to use if `unitTestRunner` is set to `jest`.",
|
|
"default": "jsdom"
|
|
},
|
|
"importPath": {
|
|
"type": "string",
|
|
"description": "The library name used to import it, like `@myorg/my-awesome-lib`."
|
|
},
|
|
"babelJest": {
|
|
"type": "boolean",
|
|
"description": "Use `babel` instead `ts-jest`.",
|
|
"default": false
|
|
},
|
|
"pascalCaseFiles": {
|
|
"type": "boolean",
|
|
"description": "Use pascal case file names.",
|
|
"alias": "P",
|
|
"default": false
|
|
},
|
|
"js": {
|
|
"type": "boolean",
|
|
"description": "Generate JavaScript files rather than TypeScript files.",
|
|
"default": false
|
|
},
|
|
"strict": {
|
|
"type": "boolean",
|
|
"description": "Whether to enable `tsconfig` strict mode or not.",
|
|
"default": true
|
|
},
|
|
"skipBabelrc": {
|
|
"type": "boolean",
|
|
"description": "Do not generate `.babelrc` file. Useful for Node libraries that are not compiled by Babel.",
|
|
"default": false
|
|
},
|
|
"buildable": {
|
|
"type": "boolean",
|
|
"default": false,
|
|
"description": "Generate a buildable library."
|
|
},
|
|
"setParserOptionsProject": {
|
|
"type": "boolean",
|
|
"description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
|
|
"default": false
|
|
},
|
|
"standaloneConfig": {
|
|
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"required": ["name"],
|
|
"presets": []
|
|
},
|
|
"aliases": ["lib"],
|
|
"x-type": "library",
|
|
"description": "Create a library.",
|
|
"implementation": "/packages/workspace/src/generators/library/library#libraryGenerator.ts",
|
|
"hidden": false,
|
|
"path": "/packages/workspace/src/generators/library/schema.json"
|
|
},
|
|
{
|
|
"name": "workspace-generator",
|
|
"factory": "./src/generators/workspace-generator/workspace-generator",
|
|
"schema": {
|
|
"cli": "nx",
|
|
"$id": "SchematicsNxWorkspaceSchematic",
|
|
"title": "Create a custom generator",
|
|
"description": "Create a custom generator.",
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Generator name.",
|
|
"$default": { "$source": "argv", "index": 0 },
|
|
"x-prompt": "What name would you like to use for the workspace generator?"
|
|
},
|
|
"skipFormat": {
|
|
"description": "Skip formatting files.",
|
|
"type": "boolean",
|
|
"default": false
|
|
}
|
|
},
|
|
"required": [],
|
|
"presets": []
|
|
},
|
|
"aliases": ["workspace-schematic"],
|
|
"description": "Generates a workspace generator.",
|
|
"implementation": "/packages/workspace/src/generators/workspace-generator/workspace-generator.ts",
|
|
"hidden": false,
|
|
"path": "/packages/workspace/src/generators/workspace-generator/schema.json"
|
|
},
|
|
{
|
|
"name": "run-commands",
|
|
"factory": "./src/generators/run-commands/run-commands#runCommandsGenerator",
|
|
"schema": {
|
|
"$schema": "http://json-schema.org/schema",
|
|
"$id": "SchematicsRunCommands",
|
|
"title": "Create a custom target to run any command",
|
|
"description": "Create a custom target to run any command.",
|
|
"type": "object",
|
|
"cli": "nx",
|
|
"examples": [
|
|
{
|
|
"command": "nx g @nrwl/workspace:run-commands printhello --project my-feature-lib --command 'echo hello'",
|
|
"description": "Add the `printhello` target to `my-feature-lib`"
|
|
}
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Target name.",
|
|
"$default": { "$source": "argv", "index": 0 },
|
|
"x-prompt": "What name would you like to use to invoke the command?"
|
|
},
|
|
"project": {
|
|
"description": "Project name.",
|
|
"type": "string",
|
|
"x-prompt": "What project does the target belong to?"
|
|
},
|
|
"command": {
|
|
"description": "Command to run.",
|
|
"type": "string",
|
|
"x-prompt": "What command would you like to run?"
|
|
},
|
|
"cwd": {
|
|
"description": "Current working directory of the command.",
|
|
"type": "string"
|
|
},
|
|
"outputs": {
|
|
"description": "Allows you to specify where the build artifacts are stored. This allows Nx Cloud to pick them up correctly, in the case that the build artifacts are placed somewhere other than the top level dist folder.",
|
|
"type": "string"
|
|
},
|
|
"envFile": {
|
|
"description": "Env files to be loaded before executing the commands.",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": ["name", "command", "project"],
|
|
"presets": []
|
|
},
|
|
"aliases": ["run-command", "target"],
|
|
"description": "Generates a target to run any command in the terminal.",
|
|
"implementation": "/packages/workspace/src/generators/run-commands/run-commands#runCommandsGenerator.ts",
|
|
"hidden": false,
|
|
"path": "/packages/workspace/src/generators/run-commands/schema.json"
|
|
},
|
|
{
|
|
"name": "convert-to-nx-project",
|
|
"factory": "./src/generators/convert-to-nx-project/convert-to-nx-project#convertToNxProjectGenerator",
|
|
"schema": {
|
|
"$schema": "http://json-schema.org/schema",
|
|
"$id": "SchematicsConvertToNxProject",
|
|
"title": "Create a custom target to run any command",
|
|
"description": "Create a custom target to run any command.",
|
|
"type": "object",
|
|
"cli": "nx",
|
|
"examples": [
|
|
{
|
|
"command": "nx g @nrwl/workspace:convert-to-nx-project --project my-feature-lib",
|
|
"description": "Convert the `my-feature-lib` project to use `project.json` file instead of `workspace.json`"
|
|
},
|
|
{
|
|
"command": "nx g @nrwl/workspace:convert-to-nx-project --all",
|
|
"description": "Convert all projects in `workspace.json` to separate `project.json` files"
|
|
}
|
|
],
|
|
"properties": {
|
|
"project": { "description": "Project name.", "type": "string" },
|
|
"all": {
|
|
"description": "Should every project be converted?",
|
|
"type": "boolean"
|
|
},
|
|
"skipFormat": {
|
|
"description": "Skip formatting files.",
|
|
"type": "boolean",
|
|
"default": false
|
|
}
|
|
},
|
|
"presets": []
|
|
},
|
|
"description": "Moves a project's configuration outside of `workspace.json`.",
|
|
"implementation": "/packages/workspace/src/generators/convert-to-nx-project/convert-to-nx-project#convertToNxProjectGenerator.ts",
|
|
"aliases": [],
|
|
"hidden": false,
|
|
"path": "/packages/workspace/src/generators/convert-to-nx-project/schema.json"
|
|
},
|
|
{
|
|
"name": "npm-package",
|
|
"factory": "./src/generators/npm-package/npm-package#npmPackageGenerator",
|
|
"schema": {
|
|
"$schema": "http://json-schema.org/schema",
|
|
"$id": "NxWorkspaceNpmPackage",
|
|
"title": "Add a minimal npm package",
|
|
"description": "Add a minimal npm package.",
|
|
"cli": "nx",
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Package name.",
|
|
"$default": { "$source": "argv", "index": 0 },
|
|
"x-prompt": "What name of your npm package?",
|
|
"pattern": "^[a-zA-Z].*$"
|
|
}
|
|
},
|
|
"required": ["name"],
|
|
"presets": []
|
|
},
|
|
"description": "Create a minimal NPM package.",
|
|
"x-type": "library",
|
|
"implementation": "/packages/workspace/src/generators/npm-package/npm-package#npmPackageGenerator.ts",
|
|
"aliases": [],
|
|
"hidden": false,
|
|
"path": "/packages/workspace/src/generators/npm-package/schema.json"
|
|
},
|
|
{
|
|
"name": "ci-workflow",
|
|
"factory": "./src/generators/ci-workflow/ci-workflow#ciWorkflowGenerator",
|
|
"schema": {
|
|
"$schema": "http://json-schema.org/schema",
|
|
"$id": "NxWorkspaceCIWorkflow",
|
|
"title": "Generate a CI workflow.",
|
|
"description": "Generate a CI workflow.",
|
|
"cli": "nx",
|
|
"type": "object",
|
|
"properties": {
|
|
"ci": {
|
|
"type": "string",
|
|
"description": "CI provider.",
|
|
"enum": ["github", "circleci", "azure"],
|
|
"x-prompt": {
|
|
"message": "What is your target CI provider?",
|
|
"type": "list",
|
|
"items": [
|
|
{ "value": "github", "label": "Github Actions" },
|
|
{ "value": "circleci", "label": "Circle CI" },
|
|
{ "value": "azure", "label": "Azure DevOps" }
|
|
]
|
|
}
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Workflow name.",
|
|
"$default": { "$source": "argv", "index": 0 },
|
|
"default": "CI",
|
|
"x-prompt": "How should we name your workflow?",
|
|
"pattern": "^[a-zA-Z].*$"
|
|
}
|
|
},
|
|
"required": ["ci"],
|
|
"presets": []
|
|
},
|
|
"description": "Generate a CI workflow.",
|
|
"implementation": "/packages/workspace/src/generators/ci-workflow/ci-workflow#ciWorkflowGenerator.ts",
|
|
"aliases": [],
|
|
"hidden": false,
|
|
"path": "/packages/workspace/src/generators/ci-workflow/schema.json"
|
|
}
|
|
],
|
|
"executors": [
|
|
{
|
|
"name": "run-commands",
|
|
"implementation": "/packages/workspace/src/executors/run-commands/run-commands.impl.ts",
|
|
"schema": {
|
|
"title": "Run Commands",
|
|
"description": "Run any custom commands with Nx.",
|
|
"type": "object",
|
|
"cli": "nx",
|
|
"outputCapture": "pipe",
|
|
"presets": [
|
|
{ "name": "Arguments forwarding", "keys": ["commands"] },
|
|
{
|
|
"name": "Custom done conditions",
|
|
"keys": ["commands", "readyWhen"]
|
|
},
|
|
{ "name": "Setting the cwd", "keys": ["commands", "cwd"] }
|
|
],
|
|
"properties": {
|
|
"commands": {
|
|
"type": "array",
|
|
"description": "Commands to run in child process.",
|
|
"items": {
|
|
"oneOf": [
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"command": {
|
|
"type": "string",
|
|
"description": "Command to run in child process."
|
|
},
|
|
"forwardAllArgs": {
|
|
"type": "boolean",
|
|
"description": "Whether arguments should be forwarded when interpolation is not present."
|
|
},
|
|
"prefix": {
|
|
"type": "string",
|
|
"description": "Prefix in front of every line out of the output"
|
|
},
|
|
"color": {
|
|
"type": "string",
|
|
"description": "Color of the output",
|
|
"enum": [
|
|
"black",
|
|
"red",
|
|
"green",
|
|
"yellow",
|
|
"blue",
|
|
"magenta",
|
|
"cyan",
|
|
"white"
|
|
]
|
|
},
|
|
"bgColor": {
|
|
"type": "string",
|
|
"description": "Background color of the output",
|
|
"enum": [
|
|
"bgBlack",
|
|
"bgRed",
|
|
"bgGreen",
|
|
"bgYellow",
|
|
"bgBlue",
|
|
"bgMagenta",
|
|
"bgCyan",
|
|
"bgWhite"
|
|
]
|
|
},
|
|
"description": {
|
|
"type": "string",
|
|
"description": "An optional description useful for inline documentation purposes. It is not used as part of the execution of the command."
|
|
}
|
|
},
|
|
"additionalProperties": false,
|
|
"required": ["command"]
|
|
},
|
|
{ "type": "string" }
|
|
]
|
|
}
|
|
},
|
|
"command": {
|
|
"type": "string",
|
|
"description": "Command to run in child process."
|
|
},
|
|
"parallel": {
|
|
"type": "boolean",
|
|
"description": "Run commands in parallel.",
|
|
"default": true
|
|
},
|
|
"readyWhen": {
|
|
"type": "string",
|
|
"description": "String to appear in `stdout` or `stderr` that indicates that the task is done. When running multiple commands, this option can only be used when `parallel` is set to `true`. If not specified, the task is done when all the child processes complete."
|
|
},
|
|
"args": {
|
|
"type": "string",
|
|
"description": "Extra arguments. You can pass them as follows: nx run project:target --args='--wait=100'. You can then use {args.wait} syntax to interpolate them in the workspace config file. See example [above](#chaining-commands-interpolating-args-and-setting-the-cwd)"
|
|
},
|
|
"envFile": {
|
|
"type": "string",
|
|
"description": "You may specify a custom .env file path."
|
|
},
|
|
"color": {
|
|
"type": "boolean",
|
|
"description": "Use colors when showing output of command.",
|
|
"default": false
|
|
},
|
|
"outputPath": {
|
|
"description": "Allows you to specify where the build artifacts are stored. This allows Nx Cloud to pick them up correctly, in the case that the build artifacts are placed somewhere other than the top level dist folder.",
|
|
"oneOf": [
|
|
{ "type": "string" },
|
|
{ "type": "array", "items": { "type": "string" } }
|
|
]
|
|
},
|
|
"cwd": {
|
|
"type": "string",
|
|
"description": "Current working directory of the commands. If it's not specified the commands will run in the workspace root, if a relative path is specified the commands will run in that path relative to the workspace root and if it's an absolute path the commands will run in that path."
|
|
},
|
|
"__unparsed__": {
|
|
"hidden": true,
|
|
"type": "array",
|
|
"items": { "type": "string" },
|
|
"$default": { "$source": "unparsed" }
|
|
}
|
|
},
|
|
"additionalProperties": true,
|
|
"required": ["__unparsed__"],
|
|
"examplesFile": "`workspace.json`:\n\n```json\n//...\n\"frontend\": {\n \"targets\": {\n //...\n \"ls-project-root\": {\n \"executor\": \"nx:run-commands\",\n \"options\": {\n \"command\": \"ls apps/frontend/src\"\n }\n }\n }\n}\n```\n\n```bash\nnx run frontend:ls-project-root\n```\n\n##### Chaining commands, interpolating args and setting the cwd\n\nLet's say each of our workspace projects has some custom bash scripts in a `scripts` folder.\nWe want a simple way to create empty bash script files for a given project, that have the execute permissions already set.\n\nGiven that Nx knows our workspace structure, we should be able to give it a project and the name of our script, and it should take care of the rest.\n\nThe `commands` option accepts as many commands as you want. By default, they all run in parallel.\nYou can run them sequentially by setting `parallel: false`:\n\n```json\n\"create-script\": {\n \"executor\": \"nx:run-commands\",\n \"options\": {\n \"commands\": [\n \"mkdir -p scripts\",\n \"touch scripts/{args.name}.sh\",\n \"chmod +x scripts/{args.name}.sh\"\n ],\n \"cwd\": \"apps/frontend\",\n \"parallel\": false\n }\n}\n```\n\nBy setting the `cwd` option, each command will run in the `apps/frontend` folder.\n\nWe run the above with:\n\n```bash\nnx run frontend:create-script --args=\"--name=example\"\n```\n\nor simply with:\n\n```bash\nnx run frontend:create-script --name=example\n```\n\n##### Arguments forwarding\n\nWhen interpolation is not present in the command, all arguments are forwarded to the command by default.\n\nThis is useful when you need to pass raw argument strings to your command.\n\nFor example, when you run:\n\nnx run frontend:webpack --args=\"--config=example.config.js\"\n\n```json\n\"webpack\": {\n \"executor\": \"nx:run-commands\",\n \"options\": {\n \"command\": \"webpack\"\n }\n}\n```\n\nThe above command will execute: `webpack --config=example.config.js`\n\nThis functionality can be disabled by using `commands` and expanding each `command` into an object\nthat sets the `forwardAllArgs` option to `false` as shown below:\n\n```json\n\"webpack\": {\n \"executor\": \"nx:run-commands\",\n \"options\": {\n \"commands\": [\n {\n \"command\": \"webpack\",\n \"forwardAllArgs\": false\n }\n ]\n }\n}\n```\n\n##### Custom **done** conditions\n\nNormally, `run-commands` considers the commands done when all of them have finished running. If you don't need to wait until they're all done, you can set a special string that considers the commands finished the moment the string appears in `stdout` or `stderr`:\n\n```json\n\"finish-when-ready\": {\n \"executor\": \"nx:run-commands\",\n \"options\": {\n \"commands\": [\n \"sleep 5 && echo 'FINISHED'\",\n \"echo 'READY'\"\n ],\n \"readyWhen\": \"READY\",\n \"parallel\": true\n }\n}\n```\n\n```bash\nnx run frontend:finish-when-ready\n```\n\nThe above commands will finish immediately, instead of waiting for 5 seconds.\n\n##### Nx Affected\n\nThe true power of `run-commands` comes from the fact that it runs through `nx`, which knows about your project graph. So you can run **custom commands** only for the projects that have been affected by a change.\n\nWe can create some configurations to generate docs, and if run using `nx affected`, it will only generate documentation for the projects that have been changed:\n\n```bash\nnx affected --target=generate-docs\n```\n\n```json\n//...\n\"frontend\": {\n \"targets\": {\n //...\n \"generate-docs\": {\n \"executor\": \"nx:run-commands\",\n \"options\": {\n \"command\": \"npx compodoc -p apps/frontend/tsconfig.app.json\"\n }\n }\n }\n},\n\"api\": {\n \"targets\": {\n //...\n \"generate-docs\": {\n \"executor\": \"nx:run-commands\",\n \"options\": {\n \"command\": \"npx compodoc -p apps/api/tsconfig.app.json\"\n }\n }\n }\n}\n```\n"
|
|
},
|
|
"description": "Run any custom commands with Nx.",
|
|
"aliases": [],
|
|
"hidden": false,
|
|
"path": "/packages/workspace/src/executors/run-commands/schema.json"
|
|
},
|
|
{
|
|
"name": "counter",
|
|
"implementation": "/packages/workspace/src/executors/counter/counter.impl.ts",
|
|
"batchImplementation": "./src/executors/counter/counter.impl#batchCounter",
|
|
"schema": {
|
|
"title": "Counter",
|
|
"description": "A dummy executor useful for E2E tests.",
|
|
"type": "object",
|
|
"cli": "nx",
|
|
"outputCapture": "pipe",
|
|
"properties": {
|
|
"to": { "type": "number", "description": "Count to this number." },
|
|
"result": { "type": "boolean", "description": "Final result." }
|
|
},
|
|
"additionalProperties": true,
|
|
"required": ["to"],
|
|
"presets": []
|
|
},
|
|
"description": "A dummy executor useful for E2E tests.",
|
|
"hidden": true,
|
|
"aliases": [],
|
|
"path": "/packages/workspace/src/executors/counter/schema.json"
|
|
},
|
|
{
|
|
"name": "run-script",
|
|
"implementation": "/packages/workspace/src/executors/run-script/run-script.impl.ts",
|
|
"schema": {
|
|
"title": "Run Script",
|
|
"description": "Run any NPM script of a project in the project's root directory.",
|
|
"type": "object",
|
|
"cli": "nx",
|
|
"outputCapture": "pipe",
|
|
"properties": {
|
|
"script": {
|
|
"type": "string",
|
|
"description": "An npm script name in the `package.json` file of the project (e.g., `build`)."
|
|
},
|
|
"__unparsed__": {
|
|
"hidden": true,
|
|
"type": "array",
|
|
"items": { "type": "string" },
|
|
"$default": { "$source": "unparsed" }
|
|
}
|
|
},
|
|
"additionalProperties": true,
|
|
"required": ["script", "__unparsed__"],
|
|
"examplesFile": "`workspace.json`:\n\n```json\n\"frontend\": {\n \"root\": \"packages/frontend\",\n \"targets\": {\n \"build\": {\n \"executor\": \"nx:run-script\",\n \"options\": {\n \"script\": \"build-my-project\"\n }\n }\n }\n}\n```\n\n```bash\nnx run frontend:build\n```\n\nThe `build` target is going to run `npm run build-my-project` (or `yarn build-my-project`) in the `packages/frontend` directory.\n\n#### Caching Artifacts\n\nBy default, Nx is going to cache `dist/packages/frontend`, `packages/frontend/dist`, `packages/frontend/build`, `packages/frontend/public`. If your npm script writes files to other places, you can override the list of cached outputs as follows:\n\n```json\n\"frontend\": {\n \"root\": \"packages/frontend\",\n \"targets\": {\n \"build\": {\n \"executor\": \"nx:run-script\",\n \"outputs\": [\"packages/frontend/dist\", \"packaged/frontend/docs\"],\n \"options\": {\n \"script\": \"build-my-project\"\n }\n }\n }\n}\n```\n",
|
|
"presets": []
|
|
},
|
|
"description": "Run an NPM script using Nx.",
|
|
"aliases": [],
|
|
"hidden": false,
|
|
"path": "/packages/workspace/src/executors/run-script/schema.json"
|
|
}
|
|
]
|
|
}
|