From 0e976bf755206784124527574d63e174be7152fd Mon Sep 17 00:00:00 2001 From: ben <3447705+bcabanes@users.noreply.github.com> Date: Thu, 7 Jul 2022 11:01:48 -0400 Subject: [PATCH] docs(website): set sidebar collapse to false --- lerna.json | 6 +-- website/docs/configuration.md | 72 ++++++++++----------------- website/docs/core-concepts/caching.md | 34 +++---------- website/docs/getting-started.md | 10 +--- website/docs/guides/hoisting.md | 10 ++-- website/docusaurus.config.js | 2 +- 6 files changed, 42 insertions(+), 92 deletions(-) diff --git a/lerna.json b/lerna.json index 2371fc746a..5021f6217e 100644 --- a/lerna.json +++ b/lerna.json @@ -15,11 +15,7 @@ "message": "chore(release): %s" } }, - "ignoreChanges": [ - "**/__fixtures__/**", - "**/__tests__/**", - "**/*.md" - ], + "ignoreChanges": ["**/__fixtures__/**", "**/__tests__/**", "**/*.md"], "useWorkspaces": true, "useNx": true, "version": "5.1.8" diff --git a/website/docs/configuration.md b/website/docs/configuration.md index 7894e670c4..be0c6f1d38 100644 --- a/website/docs/configuration.md +++ b/website/docs/configuration.md @@ -17,7 +17,7 @@ the `useWorksapces: true` in `lerna.json`. ```json title="lerna.json" { - "useWorkspaces": true + "useWorkspaces": true } ``` @@ -26,7 +26,7 @@ look for `package.json` files. ```json title="lerna.json" { - "packages": ["packages/*"] + "packages": ["packages/*"] } ``` @@ -37,7 +37,7 @@ be published using the same version. The last published version is recorded in ` ```json title="lerna.json" { - "version": "1.2.0" + "version": "1.2.0" } ``` @@ -45,7 +45,7 @@ When using the independent mode, every package is versioned separately, and `ler ```json title="lerna.json" { - "version": "independent" + "version": "independent" } ``` @@ -76,41 +76,22 @@ This configuration is only relevant is you have `useNx: true` in your `lerna.jso "default": { "runner": "nx/tasks-runners/default", "options": { - "cacheableOperations": [ - "build", - "test" - ] + "cacheableOperations": ["build", "test"] } } }, "namedInputs": { - "default": [ - "{projectRoot}/**/*" - ], - "prod": [ - "!{projectRoot}/**/*.spec.tsx" - ] + "default": ["{projectRoot}/**/*"], + "prod": ["!{projectRoot}/**/*.spec.tsx"] }, "targetDefaults": { "build": { - "dependsOn": [ - "prebuild", - "^build" - ], - "inputs": [ - "prod", - "^prod" - ], - "outputs": [ - "{projectRoot}/dist" - ] + "dependsOn": ["prebuild", "^build"], + "inputs": ["prod", "^prod"], + "outputs": ["{projectRoot}/dist"] }, "test": { - "inputs": [ - "default", - "^prod", - "{workspaceRoot}/jest.config.ts" - ] + "inputs": ["default", "^prod", "{workspaceRoot}/jest.config.ts"] } } } @@ -146,37 +127,37 @@ project and the build script of all the dependencies to run first. The `inputs` array tells Nx what to consider to determine whether a particular invocation of a script should be a cache hit or not. There are three types of inputs: -*Filesets* +_Filesets_ Examples: -* `{projectRoot}/**.*.ts` -* same as `{fileset: "{projectRoot}/**/*.ts"}` -* `{workspaceRoot}/jest.config.ts` -* same as `{fileset: "{workspaceRoot}/jest.config.ts}` +- `{projectRoot}/**.*.ts` +- same as `{fileset: "{projectRoot}/**/*.ts"}` +- `{workspaceRoot}/jest.config.ts` +- same as `{fileset: "{workspaceRoot}/jest.config.ts}` -*Runtime Inputs* +_Runtime Inputs_ Examples: -* `{runtime: "node -v"}` +- `{runtime: "node -v"}` Node the result value is hashed, so it is never displayed. -*Env Variables* +_Env Variables_ Examples: -* `{env: "MY_ENV_VAR"}` +- `{env: "MY_ENV_VAR"}` Node the result value is hashed, so it is never displayed. -*Named Inputs* +_Named Inputs_ Examples: -* `inputs: ["prod"]` -* same as `inputs: [{input: "prod", projects: "self"}]` +- `inputs: ["prod"]` +- same as `inputs: [{input: "prod", projects: "self"}]` Often the same glob will appear in many places (e.g., prod fileset will exclude spec files for all projects).. Because keeping them in sync is error-prone, we recommend defining named inputs, which you can then reference in all of those @@ -186,8 +167,8 @@ places. Examples: -* `inputs: ["^prod"]` -* same as `inputs: [{input: "prod", projects: "dependencies"}]` +- `inputs: ["^prod"]` +- same as `inputs: [{input: "prod", projects: "dependencies"}]` Similar to `dependsOn`, the "^" symbols means "dependencies". This is a very important idea, so let's illustrate it with an example. @@ -254,8 +235,7 @@ useful to have a project-specific configuration, which is placed in the project' Note, the `namedInputs` and `targetDefaults` defined in `nx.json` are simply defaults. If you take that configuration and copy it into every project's `package.json` file, the results will be the same. -In other words, every project has a set of named inputs, and it's defined as: `{...namedInputsFromNxJson, -...namedInputsFromProjectsPackageJson}`. Every target/script's `dependsOn` is defined +In other words, every project has a set of named inputs, and it's defined as: `{...namedInputsFromNxJson, ...namedInputsFromProjectsPackageJson}`. Every target/script's `dependsOn` is defined as `dependsOnFromProjectsPackageJson || dependsOnFromNxJson`. The same applies to `inputs` and `outputs`. ### inputs & namedInputs diff --git a/website/docs/core-concepts/caching.md b/website/docs/core-concepts/caching.md index 810d87afbf..02556fb00a 100644 --- a/website/docs/core-concepts/caching.md +++ b/website/docs/core-concepts/caching.md @@ -71,26 +71,15 @@ We can define a more precise configuration as follows: ```json title="nx.json" { "namedInputs": { - "default": [ - "{projectRoot}/**/*" - ], - "prod": [ - "!{projectRoot}/**/*.spec.tsx" - ] + "default": ["{projectRoot}/**/*"], + "prod": ["!{projectRoot}/**/*.spec.tsx"] }, "targetDefaults": { "build": { - "inputs": [ - "prod", - "^prod" - ] + "inputs": ["prod", "^prod"] }, "test": { - "inputs": [ - "default", - "^prod", - "{workspaceRoot}/jest.config.ts" - ] + "inputs": ["default", "^prod", "{workspaceRoot}/jest.config.ts"] } } } @@ -108,10 +97,7 @@ Your targets can also depend on runtime values. { "targetDefaults": { "build": { - "inputs": [ - { "env": "MY_ENV_NAME" }, - { "runtime": "node -v"} - ] + "inputs": [{ "env": "MY_ENV_NAME" }, { "runtime": "node -v" }] } } } @@ -164,10 +150,7 @@ project's `package.json`: "nx": { "targets": { "build": { - "outputs": [ - "{projectRoot}/build", - "{projectRoot}/public/build" - ] + "outputs": ["{projectRoot}/build", "{projectRoot}/public/build"] } } } @@ -217,10 +200,7 @@ option for the task runner in `nx.json`: "tasksRunnerOptions": { "default": { "options": { - "cacheableOperations": [ - "build", - "test" - ], + "cacheableOperations": ["build", "test"], "cacheDirectory": "/tmp/mycache" } } diff --git a/website/docs/getting-started.md b/website/docs/getting-started.md index 9b1063371f..5baa11ec37 100644 --- a/website/docs/getting-started.md +++ b/website/docs/getting-started.md @@ -221,10 +221,7 @@ Second, let's mark `build` and `test` to be cacheable operations. "default": { "runner": "nx/tasks-runners/default", "options": { - "cacheableOperations": [ - "build", - "test" - ] + "cacheableOperations": ["build", "test"] } } } @@ -268,10 +265,7 @@ building the Remix app we need to help it by adding the following section to `pa "nx": { "targets": { "build": { - "outputs": [ - "{projectRoot}/build", - "{projectRoot}/public/build" - ] + "outputs": ["{projectRoot}/build", "{projectRoot}/public/build"] } } } diff --git a/website/docs/guides/hoisting.md b/website/docs/guides/hoisting.md index e67fc72fc9..96bc806e7e 100644 --- a/website/docs/guides/hoisting.md +++ b/website/docs/guides/hoisting.md @@ -25,17 +25,17 @@ directory instead. that ideally does not require any other modifications to a project. When the `--hoist` flag is used: -* Common dependencies will be installed _only_ to the top-level +- Common dependencies will be installed _only_ to the top-level `node_modules`, and omitted from individual package `node_modules`. -* Mostly-common dependencies are still hoisted, but outlier packages +- Mostly-common dependencies are still hoisted, but outlier packages with different versions will get a normal, local `node_modules` installation of the necessary dependencies. - * In this instance, `lerna bootstrap` will always use `npm install` + - In this instance, `lerna bootstrap` will always use `npm install` with the `--global-style` flag, regardless of client configuration. -* Binaries from those common packages are symlinked to individual +- Binaries from those common packages are symlinked to individual package `node_modules/.bin` directories, so that `package.json` scripts continue to work unmodified. -* Well-behaved Node-based software should continue to work unmodified. +- Well-behaved Node-based software should continue to work unmodified. ## Disadvantages with hoisting diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 2874483d01..749911cb7d 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -34,9 +34,9 @@ const config = { ({ docs: { sidebarPath: require.resolve("./sidebars.js"), - // Please change this to your repo. // Remove this to remove the "edit this page" links. editUrl: "https://github.com/lerna/lerna/tree/main/website/", + sidebarCollapsed: false, }, theme: { customCss: [require.resolve("./src/css/custom.css"), require.resolve("./src/css/helpers.css")],