docs(nxdev): update content (#7975)
This commit is contained in:
parent
a8d5ac11b0
commit
4470ebd4bc
@ -22,6 +22,12 @@ Possible values: `dependencies`, `peerDependencies`
|
||||
|
||||
When `updateBuildableProjectDepsInPackageJson` is `true`, this adds dependencies to either `peerDependencies` or `dependencies`.
|
||||
|
||||
### tailwindConfig
|
||||
|
||||
Type: `string`
|
||||
|
||||
The full path for the Tailwind configuration file, relative to the workspace root. If not provided and a `tailwind.config.js` file exists in the project or workspace root, it will be used. Otherwise, Tailwind will not be configured.
|
||||
|
||||
### tsConfig
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -22,6 +22,12 @@ Possible values: `dependencies`, `peerDependencies`
|
||||
|
||||
When `updateBuildableProjectDepsInPackageJson` is `true`, this adds dependencies to either `peerDependencies` or `dependencies`.
|
||||
|
||||
### tailwindConfig
|
||||
|
||||
Type: `string`
|
||||
|
||||
The full path for the Tailwind configuration file, relative to the workspace root. If not provided and a `tailwind.config.js` file exists in the project or workspace root, it will be used. Otherwise, Tailwind will not be configured.
|
||||
|
||||
### tsConfig
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -44,6 +44,14 @@ Type: `boolean`
|
||||
|
||||
Generate a buildable library.
|
||||
|
||||
### compilationMode
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `full`, `partial`
|
||||
|
||||
Specifies the compilation mode to use. If not specified, it will default to `partial` for publishable libraries and to `full` for buildable libraries. The `full` value can not be used for publishable libraries.
|
||||
|
||||
### directory
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# @nrwl/workspace:tsc
|
||||
# @nrwl/js:tsc
|
||||
|
||||
Build a project using TypeScript.
|
||||
|
||||
@ -0,0 +1,161 @@
|
||||
# @nrwl/js:application
|
||||
|
||||
Create a application
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
nx generate application ...
|
||||
```
|
||||
|
||||
```bash
|
||||
nx g app ... # same
|
||||
```
|
||||
|
||||
By default, Nx will search for `application` in the default collection provisioned in `angular.json`.
|
||||
|
||||
You can specify the collection explicitly as follows:
|
||||
|
||||
```bash
|
||||
nx g @nrwl/js:application ...
|
||||
```
|
||||
|
||||
Show what will be generated without writing to disk:
|
||||
|
||||
```bash
|
||||
nx g application ... --dry-run
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
Generate libs/myapp/mylib:
|
||||
|
||||
```bash
|
||||
nx g lib mylib --directory=myapp
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### name (_**required**_)
|
||||
|
||||
Type: `string`
|
||||
|
||||
Library name
|
||||
|
||||
### compiler
|
||||
|
||||
Default: `tsc`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `tsc`, `swc`
|
||||
|
||||
The compiler used by the build and test targets
|
||||
|
||||
### config
|
||||
|
||||
Default: `project`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `workspace`, `project`, `npm-scripts`
|
||||
|
||||
Determines how whether the project's executors should be configured in workspace.json, project.json or as npm scripts
|
||||
|
||||
### directory
|
||||
|
||||
Type: `string`
|
||||
|
||||
A directory where the lib is placed
|
||||
|
||||
### importPath
|
||||
|
||||
Type: `string`
|
||||
|
||||
The library name used to import it, like @myorg/my-awesome-lib
|
||||
|
||||
### js
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Generate JavaScript files rather than TypeScript files
|
||||
|
||||
### linter
|
||||
|
||||
Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `eslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
### pascalCaseFiles
|
||||
|
||||
Alias(es): P
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Use pascal case file names.
|
||||
|
||||
### setParserOptionsProject
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether or not to configure the ESLint "parserOptions.project" option. We do not do this by default for lint performance reasons.
|
||||
|
||||
### skipFormat
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Skip formatting files
|
||||
|
||||
### skipTsConfig
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Do not update tsconfig.json for development experience.
|
||||
|
||||
### strict
|
||||
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether to enable tsconfig strict mode or not.
|
||||
|
||||
### tags
|
||||
|
||||
Type: `string`
|
||||
|
||||
Add tags to the library (used for linting)
|
||||
|
||||
### testEnvironment
|
||||
|
||||
Default: `jsdom`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `jsdom`, `node`
|
||||
|
||||
The test environment to use if unitTestRunner is set to jest
|
||||
|
||||
### unitTestRunner
|
||||
|
||||
Default: `jest`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `jest`, `none`
|
||||
|
||||
Test runner to use for unit tests
|
||||
@ -0,0 +1,169 @@
|
||||
# @nrwl/js:library
|
||||
|
||||
Create a library
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
nx generate library ...
|
||||
```
|
||||
|
||||
```bash
|
||||
nx g lib ... # same
|
||||
```
|
||||
|
||||
By default, Nx will search for `library` in the default collection provisioned in `angular.json`.
|
||||
|
||||
You can specify the collection explicitly as follows:
|
||||
|
||||
```bash
|
||||
nx g @nrwl/js:library ...
|
||||
```
|
||||
|
||||
Show what will be generated without writing to disk:
|
||||
|
||||
```bash
|
||||
nx g library ... --dry-run
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
Generate libs/myapp/mylib:
|
||||
|
||||
```bash
|
||||
nx g lib mylib --directory=myapp
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### name (_**required**_)
|
||||
|
||||
Type: `string`
|
||||
|
||||
Library name
|
||||
|
||||
### buildable
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Generate a buildable library.
|
||||
|
||||
### compiler
|
||||
|
||||
Default: `tsc`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `tsc`, `swc`
|
||||
|
||||
The compiler used by the build and test targets
|
||||
|
||||
### config
|
||||
|
||||
Default: `project`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `workspace`, `project`, `npm-scripts`
|
||||
|
||||
Determines how whether the project's executors should be configured in workspace.json, project.json or as npm scripts
|
||||
|
||||
### directory
|
||||
|
||||
Type: `string`
|
||||
|
||||
A directory where the lib is placed
|
||||
|
||||
### importPath
|
||||
|
||||
Type: `string`
|
||||
|
||||
The library name used to import it, like @myorg/my-awesome-lib
|
||||
|
||||
### js
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Generate JavaScript files rather than TypeScript files
|
||||
|
||||
### linter
|
||||
|
||||
Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `eslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
### pascalCaseFiles
|
||||
|
||||
Alias(es): P
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Use pascal case file names.
|
||||
|
||||
### setParserOptionsProject
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether or not to configure the ESLint "parserOptions.project" option. We do not do this by default for lint performance reasons.
|
||||
|
||||
### skipFormat
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Skip formatting files
|
||||
|
||||
### skipTsConfig
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Do not update tsconfig.json for development experience.
|
||||
|
||||
### strict
|
||||
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether to enable tsconfig strict mode or not.
|
||||
|
||||
### tags
|
||||
|
||||
Type: `string`
|
||||
|
||||
Add tags to the library (used for linting)
|
||||
|
||||
### testEnvironment
|
||||
|
||||
Default: `jsdom`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `jsdom`, `node`
|
||||
|
||||
The test environment to use if unitTestRunner is set to jest
|
||||
|
||||
### unitTestRunner
|
||||
|
||||
Default: `jest`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `jest`, `none`
|
||||
|
||||
Test runner to use for unit tests
|
||||
@ -110,6 +110,14 @@ Type: `boolean`
|
||||
|
||||
Defines the optimization level of the build.
|
||||
|
||||
### outputFileName
|
||||
|
||||
Default: `main.js`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Name of the main output file. (defaults to 'main.js')
|
||||
|
||||
### outputPath
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -885,7 +885,7 @@ Example:
|
||||
|
||||
### getWorkspacePath
|
||||
|
||||
▸ **getWorkspacePath**(`tree`): `string`
|
||||
▸ **getWorkspacePath**(`tree`): `"/angular.json"` \| `"/workspace.json"` \| `null`
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -895,7 +895,7 @@ Example:
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
`"/angular.json"` \| `"/workspace.json"` \| `null`
|
||||
|
||||
---
|
||||
|
||||
@ -1061,9 +1061,9 @@ By default javascript-style comments are allowed.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1113,9 +1113,9 @@ Reads a json file, removes all comments and parses JSON.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1139,9 +1139,9 @@ Reads a JSON file and returns the object the JSON content represents.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1346,9 +1346,9 @@ By default the JSON string is formatted with a 2 space intendation to be easy re
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :------------------------- |
|
||||
| `T` | extends ` object``object ` |
|
||||
| Name | Type |
|
||||
| :--- | :-------------------------- |
|
||||
| `T` | extends `object` = `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1459,10 +1459,10 @@ Updates a JSON value to the file system tree
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| `U` | extends ` object``T ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
| `U` | extends `object` = `T` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1569,9 +1569,9 @@ Writes a JSON value to the file system tree
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :------------------------- |
|
||||
| `T` | extends ` object``object ` |
|
||||
| Name | Type |
|
||||
| :--- | :-------------------------- |
|
||||
| `T` | extends `object` = `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1596,9 +1596,9 @@ Serializes the given data to JSON and writes it to a file.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :------------------------- |
|
||||
| `T` | extends ` object``object ` |
|
||||
| Name | Type |
|
||||
| :--- | :-------------------------- |
|
||||
| `T` | extends `object` = `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
|
||||
@ -56,6 +56,14 @@ Type: `number`
|
||||
|
||||
The port where the packager server is listening on.
|
||||
|
||||
### resetCache
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Resets metro cache
|
||||
|
||||
### sync
|
||||
|
||||
Default: `true`
|
||||
|
||||
@ -36,6 +36,14 @@ Type: `number`
|
||||
|
||||
The port where the packager server is listening on.
|
||||
|
||||
### resetCache
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Resets metro cache
|
||||
|
||||
### scheme
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# @nrwl/web:package
|
||||
# @nrwl/web:rollup
|
||||
|
||||
Package a library
|
||||
Package a library using rollup
|
||||
|
||||
Options can be configured in `angular.json` when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/core-concepts/configuration#targets.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# @nrwl/web:build
|
||||
# @nrwl/web:webpack
|
||||
|
||||
Build a application
|
||||
Build an application using webpack
|
||||
|
||||
Options can be configured in `angular.json` when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/core-concepts/configuration#targets.
|
||||
|
||||
@ -18,12 +18,6 @@ Run build in parallel:
|
||||
nx affected:build --parallel=5
|
||||
```
|
||||
|
||||
Rerun the build target only for the projects that failed last time:
|
||||
|
||||
```bash
|
||||
nx affected:build --only-failed
|
||||
```
|
||||
|
||||
Run the build target for all projects:
|
||||
|
||||
```bash
|
||||
|
||||
@ -18,12 +18,6 @@ Run tests in parallel:
|
||||
nx affected:e2e --parallel=5
|
||||
```
|
||||
|
||||
Rerun the test target only for the projects that failed last time:
|
||||
|
||||
```bash
|
||||
nx affected:e2e --only-failed
|
||||
```
|
||||
|
||||
Run the test target for all projects:
|
||||
|
||||
```bash
|
||||
|
||||
@ -18,12 +18,6 @@ Run lint in parallel:
|
||||
nx affected:lint --parallel=5
|
||||
```
|
||||
|
||||
Rerun the lint target only for the projects that failed last time:
|
||||
|
||||
```bash
|
||||
nx affected:lint --only-failed
|
||||
```
|
||||
|
||||
Run the lint target for all projects:
|
||||
|
||||
```bash
|
||||
|
||||
@ -18,12 +18,6 @@ Run tests in parallel:
|
||||
nx affected:test --parallel=5
|
||||
```
|
||||
|
||||
Rerun the test target only for the projects that failed last time:
|
||||
|
||||
```bash
|
||||
nx affected:test --only-failed
|
||||
```
|
||||
|
||||
Run the test target for all projects:
|
||||
|
||||
```bash
|
||||
|
||||
@ -24,12 +24,6 @@ Run tests in parallel:
|
||||
nx affected --target=test --parallel=5
|
||||
```
|
||||
|
||||
Rerun the test target only for the projects that failed last time:
|
||||
|
||||
```bash
|
||||
nx affected --target=test --only-failed
|
||||
```
|
||||
|
||||
Run the test target for all projects:
|
||||
|
||||
```bash
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
"detox",
|
||||
"gatsby",
|
||||
"jest",
|
||||
"js",
|
||||
"linter",
|
||||
"next",
|
||||
"node",
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
"express",
|
||||
"gatsby",
|
||||
"jest",
|
||||
"js",
|
||||
"linter",
|
||||
"nest",
|
||||
"next",
|
||||
|
||||
@ -15,7 +15,7 @@ The `angular.json` configuration file contains information about the targets and
|
||||
"projectType": "application",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@nrwl/web:build",
|
||||
"builder": "@nrwl/web:webpack",
|
||||
"outputs": ["dist/apps/myapp"],
|
||||
"dependsOn": [
|
||||
{
|
||||
@ -137,7 +137,7 @@ The `outputs` property lists the folders the builder creates files in. The prope
|
||||
```json
|
||||
{
|
||||
"build": {
|
||||
"builder": "@nrwl/web:build",
|
||||
"builder": "@nrwl/web:webpack",
|
||||
"outputs": ["dist/apps/myapp"],
|
||||
"options": {
|
||||
"index": "apps/myapp/src/app.html",
|
||||
@ -154,7 +154,7 @@ The `configurations` property provides extra sets of values that will be merged
|
||||
```json
|
||||
{
|
||||
"build": {
|
||||
"builder": "@nrwl/web:build",
|
||||
"builder": "@nrwl/web:webpack",
|
||||
"outputs": ["dist/apps/myapp"],
|
||||
"options": {
|
||||
"index": "apps/myapp/src/app.html",
|
||||
@ -186,7 +186,7 @@ Targets can depend on other targets. A common scenario is having to build depend
|
||||
```json
|
||||
{
|
||||
"build": {
|
||||
"executor": "@nrwl/web:build",
|
||||
"executor": "@nrwl/web:webpack",
|
||||
"outputs": ["dist/apps/myapp"],
|
||||
"options": {
|
||||
"index": "apps/myapp/src/app.html",
|
||||
@ -211,7 +211,7 @@ In the following example invoking `nx build myapp` builds all the libraries firs
|
||||
```json
|
||||
{
|
||||
"build-base": {
|
||||
"executor": "@nrwl/web:build",
|
||||
"executor": "@nrwl/web:webpack",
|
||||
"outputs": ["dist/apps/myapp"],
|
||||
"options": {
|
||||
"index": "apps/myapp/src/app.html",
|
||||
|
||||
@ -411,7 +411,7 @@ To use webpack instead of gulp, go back to your `angular.json` file and modify t
|
||||
```json
|
||||
...
|
||||
"build": {
|
||||
"executor": "@nrwl/web:build",
|
||||
"executor": "@nrwl/web:webpack",
|
||||
"options": {
|
||||
"outputPath": "dist/apps/realworld",
|
||||
"index": "apps/realworld/src/index.html",
|
||||
|
||||
@ -23,15 +23,15 @@ git checkout -b testbranch
|
||||
Run the command to see affected apps.
|
||||
|
||||
```sh
|
||||
npm run affected:apps
|
||||
npx nx affected:apps
|
||||
```
|
||||
|
||||
You should see `todos` printed out. The `affected:apps` looks at what you have changed and uses the dependency graph to figure out which apps can be affected by this change.
|
||||
|
||||
Run the command to see affected libraries
|
||||
|
||||
```
|
||||
npm run affected:libs
|
||||
```sh
|
||||
npx nx affected:libs
|
||||
```
|
||||
|
||||
You should see `ui` printed out. This command works similarly, but instead of printing the affected apps, it prints the affected libs.
|
||||
@ -67,7 +67,7 @@ Note that Nx only tried to retest `ui` and `todos`. It didn't retest `api` or `d
|
||||
Run the command to retest the failed projects.
|
||||
|
||||
```sh
|
||||
npm run affected:test -- --only-failed
|
||||
npx nx affected:test -- --only-failed
|
||||
```
|
||||
|
||||
## Affected:
|
||||
|
||||
@ -7,5 +7,6 @@
|
||||
"node",
|
||||
"storybook",
|
||||
"web",
|
||||
"workspace"
|
||||
"workspace",
|
||||
"js"
|
||||
]
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
"id": "05-add-node-app"
|
||||
},
|
||||
{
|
||||
"name": "6 - Configure Proxy",
|
||||
"name": "6 - Proxy Configuration",
|
||||
"id": "06-proxy"
|
||||
},
|
||||
{
|
||||
@ -352,11 +352,27 @@
|
||||
"name": "run-script executor",
|
||||
"id": "run-script",
|
||||
"file": "angular/api-workspace/executors/run-script"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "js",
|
||||
"id": "js",
|
||||
"itemList": [
|
||||
{
|
||||
"name": "application generator",
|
||||
"id": "application",
|
||||
"file": "angular/api-js/generators/application"
|
||||
},
|
||||
{
|
||||
"name": "library generator",
|
||||
"id": "library",
|
||||
"file": "angular/api-js/generators/library"
|
||||
},
|
||||
{
|
||||
"name": "tsc executor",
|
||||
"id": "tsc",
|
||||
"file": "angular/api-workspace/executors/tsc"
|
||||
"file": "angular/api-js/executors/tsc"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -378,7 +394,7 @@
|
||||
{
|
||||
"name": "build executor",
|
||||
"id": "build",
|
||||
"file": "angular/api-web/executors/build"
|
||||
"file": "angular/api-web/executors/webpack"
|
||||
},
|
||||
{
|
||||
"name": "dev-server executor",
|
||||
@ -393,7 +409,7 @@
|
||||
{
|
||||
"name": "package executor",
|
||||
"id": "package",
|
||||
"file": "angular/api-web/executors/package"
|
||||
"file": "angular/api-web/executors/rollup"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -1188,6 +1204,11 @@
|
||||
"id": "monorepo-ci-jenkins",
|
||||
"file": "shared/monorepo-ci-jenkins"
|
||||
},
|
||||
{
|
||||
"name": "Setting up GitLab",
|
||||
"id": "monorepo-ci-gitlab",
|
||||
"file": "shared/monorepo-ci-gitlab"
|
||||
},
|
||||
{
|
||||
"name": "Distributed CI",
|
||||
"id": "distributed-builds",
|
||||
@ -1370,7 +1391,7 @@
|
||||
"id": "05-add-node-app"
|
||||
},
|
||||
{
|
||||
"name": "6 - Configure Proxy",
|
||||
"name": "6 - Proxy Configuration",
|
||||
"id": "06-proxy"
|
||||
},
|
||||
{
|
||||
@ -1660,11 +1681,27 @@
|
||||
"name": "run-script executor",
|
||||
"id": "run-script",
|
||||
"file": "react/api-workspace/executors/run-script"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "js",
|
||||
"id": "js",
|
||||
"itemList": [
|
||||
{
|
||||
"name": "application generator",
|
||||
"id": "application",
|
||||
"file": "react/api-js/generators/application"
|
||||
},
|
||||
{
|
||||
"name": "library generator",
|
||||
"id": "library",
|
||||
"file": "react/api-js/generators/library"
|
||||
},
|
||||
{
|
||||
"name": "tsc executor",
|
||||
"id": "tsc",
|
||||
"file": "react/api-workspace/executors/tsc"
|
||||
"file": "react/api-js/executors/tsc"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -1686,7 +1723,7 @@
|
||||
{
|
||||
"name": "build executor",
|
||||
"id": "build",
|
||||
"file": "react/api-web/executors/build"
|
||||
"file": "react/api-web/executors/webpack"
|
||||
},
|
||||
{
|
||||
"name": "dev-server executor",
|
||||
@ -1701,7 +1738,7 @@
|
||||
{
|
||||
"name": "package executor",
|
||||
"id": "package",
|
||||
"file": "react/api-web/executors/package"
|
||||
"file": "react/api-web/executors/rollup"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -2502,6 +2539,11 @@
|
||||
"id": "monorepo-ci-jenkins",
|
||||
"file": "shared/monorepo-ci-jenkins"
|
||||
},
|
||||
{
|
||||
"name": "Setting up GitLab",
|
||||
"id": "monorepo-ci-gitlab",
|
||||
"file": "shared/monorepo-ci-gitlab"
|
||||
},
|
||||
{
|
||||
"name": "Distributed CI",
|
||||
"id": "distributed-builds",
|
||||
@ -2932,11 +2974,27 @@
|
||||
"name": "run-script executor",
|
||||
"id": "run-script",
|
||||
"file": "node/api-workspace/executors/run-script"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "js",
|
||||
"id": "js",
|
||||
"itemList": [
|
||||
{
|
||||
"name": "application generator",
|
||||
"id": "application",
|
||||
"file": "node/api-js/generators/application"
|
||||
},
|
||||
{
|
||||
"name": "library generator",
|
||||
"id": "library",
|
||||
"file": "node/api-js/generators/library"
|
||||
},
|
||||
{
|
||||
"name": "tsc executor",
|
||||
"id": "tsc",
|
||||
"file": "node/api-workspace/executors/tsc"
|
||||
"file": "node/api-js/executors/tsc"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -2958,7 +3016,7 @@
|
||||
{
|
||||
"name": "build executor",
|
||||
"id": "build",
|
||||
"file": "node/api-web/executors/build"
|
||||
"file": "node/api-web/executors/webpack"
|
||||
},
|
||||
{
|
||||
"name": "dev-server executor",
|
||||
@ -2973,7 +3031,7 @@
|
||||
{
|
||||
"name": "package executor",
|
||||
"id": "package",
|
||||
"file": "node/api-web/executors/package"
|
||||
"file": "node/api-web/executors/rollup"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -3757,6 +3815,11 @@
|
||||
"id": "monorepo-ci-jenkins",
|
||||
"file": "shared/monorepo-ci-jenkins"
|
||||
},
|
||||
{
|
||||
"name": "Setting up GitLab",
|
||||
"id": "monorepo-ci-gitlab",
|
||||
"file": "shared/monorepo-ci-gitlab"
|
||||
},
|
||||
{
|
||||
"name": "Distributed CI",
|
||||
"id": "distributed-builds",
|
||||
|
||||
@ -22,6 +22,12 @@ Possible values: `dependencies`, `peerDependencies`
|
||||
|
||||
When `updateBuildableProjectDepsInPackageJson` is `true`, this adds dependencies to either `peerDependencies` or `dependencies`.
|
||||
|
||||
### tailwindConfig
|
||||
|
||||
Type: `string`
|
||||
|
||||
The full path for the Tailwind configuration file, relative to the workspace root. If not provided and a `tailwind.config.js` file exists in the project or workspace root, it will be used. Otherwise, Tailwind will not be configured.
|
||||
|
||||
### tsConfig
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -22,6 +22,12 @@ Possible values: `dependencies`, `peerDependencies`
|
||||
|
||||
When `updateBuildableProjectDepsInPackageJson` is `true`, this adds dependencies to either `peerDependencies` or `dependencies`.
|
||||
|
||||
### tailwindConfig
|
||||
|
||||
Type: `string`
|
||||
|
||||
The full path for the Tailwind configuration file, relative to the workspace root. If not provided and a `tailwind.config.js` file exists in the project or workspace root, it will be used. Otherwise, Tailwind will not be configured.
|
||||
|
||||
### tsConfig
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -44,6 +44,14 @@ Type: `boolean`
|
||||
|
||||
Generate a buildable library.
|
||||
|
||||
### compilationMode
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `full`, `partial`
|
||||
|
||||
Specifies the compilation mode to use. If not specified, it will default to `partial` for publishable libraries and to `full` for buildable libraries. The `full` value can not be used for publishable libraries.
|
||||
|
||||
### directory
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# @nrwl/workspace:tsc
|
||||
# @nrwl/js:tsc
|
||||
|
||||
Build a project using TypeScript.
|
||||
|
||||
@ -0,0 +1,161 @@
|
||||
# @nrwl/js:application
|
||||
|
||||
Create a application
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
nx generate application ...
|
||||
```
|
||||
|
||||
```bash
|
||||
nx g app ... # same
|
||||
```
|
||||
|
||||
By default, Nx will search for `application` in the default collection provisioned in `workspace.json`.
|
||||
|
||||
You can specify the collection explicitly as follows:
|
||||
|
||||
```bash
|
||||
nx g @nrwl/js:application ...
|
||||
```
|
||||
|
||||
Show what will be generated without writing to disk:
|
||||
|
||||
```bash
|
||||
nx g application ... --dry-run
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
Generate libs/myapp/mylib:
|
||||
|
||||
```bash
|
||||
nx g lib mylib --directory=myapp
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### name (_**required**_)
|
||||
|
||||
Type: `string`
|
||||
|
||||
Library name
|
||||
|
||||
### compiler
|
||||
|
||||
Default: `tsc`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `tsc`, `swc`
|
||||
|
||||
The compiler used by the build and test targets
|
||||
|
||||
### config
|
||||
|
||||
Default: `project`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `workspace`, `project`, `npm-scripts`
|
||||
|
||||
Determines how whether the project's executors should be configured in workspace.json, project.json or as npm scripts
|
||||
|
||||
### directory
|
||||
|
||||
Type: `string`
|
||||
|
||||
A directory where the lib is placed
|
||||
|
||||
### importPath
|
||||
|
||||
Type: `string`
|
||||
|
||||
The library name used to import it, like @myorg/my-awesome-lib
|
||||
|
||||
### js
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Generate JavaScript files rather than TypeScript files
|
||||
|
||||
### linter
|
||||
|
||||
Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `eslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
### pascalCaseFiles
|
||||
|
||||
Alias(es): P
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Use pascal case file names.
|
||||
|
||||
### setParserOptionsProject
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether or not to configure the ESLint "parserOptions.project" option. We do not do this by default for lint performance reasons.
|
||||
|
||||
### skipFormat
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Skip formatting files
|
||||
|
||||
### skipTsConfig
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Do not update tsconfig.json for development experience.
|
||||
|
||||
### strict
|
||||
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether to enable tsconfig strict mode or not.
|
||||
|
||||
### tags
|
||||
|
||||
Type: `string`
|
||||
|
||||
Add tags to the library (used for linting)
|
||||
|
||||
### testEnvironment
|
||||
|
||||
Default: `jsdom`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `jsdom`, `node`
|
||||
|
||||
The test environment to use if unitTestRunner is set to jest
|
||||
|
||||
### unitTestRunner
|
||||
|
||||
Default: `jest`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `jest`, `none`
|
||||
|
||||
Test runner to use for unit tests
|
||||
@ -0,0 +1,169 @@
|
||||
# @nrwl/js:library
|
||||
|
||||
Create a library
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
nx generate library ...
|
||||
```
|
||||
|
||||
```bash
|
||||
nx g lib ... # same
|
||||
```
|
||||
|
||||
By default, Nx will search for `library` in the default collection provisioned in `workspace.json`.
|
||||
|
||||
You can specify the collection explicitly as follows:
|
||||
|
||||
```bash
|
||||
nx g @nrwl/js:library ...
|
||||
```
|
||||
|
||||
Show what will be generated without writing to disk:
|
||||
|
||||
```bash
|
||||
nx g library ... --dry-run
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
Generate libs/myapp/mylib:
|
||||
|
||||
```bash
|
||||
nx g lib mylib --directory=myapp
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### name (_**required**_)
|
||||
|
||||
Type: `string`
|
||||
|
||||
Library name
|
||||
|
||||
### buildable
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Generate a buildable library.
|
||||
|
||||
### compiler
|
||||
|
||||
Default: `tsc`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `tsc`, `swc`
|
||||
|
||||
The compiler used by the build and test targets
|
||||
|
||||
### config
|
||||
|
||||
Default: `project`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `workspace`, `project`, `npm-scripts`
|
||||
|
||||
Determines how whether the project's executors should be configured in workspace.json, project.json or as npm scripts
|
||||
|
||||
### directory
|
||||
|
||||
Type: `string`
|
||||
|
||||
A directory where the lib is placed
|
||||
|
||||
### importPath
|
||||
|
||||
Type: `string`
|
||||
|
||||
The library name used to import it, like @myorg/my-awesome-lib
|
||||
|
||||
### js
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Generate JavaScript files rather than TypeScript files
|
||||
|
||||
### linter
|
||||
|
||||
Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `eslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
### pascalCaseFiles
|
||||
|
||||
Alias(es): P
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Use pascal case file names.
|
||||
|
||||
### setParserOptionsProject
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether or not to configure the ESLint "parserOptions.project" option. We do not do this by default for lint performance reasons.
|
||||
|
||||
### skipFormat
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Skip formatting files
|
||||
|
||||
### skipTsConfig
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Do not update tsconfig.json for development experience.
|
||||
|
||||
### strict
|
||||
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether to enable tsconfig strict mode or not.
|
||||
|
||||
### tags
|
||||
|
||||
Type: `string`
|
||||
|
||||
Add tags to the library (used for linting)
|
||||
|
||||
### testEnvironment
|
||||
|
||||
Default: `jsdom`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `jsdom`, `node`
|
||||
|
||||
The test environment to use if unitTestRunner is set to jest
|
||||
|
||||
### unitTestRunner
|
||||
|
||||
Default: `jest`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `jest`, `none`
|
||||
|
||||
Test runner to use for unit tests
|
||||
@ -110,6 +110,14 @@ Type: `boolean`
|
||||
|
||||
Defines the optimization level of the build.
|
||||
|
||||
### outputFileName
|
||||
|
||||
Default: `main.js`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Name of the main output file. (defaults to 'main.js')
|
||||
|
||||
### outputPath
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -885,7 +885,7 @@ Example:
|
||||
|
||||
### getWorkspacePath
|
||||
|
||||
▸ **getWorkspacePath**(`tree`): `string`
|
||||
▸ **getWorkspacePath**(`tree`): `"/angular.json"` \| `"/workspace.json"` \| `null`
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -895,7 +895,7 @@ Example:
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
`"/angular.json"` \| `"/workspace.json"` \| `null`
|
||||
|
||||
---
|
||||
|
||||
@ -1061,9 +1061,9 @@ By default javascript-style comments are allowed.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1113,9 +1113,9 @@ Reads a json file, removes all comments and parses JSON.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1139,9 +1139,9 @@ Reads a JSON file and returns the object the JSON content represents.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1346,9 +1346,9 @@ By default the JSON string is formatted with a 2 space intendation to be easy re
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :------------------------- |
|
||||
| `T` | extends ` object``object ` |
|
||||
| Name | Type |
|
||||
| :--- | :-------------------------- |
|
||||
| `T` | extends `object` = `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1459,10 +1459,10 @@ Updates a JSON value to the file system tree
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| `U` | extends ` object``T ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
| `U` | extends `object` = `T` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1569,9 +1569,9 @@ Writes a JSON value to the file system tree
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :------------------------- |
|
||||
| `T` | extends ` object``object ` |
|
||||
| Name | Type |
|
||||
| :--- | :-------------------------- |
|
||||
| `T` | extends `object` = `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1596,9 +1596,9 @@ Serializes the given data to JSON and writes it to a file.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :------------------------- |
|
||||
| `T` | extends ` object``object ` |
|
||||
| Name | Type |
|
||||
| :--- | :-------------------------- |
|
||||
| `T` | extends `object` = `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
|
||||
@ -56,6 +56,14 @@ Type: `number`
|
||||
|
||||
The port where the packager server is listening on.
|
||||
|
||||
### resetCache
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Resets metro cache
|
||||
|
||||
### sync
|
||||
|
||||
Default: `true`
|
||||
|
||||
@ -36,6 +36,14 @@ Type: `number`
|
||||
|
||||
The port where the packager server is listening on.
|
||||
|
||||
### resetCache
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Resets metro cache
|
||||
|
||||
### scheme
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# @nrwl/web:package
|
||||
# @nrwl/web:rollup
|
||||
|
||||
Package a library
|
||||
Package a library using rollup
|
||||
|
||||
Options can be configured in `workspace.json` when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/core-concepts/configuration#targets.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# @nrwl/web:build
|
||||
# @nrwl/web:webpack
|
||||
|
||||
Build a application
|
||||
Build an application using webpack
|
||||
|
||||
Options can be configured in `workspace.json` when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/core-concepts/configuration#targets.
|
||||
|
||||
@ -18,12 +18,6 @@ Run build in parallel:
|
||||
nx affected:build --parallel=5
|
||||
```
|
||||
|
||||
Rerun the build target only for the projects that failed last time:
|
||||
|
||||
```bash
|
||||
nx affected:build --only-failed
|
||||
```
|
||||
|
||||
Run the build target for all projects:
|
||||
|
||||
```bash
|
||||
|
||||
@ -18,12 +18,6 @@ Run tests in parallel:
|
||||
nx affected:e2e --parallel=5
|
||||
```
|
||||
|
||||
Rerun the test target only for the projects that failed last time:
|
||||
|
||||
```bash
|
||||
nx affected:e2e --only-failed
|
||||
```
|
||||
|
||||
Run the test target for all projects:
|
||||
|
||||
```bash
|
||||
|
||||
@ -18,12 +18,6 @@ Run lint in parallel:
|
||||
nx affected:lint --parallel=5
|
||||
```
|
||||
|
||||
Rerun the lint target only for the projects that failed last time:
|
||||
|
||||
```bash
|
||||
nx affected:lint --only-failed
|
||||
```
|
||||
|
||||
Run the lint target for all projects:
|
||||
|
||||
```bash
|
||||
|
||||
@ -18,12 +18,6 @@ Run tests in parallel:
|
||||
nx affected:test --parallel=5
|
||||
```
|
||||
|
||||
Rerun the test target only for the projects that failed last time:
|
||||
|
||||
```bash
|
||||
nx affected:test --only-failed
|
||||
```
|
||||
|
||||
Run the test target for all projects:
|
||||
|
||||
```bash
|
||||
|
||||
@ -24,12 +24,6 @@ Run tests in parallel:
|
||||
nx affected --target=test --parallel=5
|
||||
```
|
||||
|
||||
Rerun the test target only for the projects that failed last time:
|
||||
|
||||
```bash
|
||||
nx affected --target=test --only-failed
|
||||
```
|
||||
|
||||
Run the test target for all projects:
|
||||
|
||||
```bash
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
"detox",
|
||||
"gatsby",
|
||||
"jest",
|
||||
"js",
|
||||
"linter",
|
||||
"next",
|
||||
"node",
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
"express",
|
||||
"gatsby",
|
||||
"jest",
|
||||
"js",
|
||||
"linter",
|
||||
"nest",
|
||||
"next",
|
||||
|
||||
@ -22,6 +22,12 @@ Possible values: `dependencies`, `peerDependencies`
|
||||
|
||||
When `updateBuildableProjectDepsInPackageJson` is `true`, this adds dependencies to either `peerDependencies` or `dependencies`.
|
||||
|
||||
### tailwindConfig
|
||||
|
||||
Type: `string`
|
||||
|
||||
The full path for the Tailwind configuration file, relative to the workspace root. If not provided and a `tailwind.config.js` file exists in the project or workspace root, it will be used. Otherwise, Tailwind will not be configured.
|
||||
|
||||
### tsConfig
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -22,6 +22,12 @@ Possible values: `dependencies`, `peerDependencies`
|
||||
|
||||
When `updateBuildableProjectDepsInPackageJson` is `true`, this adds dependencies to either `peerDependencies` or `dependencies`.
|
||||
|
||||
### tailwindConfig
|
||||
|
||||
Type: `string`
|
||||
|
||||
The full path for the Tailwind configuration file, relative to the workspace root. If not provided and a `tailwind.config.js` file exists in the project or workspace root, it will be used. Otherwise, Tailwind will not be configured.
|
||||
|
||||
### tsConfig
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -44,6 +44,14 @@ Type: `boolean`
|
||||
|
||||
Generate a buildable library.
|
||||
|
||||
### compilationMode
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `full`, `partial`
|
||||
|
||||
Specifies the compilation mode to use. If not specified, it will default to `partial` for publishable libraries and to `full` for buildable libraries. The `full` value can not be used for publishable libraries.
|
||||
|
||||
### directory
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# @nrwl/workspace:tsc
|
||||
# @nrwl/js:tsc
|
||||
|
||||
Build a project using TypeScript.
|
||||
|
||||
@ -0,0 +1,161 @@
|
||||
# @nrwl/js:application
|
||||
|
||||
Create a application
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
nx generate application ...
|
||||
```
|
||||
|
||||
```bash
|
||||
nx g app ... # same
|
||||
```
|
||||
|
||||
By default, Nx will search for `application` in the default collection provisioned in `workspace.json`.
|
||||
|
||||
You can specify the collection explicitly as follows:
|
||||
|
||||
```bash
|
||||
nx g @nrwl/js:application ...
|
||||
```
|
||||
|
||||
Show what will be generated without writing to disk:
|
||||
|
||||
```bash
|
||||
nx g application ... --dry-run
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
Generate libs/myapp/mylib:
|
||||
|
||||
```bash
|
||||
nx g lib mylib --directory=myapp
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### name (_**required**_)
|
||||
|
||||
Type: `string`
|
||||
|
||||
Library name
|
||||
|
||||
### compiler
|
||||
|
||||
Default: `tsc`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `tsc`, `swc`
|
||||
|
||||
The compiler used by the build and test targets
|
||||
|
||||
### config
|
||||
|
||||
Default: `project`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `workspace`, `project`, `npm-scripts`
|
||||
|
||||
Determines how whether the project's executors should be configured in workspace.json, project.json or as npm scripts
|
||||
|
||||
### directory
|
||||
|
||||
Type: `string`
|
||||
|
||||
A directory where the lib is placed
|
||||
|
||||
### importPath
|
||||
|
||||
Type: `string`
|
||||
|
||||
The library name used to import it, like @myorg/my-awesome-lib
|
||||
|
||||
### js
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Generate JavaScript files rather than TypeScript files
|
||||
|
||||
### linter
|
||||
|
||||
Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `eslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
### pascalCaseFiles
|
||||
|
||||
Alias(es): P
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Use pascal case file names.
|
||||
|
||||
### setParserOptionsProject
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether or not to configure the ESLint "parserOptions.project" option. We do not do this by default for lint performance reasons.
|
||||
|
||||
### skipFormat
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Skip formatting files
|
||||
|
||||
### skipTsConfig
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Do not update tsconfig.json for development experience.
|
||||
|
||||
### strict
|
||||
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether to enable tsconfig strict mode or not.
|
||||
|
||||
### tags
|
||||
|
||||
Type: `string`
|
||||
|
||||
Add tags to the library (used for linting)
|
||||
|
||||
### testEnvironment
|
||||
|
||||
Default: `jsdom`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `jsdom`, `node`
|
||||
|
||||
The test environment to use if unitTestRunner is set to jest
|
||||
|
||||
### unitTestRunner
|
||||
|
||||
Default: `jest`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `jest`, `none`
|
||||
|
||||
Test runner to use for unit tests
|
||||
@ -0,0 +1,169 @@
|
||||
# @nrwl/js:library
|
||||
|
||||
Create a library
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
nx generate library ...
|
||||
```
|
||||
|
||||
```bash
|
||||
nx g lib ... # same
|
||||
```
|
||||
|
||||
By default, Nx will search for `library` in the default collection provisioned in `workspace.json`.
|
||||
|
||||
You can specify the collection explicitly as follows:
|
||||
|
||||
```bash
|
||||
nx g @nrwl/js:library ...
|
||||
```
|
||||
|
||||
Show what will be generated without writing to disk:
|
||||
|
||||
```bash
|
||||
nx g library ... --dry-run
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
Generate libs/myapp/mylib:
|
||||
|
||||
```bash
|
||||
nx g lib mylib --directory=myapp
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### name (_**required**_)
|
||||
|
||||
Type: `string`
|
||||
|
||||
Library name
|
||||
|
||||
### buildable
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Generate a buildable library.
|
||||
|
||||
### compiler
|
||||
|
||||
Default: `tsc`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `tsc`, `swc`
|
||||
|
||||
The compiler used by the build and test targets
|
||||
|
||||
### config
|
||||
|
||||
Default: `project`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `workspace`, `project`, `npm-scripts`
|
||||
|
||||
Determines how whether the project's executors should be configured in workspace.json, project.json or as npm scripts
|
||||
|
||||
### directory
|
||||
|
||||
Type: `string`
|
||||
|
||||
A directory where the lib is placed
|
||||
|
||||
### importPath
|
||||
|
||||
Type: `string`
|
||||
|
||||
The library name used to import it, like @myorg/my-awesome-lib
|
||||
|
||||
### js
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Generate JavaScript files rather than TypeScript files
|
||||
|
||||
### linter
|
||||
|
||||
Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `eslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
### pascalCaseFiles
|
||||
|
||||
Alias(es): P
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Use pascal case file names.
|
||||
|
||||
### setParserOptionsProject
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether or not to configure the ESLint "parserOptions.project" option. We do not do this by default for lint performance reasons.
|
||||
|
||||
### skipFormat
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Skip formatting files
|
||||
|
||||
### skipTsConfig
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Do not update tsconfig.json for development experience.
|
||||
|
||||
### strict
|
||||
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether to enable tsconfig strict mode or not.
|
||||
|
||||
### tags
|
||||
|
||||
Type: `string`
|
||||
|
||||
Add tags to the library (used for linting)
|
||||
|
||||
### testEnvironment
|
||||
|
||||
Default: `jsdom`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `jsdom`, `node`
|
||||
|
||||
The test environment to use if unitTestRunner is set to jest
|
||||
|
||||
### unitTestRunner
|
||||
|
||||
Default: `jest`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `jest`, `none`
|
||||
|
||||
Test runner to use for unit tests
|
||||
@ -110,6 +110,14 @@ Type: `boolean`
|
||||
|
||||
Defines the optimization level of the build.
|
||||
|
||||
### outputFileName
|
||||
|
||||
Default: `main.js`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Name of the main output file. (defaults to 'main.js')
|
||||
|
||||
### outputPath
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -885,7 +885,7 @@ Example:
|
||||
|
||||
### getWorkspacePath
|
||||
|
||||
▸ **getWorkspacePath**(`tree`): `string`
|
||||
▸ **getWorkspacePath**(`tree`): `"/angular.json"` \| `"/workspace.json"` \| `null`
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -895,7 +895,7 @@ Example:
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
`"/angular.json"` \| `"/workspace.json"` \| `null`
|
||||
|
||||
---
|
||||
|
||||
@ -1061,9 +1061,9 @@ By default javascript-style comments are allowed.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1113,9 +1113,9 @@ Reads a json file, removes all comments and parses JSON.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1139,9 +1139,9 @@ Reads a JSON file and returns the object the JSON content represents.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1346,9 +1346,9 @@ By default the JSON string is formatted with a 2 space intendation to be easy re
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :------------------------- |
|
||||
| `T` | extends ` object``object ` |
|
||||
| Name | Type |
|
||||
| :--- | :-------------------------- |
|
||||
| `T` | extends `object` = `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1459,10 +1459,10 @@ Updates a JSON value to the file system tree
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| `U` | extends ` object``T ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
| `U` | extends `object` = `T` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1569,9 +1569,9 @@ Writes a JSON value to the file system tree
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :------------------------- |
|
||||
| `T` | extends ` object``object ` |
|
||||
| Name | Type |
|
||||
| :--- | :-------------------------- |
|
||||
| `T` | extends `object` = `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1596,9 +1596,9 @@ Serializes the given data to JSON and writes it to a file.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :------------------------- |
|
||||
| `T` | extends ` object``object ` |
|
||||
| Name | Type |
|
||||
| :--- | :-------------------------- |
|
||||
| `T` | extends `object` = `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
|
||||
@ -56,6 +56,14 @@ Type: `number`
|
||||
|
||||
The port where the packager server is listening on.
|
||||
|
||||
### resetCache
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Resets metro cache
|
||||
|
||||
### sync
|
||||
|
||||
Default: `true`
|
||||
|
||||
@ -36,6 +36,14 @@ Type: `number`
|
||||
|
||||
The port where the packager server is listening on.
|
||||
|
||||
### resetCache
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Resets metro cache
|
||||
|
||||
### scheme
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# @nrwl/web:package
|
||||
# @nrwl/web:rollup
|
||||
|
||||
Package a library
|
||||
Package a library using rollup
|
||||
|
||||
Options can be configured in `workspace.json` when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/core-concepts/configuration#targets.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# @nrwl/web:build
|
||||
# @nrwl/web:webpack
|
||||
|
||||
Build a application
|
||||
Build an application using webpack
|
||||
|
||||
Options can be configured in `workspace.json` when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/core-concepts/configuration#targets.
|
||||
|
||||
@ -18,12 +18,6 @@ Run build in parallel:
|
||||
nx affected:build --parallel=5
|
||||
```
|
||||
|
||||
Rerun the build target only for the projects that failed last time:
|
||||
|
||||
```bash
|
||||
nx affected:build --only-failed
|
||||
```
|
||||
|
||||
Run the build target for all projects:
|
||||
|
||||
```bash
|
||||
|
||||
@ -18,12 +18,6 @@ Run tests in parallel:
|
||||
nx affected:e2e --parallel=5
|
||||
```
|
||||
|
||||
Rerun the test target only for the projects that failed last time:
|
||||
|
||||
```bash
|
||||
nx affected:e2e --only-failed
|
||||
```
|
||||
|
||||
Run the test target for all projects:
|
||||
|
||||
```bash
|
||||
|
||||
@ -18,12 +18,6 @@ Run lint in parallel:
|
||||
nx affected:lint --parallel=5
|
||||
```
|
||||
|
||||
Rerun the lint target only for the projects that failed last time:
|
||||
|
||||
```bash
|
||||
nx affected:lint --only-failed
|
||||
```
|
||||
|
||||
Run the lint target for all projects:
|
||||
|
||||
```bash
|
||||
|
||||
@ -18,12 +18,6 @@ Run tests in parallel:
|
||||
nx affected:test --parallel=5
|
||||
```
|
||||
|
||||
Rerun the test target only for the projects that failed last time:
|
||||
|
||||
```bash
|
||||
nx affected:test --only-failed
|
||||
```
|
||||
|
||||
Run the test target for all projects:
|
||||
|
||||
```bash
|
||||
|
||||
@ -24,12 +24,6 @@ Run tests in parallel:
|
||||
nx affected --target=test --parallel=5
|
||||
```
|
||||
|
||||
Rerun the test target only for the projects that failed last time:
|
||||
|
||||
```bash
|
||||
nx affected --target=test --only-failed
|
||||
```
|
||||
|
||||
Run the test target for all projects:
|
||||
|
||||
```bash
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
"detox",
|
||||
"gatsby",
|
||||
"jest",
|
||||
"js",
|
||||
"linter",
|
||||
"next",
|
||||
"node",
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
"express",
|
||||
"gatsby",
|
||||
"jest",
|
||||
"js",
|
||||
"linter",
|
||||
"nest",
|
||||
"next",
|
||||
|
||||
@ -257,7 +257,7 @@ This is an example of `apps/myapp/project.json`:
|
||||
"projectType": "application",
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nrwl/web:build",
|
||||
"executor": "@nrwl/web:webpack",
|
||||
"outputs": ["dist/apps/myapp"],
|
||||
"dependsOn": [
|
||||
{
|
||||
@ -362,7 +362,7 @@ The `configurations` property provides extra sets of values that are merged into
|
||||
```json
|
||||
{
|
||||
"build": {
|
||||
"executor": "@nrwl/web:build",
|
||||
"executor": "@nrwl/web:webpack",
|
||||
"outputs": ["dist/apps/myapp"],
|
||||
"options": {
|
||||
"index": "apps/myapp/src/app.html",
|
||||
@ -397,7 +397,7 @@ building the project. You can specify this using the `dependsOn`.
|
||||
```json
|
||||
{
|
||||
"build": {
|
||||
"executor": "@nrwl/web:build",
|
||||
"executor": "@nrwl/web:webpack",
|
||||
"outputs": ["dist/apps/myapp"],
|
||||
"options": {
|
||||
"index": "apps/myapp/src/app.html",
|
||||
@ -425,7 +425,7 @@ executed and only then `nx build myapp` is executed.
|
||||
```json
|
||||
{
|
||||
"build-base": {
|
||||
"executor": "@nrwl/web:build",
|
||||
"executor": "@nrwl/web:webpack",
|
||||
"outputs": ["dist/apps/myapp"],
|
||||
"options": {
|
||||
"index": "apps/myapp/src/app.html",
|
||||
|
||||
@ -25,9 +25,9 @@ Application name todos
|
||||
Default stylesheet format CSS
|
||||
```
|
||||
|
||||
> You can also choose to add [Nx Cloud](https://nx.app), but its not required for the tutorial.
|
||||
Enter the indicated answers.
|
||||
|
||||
When asked about 'preset', select `react`, and `todos` for the app name.
|
||||
> You can also choose to add [Nx Cloud](https://nx.app), but its not required for the tutorial.
|
||||
|
||||
```treeview
|
||||
myorg/
|
||||
@ -46,6 +46,7 @@ myorg/
|
||||
│ │ ├── .browserslistrc
|
||||
│ │ ├── .eslintrc.json
|
||||
│ │ ├── jest.config.js
|
||||
│ │ ├── project.json
|
||||
│ │ ├── tsconfig.app.json
|
||||
│ │ ├── tsconfig.json
|
||||
│ │ └── tsconfig.spec.json
|
||||
@ -63,7 +64,7 @@ myorg/
|
||||
│ │ └── index.ts
|
||||
│ ├── .eslintrc.json
|
||||
│ ├── cypress.json
|
||||
│ ├── tsconfig.e2e.json
|
||||
│ ├── project.json
|
||||
│ └── tsconfig.json
|
||||
├── libs/
|
||||
├── tools/
|
||||
|
||||
@ -11,12 +11,13 @@ Nx is an open platform with plugins for many modern tools and frameworks. **To s
|
||||
```bash
|
||||
> NX Installed plugins:
|
||||
|
||||
@nrwl/cypress (executors,generators)
|
||||
@nrwl/jest (executors,generators)
|
||||
@nrwl/linter (builders)
|
||||
@nrwl/cypress (builders,generators)
|
||||
@nrwl/jest (builders,generators)
|
||||
@nrwl/linter (builders,generators)
|
||||
@nrwl/react (generators)
|
||||
@nrwl/web (executors,generators)
|
||||
@nrwl/workspace (executors,generators)
|
||||
@nrwl/storybook (builders,generators)
|
||||
@nrwl/web (builders,generators)
|
||||
@nrwl/workspace (builders,generators)
|
||||
|
||||
|
||||
> NX Also available:
|
||||
@ -27,7 +28,6 @@ Nx is an open platform with plugins for many modern tools and frameworks. **To s
|
||||
@nrwl/next (executors,generators)
|
||||
@nrwl/node (executors,generators)
|
||||
@nrwl/nx-plugin (executors,generators)
|
||||
@nrwl/storybook (executors,generators)
|
||||
|
||||
|
||||
> NX Community plugins:
|
||||
@ -72,7 +72,10 @@ After this is done, you should see something like this:
|
||||
```treeview
|
||||
myorg/
|
||||
├── apps/
|
||||
│ ├── todos/
|
||||
│ ├── todos/
|
||||
│ │ ├── src/
|
||||
│ │ ├── project.json
|
||||
│ │ └── proxy.conf.json
|
||||
│ ├── todos-e2e/
|
||||
│ └── api/
|
||||
│ ├── src/
|
||||
@ -83,7 +86,7 @@ myorg/
|
||||
│ │ │ └── environment.prod.ts
|
||||
│ │ └── main.ts
|
||||
│ ├── jest.conf.js
|
||||
│ ├── proxy.conf.json
|
||||
│ ├── project.json
|
||||
│ ├── tsconfig.app.json
|
||||
│ ├── tsconfig.json
|
||||
│ └── tsconfig.spec.json
|
||||
@ -147,3 +150,7 @@ const server = app.listen(port, () => {
|
||||
});
|
||||
server.on('error', console.error);
|
||||
```
|
||||
|
||||
**Now run `npx nx serve api` to run the api server**
|
||||
|
||||
Refresh the application in the browser. The React app is now able to fetch and create todos by calling the API.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# React Nx Tutorial - Step 6: Proxy
|
||||
# React Nx Tutorial - Step 6: Proxy Configuration
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/xfvCz-yLeEw" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
|
||||
@ -6,28 +6,28 @@ You passed `--frontendProject=todos` when creating the node application. What di
|
||||
|
||||
It created a proxy configuration that allows the React application to talk to the API in development.
|
||||
|
||||
**To see how it works, open `workspace.json` and find the `serve` target of the todos app.**
|
||||
**To see how it works, open `apps/todos/project.json` and find the `serve` target.**
|
||||
|
||||
```json
|
||||
{
|
||||
"serve": {
|
||||
"builder": "@nrwl/web:dev-server",
|
||||
"executor": "@nrwl/web:dev-server",
|
||||
"options": {
|
||||
"buildTarget": "todos:build",
|
||||
"hmr": true,
|
||||
"proxyConfig": "apps/todos/proxy.conf.json"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"buildTarget": "todos:build:production"
|
||||
"buildTarget": "todos:build:production",
|
||||
"hmr": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Note the `proxyConfig` property.**
|
||||
|
||||
**Now open `proxy.conf.json`:**
|
||||
Note the `proxyConfig` property which points to `apps/todos/proxy.conf.json`. Open this file.
|
||||
|
||||
```json
|
||||
{
|
||||
@ -40,11 +40,11 @@ It created a proxy configuration that allows the React application to talk to th
|
||||
|
||||
This configuration tells `npx nx serve` to forward all requests starting with `/api` to the process listening on port `3333`.
|
||||
|
||||
## Workspace.json, Targets, Builders
|
||||
## Project.json, Targets, Executors
|
||||
|
||||
You configure your workspaces in `workspace.json`. This file contains the workspace projects with their architect targets. For instance, `todos` has the `build`, `serve`, `lint`, and `test` targets. This means that you can run `npx nx build todos`, `npx nx serve todos`, etc..
|
||||
You configure your apps in `apps/[app-name]/project.json`. Open `apps/todos/project.json` to see an example. This file contains configuration for the todos app. For instance, you can see the `build`, `serve`, `lint`, and `test` targets. This means that you can run `npx nx build todos`, `npx nx serve todos`, etc..
|
||||
|
||||
Every target uses a builder which actually runs this target. So targets are analogous to typed npm scripts, and builders are analogous to typed shell scripts.
|
||||
Every target uses an executor which actually runs this target. So targets are analogous to typed npm scripts, and executors are analogous to typed shell scripts.
|
||||
|
||||
**Why not use shell scripts and npm scripts directly?**
|
||||
|
||||
@ -54,7 +54,7 @@ There are a lot of advantages to providing additional metadata to the build tool
|
||||
npx nx run todos:serve [options,...]
|
||||
|
||||
Options:
|
||||
--buildTarget Target which builds the application`
|
||||
--buildTarget Target which builds the application
|
||||
--port Port to listen on. (default: 4200)
|
||||
--host Host to listen on. (default: localhost)
|
||||
--ssl Serve using HTTPS.
|
||||
@ -73,4 +73,4 @@ Options:
|
||||
|
||||
It helps with good editor integration (see [VSCode Support](/{{framework}}/getting-started/console#nx-console-for-vscode)).
|
||||
|
||||
But, most importantly, it provides a holistic dev experience regardless of the tools used, and enables advanced build features like distributed computation caching and distributed builds).
|
||||
But, most importantly, it provides a holistic dev experience regardless of the tools used, and enables advanced build features like distributed computation caching and distributed builds.
|
||||
|
||||
@ -25,8 +25,9 @@ myorg/
|
||||
│ │ │ └── data.ts
|
||||
│ │ └── index.ts
|
||||
│ ├── jest.conf.js
|
||||
│ ├── tsconfig.app.json
|
||||
│ ├── project.json
|
||||
│ ├── tsconfig.json
|
||||
│ ├── tsconfig.lib.json
|
||||
│ └── tsconfig.spec.json
|
||||
├── tools/
|
||||
├── nx.json
|
||||
|
||||
@ -31,17 +31,18 @@ myorg/
|
||||
│ └── ui/
|
||||
│ ├── src/
|
||||
│ │ ├── lib/
|
||||
│ │ │ └── ui/
|
||||
│ │ │ ├── ui.css
|
||||
│ │ │ ├── ui.spec.tsx
|
||||
│ │ │ └── ui.tsx
|
||||
│ │ │ ├── ui.css
|
||||
│ │ │ ├── ui.spec.tsx
|
||||
│ │ │ └── ui.tsx
|
||||
│ │ └── index.ts
|
||||
│ ├── jest.conf.js
|
||||
│ ├── tsconfig.app.json
|
||||
│ ├── project.json
|
||||
│ ├── tsconfig.json
|
||||
│ ├── tsconfig.lib.json
|
||||
│ └── tsconfig.spec.json
|
||||
├── tools/
|
||||
├── nx.json
|
||||
├── workspace.json
|
||||
├── package.json
|
||||
└── tsconfig.base.json
|
||||
```
|
||||
@ -49,19 +50,18 @@ myorg/
|
||||
The `libs/ui/src/lib/ui.tsx` file looks like this:
|
||||
|
||||
```typescript
|
||||
import React from 'react';
|
||||
|
||||
import './ui.css';
|
||||
import './ui.module.css';
|
||||
|
||||
/* eslint-disable-next-line */
|
||||
export interface UiProps {}
|
||||
|
||||
export const Ui = (props: UiProps) => {
|
||||
export function Ui(props: UiProps) {
|
||||
return (
|
||||
<div>
|
||||
<h1>Welcome to ui!</h1>
|
||||
<h1>Welcome to Ui!</h1>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
export default Ui;
|
||||
```
|
||||
@ -87,18 +87,18 @@ myorg/
|
||||
│ └── ui/
|
||||
│ ├── src/
|
||||
│ │ ├── lib/
|
||||
│ │ │ ├── ui/
|
||||
│ │ │ │ ├── ui.css
|
||||
│ │ │ │ ├── ui.spec.tsx
|
||||
│ │ │ │ └── ui.tsx
|
||||
│ │ │ └── todos/
|
||||
│ │ │ ├── todos.css
|
||||
│ │ │ ├── todos.spec.tsx
|
||||
│ │ │ └── todos.tsx
|
||||
│ │ │ │ ├── todos.css
|
||||
│ │ │ │ ├── todos.spec.tsx
|
||||
│ │ │ │ └── todos.tsx
|
||||
│ │ │ ├── ui.css
|
||||
│ │ │ ├── ui.spec.tsx
|
||||
│ │ │ └── ui.tsx
|
||||
│ │ └── index.ts
|
||||
│ ├── jest.conf.js
|
||||
│ ├── tsconfig.app.json
|
||||
│ ├── project.json
|
||||
│ ├── tsconfig.json
|
||||
│ ├── tsconfig.lib.json
|
||||
│ └── tsconfig.spec.json
|
||||
├── tools/
|
||||
├── workspace.json
|
||||
@ -110,10 +110,14 @@ myorg/
|
||||
**Implement the Todos component.**
|
||||
|
||||
```typescript
|
||||
import React from 'react';
|
||||
import { Todo } from '@myorg/data';
|
||||
import './todos.module.css';
|
||||
|
||||
export const Todos = (props: { todos: Todo[] }) => {
|
||||
export interface TodosProps {
|
||||
todos: Todo[];
|
||||
}
|
||||
|
||||
export function Todos(props: TodosProps) {
|
||||
return (
|
||||
<ul>
|
||||
{props.todos.map((t) => (
|
||||
@ -121,7 +125,7 @@ export const Todos = (props: { todos: Todo[] }) => {
|
||||
))}
|
||||
</ul>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
export default Todos;
|
||||
```
|
||||
|
||||
@ -7,3 +7,11 @@ An Nx workspace can contain dozens or hundreds of applications and libraries. As
|
||||
Previously, some senior architect would create an ad-hoc dependency diagram and upload it to a corporate wiki. The diagram is not correct even on Day 1 and gets more and more out of sync with every passing day.
|
||||
|
||||
With Nx, you can do better than that.
|
||||
|
||||
Run
|
||||
|
||||
```bash
|
||||
npx nx dep-graph
|
||||
```
|
||||
|
||||
The dependency graph page opens in a new browser window. Click on "Show all projects" to see all the apps and libraries in the workspace.
|
||||
|
||||
@ -54,41 +54,4 @@ Nx read the output from cache instead of running the command for 1 out of 2 proj
|
||||
|
||||
Nx built `api` and retrieved `todos` from its computation cache. Read more about the cache [here](/{{framework}}/core-extended/computation-caching).
|
||||
|
||||
## --with-deps
|
||||
|
||||
As we saw already, Nx is smart, so it knows how applications and libraries in the workspace depend on each other.
|
||||
|
||||
**Run `npx nx lint todos --with-deps`, and you see that Nx lints both the `todos` app and the libraries it depends on.**
|
||||
|
||||
```bash
|
||||
> NX Running target lint for project todos and its 2 deps.
|
||||
|
||||
———————————————————————————————————————————————
|
||||
|
||||
> npx nx run todos:lint
|
||||
|
||||
Linting "todos"...
|
||||
|
||||
All files pass linting.
|
||||
|
||||
|
||||
> npx nx run ui:lint
|
||||
|
||||
Linting "ui"...
|
||||
|
||||
All files pass linting.
|
||||
|
||||
|
||||
> npx nx run data:lint
|
||||
|
||||
Linting "data"...
|
||||
|
||||
All files pass linting.
|
||||
|
||||
|
||||
———————————————————————————————————————————————
|
||||
|
||||
> NX SUCCESS Running target "lint" succeeded
|
||||
```
|
||||
|
||||
> Add --parallel to any command, and Nx does most of the work in parallel.
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
In addition to supporting computation caching, Nx scales your development by doing code change analysis to see what is affected by a particular pull request.
|
||||
|
||||
**Commit all the changes in the repo**:
|
||||
**Commit all the changes you have made so far**:
|
||||
|
||||
```bash
|
||||
git add .
|
||||
@ -12,13 +12,17 @@ git commit -am 'init'
|
||||
git checkout -b testbranch
|
||||
```
|
||||
|
||||
**Open `libs/ui/src/lib/todos/todos.tsx` and change the component:**
|
||||
**Open `libs/ui/src/lib/todos/todos.tsx` and change the component by updating the `<li>` content to `{t.title}!!`:**
|
||||
|
||||
```typescript
|
||||
import React from 'react';
|
||||
import { Todo } from '@myorg/data';
|
||||
import './todos.module.css';
|
||||
|
||||
export const Todos = (props: { todos: Todo[] }) => {
|
||||
export interface TodosProps {
|
||||
todos: Todo[];
|
||||
}
|
||||
|
||||
export function Todos(props: TodosProps) {
|
||||
return (
|
||||
<ul>
|
||||
{props.todos.map((t) => (
|
||||
@ -26,7 +30,7 @@ export const Todos = (props: { todos: Todo[] }) => {
|
||||
))}
|
||||
</ul>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
export default Todos;
|
||||
```
|
||||
|
||||
@ -130,7 +130,7 @@ Nx also caches the files generated by a command. The list of folders is listed i
|
||||
"projectType": "application",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@nrwl/web:build",
|
||||
"builder": "@nrwl/web:webpack",
|
||||
"outputs": ["dist/apps/myapp"],
|
||||
"options": {
|
||||
"index": "apps/myapp/src/app.html",
|
||||
|
||||
@ -0,0 +1,77 @@
|
||||
# Configuring CI Using GitLab and Nx
|
||||
|
||||
Nx is a smart and extensible build framework, and it works really well with monorepos. Monorepos provide a lot of advantages:
|
||||
|
||||
- Everything at that current commit works together. Changes can be verified across all affected parts of the organization.
|
||||
- Easy to split code into composable modules
|
||||
- Easier dependency management
|
||||
- One toolchain setup
|
||||
- Code editors and IDEs are "workspace" aware
|
||||
- Consistent developer experience
|
||||
- And more ...
|
||||
|
||||
But they come with their own technical challenges. The more code you add into your repository, the slower the CI gets.
|
||||
|
||||
## Setting Gitlab CI/CD
|
||||
|
||||
Below is an example of a GitLab pipeline setup for an Nx workspace only building and testing what is affected.
|
||||
|
||||
```yaml
|
||||
image: node:16-alpine
|
||||
stages:
|
||||
- setup
|
||||
- test
|
||||
|
||||
install-dependencies:
|
||||
stage: setup
|
||||
interruptible: true
|
||||
only:
|
||||
- main
|
||||
- merge_requests
|
||||
cache:
|
||||
key:
|
||||
files:
|
||||
- yarn.lock
|
||||
paths:
|
||||
- node_modules
|
||||
- .yarn
|
||||
script:
|
||||
- yarn install --pure-lockfile --cache-folder .yarn
|
||||
artifacts:
|
||||
paths:
|
||||
- node_modules
|
||||
|
||||
.distributed:
|
||||
interruptible: true
|
||||
only:
|
||||
- main
|
||||
- merge_requests
|
||||
needs:
|
||||
- install-dependencies
|
||||
artifacts:
|
||||
paths:
|
||||
- node_modules/.cache/nx
|
||||
|
||||
build:
|
||||
stage: test
|
||||
extends: .distributed
|
||||
script:
|
||||
- yarn nx affected --base=HEAD~1 --target=build --parallel --max-parallel=3
|
||||
|
||||
test:
|
||||
stage: test
|
||||
extends: .distributed
|
||||
script:
|
||||
- yarn nx affected --base=HEAD~1 --target=test --parallel --max-parallel=2
|
||||
```
|
||||
|
||||
The `build` and `test` jobs implement the CI workflow using `.distributed` as template to keep
|
||||
CI configuration file clearly.
|
||||
|
||||
## Distributed CI with Nx Cloud
|
||||
|
||||
A computation cache is created on your local machine to make the developer experience faster. This allows you to not waste time re-building, re-testing, re-linting, or any number of other actions you might take on code that hasn't changed. Because the cache is stored locally, you are the only member of your team that can take advantage of these instant commands. You can manage and share this cache manually.
|
||||
|
||||
Nx Cloud allows this cache to be shared across your entire organization, meaning that any cacheable operation completed on your workspace only needs to be run once. Nx Cloud also allows you to distribute your CI across multiple machines to make sure the CI is fast even for very large repos.
|
||||
|
||||
Learn more about [configuring your CI](https://nx.app/docs/configuring-ci) environment using Nx Cloud with [Distributed Caching](https://nx.app/docs/distributed-caching) and [Distributed Task Execution](https://nx.app/docs/distributed-execution) in the Nx Cloud docs.
|
||||
@ -84,7 +84,7 @@ React applications are built using the executors from the `@nrwl/web` plugin.
|
||||
## Generators
|
||||
|
||||
- [application](/{{framework}}/react/application) - Create an React application
|
||||
- [component](/{{framework}}/react/component) - Create an React library
|
||||
- [component](/{{framework}}/react/component) - Create an React component
|
||||
- [library](/{{framework}}/react/library) - Create an React library
|
||||
- [redux](/{{framework}}/react/redux) - Generate a Redux slice for a project
|
||||
- [storybook-configuration](/{{framework}}/react/storybook-configuration) - Set up Storybook for a react library
|
||||
|
||||
@ -21,7 +21,7 @@ The executors that are available for each project are defined and configured in
|
||||
"generators": {},
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nrwl/web:build",
|
||||
"executor": "@nrwl/web:webpack",
|
||||
"options": {
|
||||
"outputPath": "dist/apps/cart",
|
||||
...
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user