fix(nx-dev): remove fence from new packages and "nx add" commands (#21705)

This commit is contained in:
Miroslav Jonaš 2024-02-08 14:43:50 +01:00 committed by GitHub
parent 49bba42d37
commit 3ead01987b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
66 changed files with 131 additions and 76 deletions

View File

@ -33,7 +33,7 @@ In any Nx workspace, you can install `@nx/angular` by running the following comm
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/angular
```

View File

@ -29,7 +29,7 @@ In any Nx workspace, you can install `@nx/cypress` by running the following comm
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/cypress
```

View File

@ -36,7 +36,7 @@ In any Nx workspace, you can install `@nx/detox` by running the following comman
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/detox
```

View File

@ -25,7 +25,7 @@ In any Nx workspace, you can install `@nx/esbuild` by running the following comm
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/esbuild
```

View File

@ -13,10 +13,27 @@ Make sure to install the `@nx/eslint-plugin` version that matches the version of
In any Nx workspace, you can install `@nx/eslint-plugin` by running the following commands if the package is not already installed:
```shell
{% tabs %}
{% tab label="Nx 18+" %}
```shell {% skipRescope=true %}
nx add @nx/eslint-plugin
```
This will install the correct version of `@nx/eslint-plugin`.
{% /tab %}
{% tab label="Nx < 18" %}
Install the `@nx/eslint-plugin` package with your package manager.
```shell
npm add -D @nx/eslint-plugin
```
{% /tab %}
{% /tabs %}
## Included plugins
The plugin contains the following rule configurations divided into sub-plugins.

View File

@ -13,7 +13,7 @@ In any Nx workspace, you can install `@nx/eslint` by running the following comma
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/eslint
```
@ -57,14 +57,23 @@ The `@nx/eslint/plugin` is configured in the `plugins` array in `nx.json`.
- The `targetName` option controls the name of the inferred ESLint tasks. The default name is `lint`.
{% /tab %}
{% tab label="Nx < 18" %}
{% tab label="Nx 17" %}
Install the `@nx/eslint` package with your package manager.
```shell
```shell {% skipRescope=true %}
npm add -D @nx/eslint
```
{% /tab %}
{% tab label="Nx < 17" %}
Install the `@nx/linter` package with your package manager.
```shell
npm add -D @nx/linter
```
{% /tab %}
{% /tabs %}

View File

@ -21,7 +21,7 @@ In any Nx workspace, you can install `@nx/expo` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/expo
```

View File

@ -22,7 +22,7 @@ In any Nx workspace, you can install `@nx/express` by running the following comm
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/express
```

View File

@ -22,7 +22,7 @@ In any Nx workspace, you can install `@nx/jest` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/jest
```

View File

@ -18,7 +18,7 @@ In any Nx workspace, you can install `@nx/js` by running the following command:
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/js
```

View File

@ -34,7 +34,7 @@ In any Nx workspace, you can install `@nx/nest` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/nest
```

View File

@ -30,7 +30,7 @@ In any workspace, you can install `@nx/next` by running the following command:
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/next
```

View File

@ -13,7 +13,7 @@ In any Nx workspace, you can install `@nx/node` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/node
```

View File

@ -23,7 +23,7 @@ Make sure to install the `@nx/nuxt` version that matches the version of `nx` in
In any Nx workspace, you can install `@nx/nuxt` by running the following command:
```shell
```shell {% skipRescope=true %}
nx add @nx/nuxt
```

View File

@ -24,7 +24,7 @@ In any Nx workspace, you can install `@nx/playwright` by running the following c
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/playwright
```
@ -74,7 +74,7 @@ The `@nx/playwright/plugin` will automatically split your e2e tasks by file. You
Install the `@nx/playwright` package with your package manager.
```shell
```shell {% skipRescope=true %}
npm add -D @nx/playwright
```

View File

@ -35,7 +35,7 @@ In any Nx workspace, you can install `@nx/react-native` by running the following
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/react-native
```

View File

@ -27,7 +27,7 @@ In any Nx workspace, you can install `@nx/react` by running the following comman
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/react
```

View File

@ -28,7 +28,7 @@ In any Nx workspace, you can install `@nx/remix` by running the following comman
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/remix
```

View File

@ -20,7 +20,7 @@ In any Nx workspace, you can install `@nx/storybook` by running the following co
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/storybook
```

View File

@ -35,7 +35,7 @@ In any Nx workspace, you can install `@nx/vite` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/vite
```

View File

@ -26,7 +26,7 @@ In any Nx workspace, you can install `@nx/vue` by running the following command:
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/vue
```
@ -37,7 +37,7 @@ This will install the correct version of `@nx/vue`.
Install the `@nx/vue` package with your package manager.
```shell
```shell {% skipRescope=true %}
npm add -D @nx/vue
```

View File

@ -21,7 +21,7 @@ In any Nx workspace, you can install `@nx/web` by running the following command:
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/web
```

View File

@ -36,7 +36,7 @@ In any Nx workspace, you can install `@nx/webpack` by running the following comm
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/webpack
```

View File

@ -11,14 +11,14 @@ To enable automatically split e2e tasks, you need to turn on [inferred tasks](/c
{% tabs %}
{% tab label="Cypress" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/cypress
```
{% /tab %}
{% tab label="Playwright" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/playwright
```

View File

@ -15,7 +15,7 @@ Nx provides an `enforce-module-boundaries` eslint rule that enforces the public
To set up the lint rule, install these dependencies:
```shell
```shell {% skipRescope=true %}
nx add @nx/eslint-plugin @nx/devkit
```

View File

@ -134,7 +134,7 @@ When using React Native in Nx, you get the out-of-the-box support for TypeScript
For existing Nx workspaces, install the `@nx/react-native` package to add React Native capabilities to it.
```shell
```shell {% skipRescope=true %}
nx add @nx/react-native
```

View File

@ -31,7 +31,7 @@ In this recipe, we'll show you how to create a [Remix](https://remix.run) applic
Make sure to install the `@nx/remix` version that is on the same minor version as the `nx` version in your repository. If the version numbers get out of sync, you can encounter some difficult to debug errors. You can [fix Nx version mismatches with this recipe](/recipes/tips-n-tricks/keep-nx-versions-in-sync).
{% /callout %}
```shell
```shell {% skipRescope=true %}
nx add @nx/remix
```

View File

@ -41,7 +41,7 @@ At the next prompt, you can choose whether to use [Nx Cloud](https://nx.app) or
Your new workspace wont have much in it because of the `apps` preset. Youll need to generate an application to have some structure created. Add the Angular plugin to your workspace:
```shell
```shell {% skipRescope=true %}
nx add @nx/angular
```

View File

@ -33,7 +33,7 @@ In any Nx workspace, you can install `@nx/angular` by running the following comm
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/angular
```

View File

@ -29,7 +29,7 @@ In any Nx workspace, you can install `@nx/cypress` by running the following comm
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/cypress
```

View File

@ -36,7 +36,7 @@ In any Nx workspace, you can install `@nx/detox` by running the following comman
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/detox
```

View File

@ -25,7 +25,7 @@ In any Nx workspace, you can install `@nx/esbuild` by running the following comm
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/esbuild
```

View File

@ -13,10 +13,27 @@ Make sure to install the `@nx/eslint-plugin` version that matches the version of
In any Nx workspace, you can install `@nx/eslint-plugin` by running the following commands if the package is not already installed:
```shell
{% tabs %}
{% tab label="Nx 18+" %}
```shell {% skipRescope=true %}
nx add @nx/eslint-plugin
```
This will install the correct version of `@nx/eslint-plugin`.
{% /tab %}
{% tab label="Nx < 18" %}
Install the `@nx/eslint-plugin` package with your package manager.
```shell
npm add -D @nx/eslint-plugin
```
{% /tab %}
{% /tabs %}
## Included plugins
The plugin contains the following rule configurations divided into sub-plugins.

View File

@ -13,7 +13,7 @@ In any Nx workspace, you can install `@nx/eslint` by running the following comma
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/eslint
```
@ -57,14 +57,23 @@ The `@nx/eslint/plugin` is configured in the `plugins` array in `nx.json`.
- The `targetName` option controls the name of the inferred ESLint tasks. The default name is `lint`.
{% /tab %}
{% tab label="Nx < 18" %}
{% tab label="Nx 17" %}
Install the `@nx/eslint` package with your package manager.
```shell
```shell {% skipRescope=true %}
npm add -D @nx/eslint
```
{% /tab %}
{% tab label="Nx < 17" %}
Install the `@nx/linter` package with your package manager.
```shell
npm add -D @nx/linter
```
{% /tab %}
{% /tabs %}

View File

@ -21,7 +21,7 @@ In any Nx workspace, you can install `@nx/expo` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/expo
```

View File

@ -22,7 +22,7 @@ In any Nx workspace, you can install `@nx/express` by running the following comm
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/express
```

View File

@ -22,7 +22,7 @@ In any Nx workspace, you can install `@nx/jest` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/jest
```

View File

@ -18,7 +18,7 @@ In any Nx workspace, you can install `@nx/js` by running the following command:
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/js
```

View File

@ -34,7 +34,7 @@ In any Nx workspace, you can install `@nx/nest` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/nest
```

View File

@ -30,7 +30,7 @@ In any workspace, you can install `@nx/next` by running the following command:
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/next
```

View File

@ -13,7 +13,7 @@ In any Nx workspace, you can install `@nx/node` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/node
```

View File

@ -23,7 +23,7 @@ Make sure to install the `@nx/nuxt` version that matches the version of `nx` in
In any Nx workspace, you can install `@nx/nuxt` by running the following command:
```shell
```shell {% skipRescope=true %}
nx add @nx/nuxt
```

View File

@ -24,7 +24,7 @@ In any Nx workspace, you can install `@nx/playwright` by running the following c
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/playwright
```
@ -74,7 +74,7 @@ The `@nx/playwright/plugin` will automatically split your e2e tasks by file. You
Install the `@nx/playwright` package with your package manager.
```shell
```shell {% skipRescope=true %}
npm add -D @nx/playwright
```

View File

@ -35,7 +35,7 @@ In any Nx workspace, you can install `@nx/react-native` by running the following
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/react-native
```

View File

@ -27,7 +27,7 @@ In any Nx workspace, you can install `@nx/react` by running the following comman
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/react
```

View File

@ -28,7 +28,7 @@ In any Nx workspace, you can install `@nx/remix` by running the following comman
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/remix
```

View File

@ -20,7 +20,7 @@ In any Nx workspace, you can install `@nx/storybook` by running the following co
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/storybook
```

View File

@ -35,7 +35,7 @@ In any Nx workspace, you can install `@nx/vite` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/vite
```

View File

@ -26,7 +26,7 @@ In any Nx workspace, you can install `@nx/vue` by running the following command:
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/vue
```
@ -37,7 +37,7 @@ This will install the correct version of `@nx/vue`.
Install the `@nx/vue` package with your package manager.
```shell
```shell {% skipRescope=true %}
npm add -D @nx/vue
```

View File

@ -21,7 +21,7 @@ In any Nx workspace, you can install `@nx/web` by running the following command:
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/web
```

View File

@ -36,7 +36,7 @@ In any Nx workspace, you can install `@nx/webpack` by running the following comm
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/webpack
```

View File

@ -82,7 +82,7 @@ Install `@nx/js` plugin.
> Note: you should make sure any first party, `@nx/` scoped, plugins match the `nx` package version
```shell
```shell {% skipRescope=true %}
nx add @nx/js@<nx-version>
```

View File

@ -21,7 +21,7 @@ Because we are using an Nx plugin for Deno, all the features of Nx are available
Make sure you have Deno installed on your machine. Consult the [Deno docs for more details](https://deno.com/manual/getting_started/installation)
{% /callout %}
```shell
```shell {% skipRescope=true %}
nx add @nx/deno
```

View File

@ -21,7 +21,7 @@ Because we are using an Nx plugin for Express, all the features of Nx are availa
Make sure to install the `@nx/express` version that matches the version of `nx` in your repository. If the version numbers get out of sync, you can encounter some difficult to debug errors. You can [fix Nx version mismatches with this recipe](/recipes/tips-n-tricks/keep-nx-versions-in-sync).
{% /callout %}
```shell
```shell {% skipRescope=true %}
nx add @nx/express
```

View File

@ -34,7 +34,7 @@ If you are adding Fastify to an existing repo, continue to the next section.
## Install the Node Plugin
```shell
```shell {% skipRescope=true %}
nx add @nx/node
```

View File

@ -26,7 +26,7 @@ Install all the dependencies we need:
{% tabs %}
{%tab label="npm"%}
```shell
```shell {% skipRescope=true %}
nx add @nx/node
npm add -D lit http-server
```
@ -34,7 +34,7 @@ npm add -D lit http-server
{% /tab %}
{%tab label="yarn"%}
```shell
```shell {% skipRescope=true %}
nx add @nx/node
yarn add -D lit http-server
```
@ -42,7 +42,7 @@ yarn add -D lit http-server
{% /tab %}
{%tab label="pnpm"%}
```shell
```shell {% skipRescope=true %}
nx add @nx/node
pnpm add -D lit http-server
```

View File

@ -18,7 +18,7 @@ This creates a single Deno application.
You can also add a new Deno application to an existing Nx monorepo workspace. Make sure you have the `@nx/deno` package installed:
```shell
```shell {% skipRescope=true %}
nx add @nx/deno
```

View File

@ -16,7 +16,7 @@ This creates a single Deno application.
You can also add a new Deno application to an existing Nx monorepo workspace. Make sure you have the `@nx/deno` package installed:
```shell
```shell {% skipRescope=true %}
nx add @nx/deno
```

View File

@ -21,7 +21,7 @@ npx create-nx-workspace@latest my-functions --preset=@nx/aws-lambda
First, make sure you have `@nx/aws-lambda` installed.
```shell
```shell {% skipRescope=true %}
nx add @nx/aws-lambda
```

View File

@ -23,7 +23,7 @@ npx create-nx-workspace@latest my-functions --preset=@nx/netlify --site=my-site
You will need to install `@nx/netlify` if you haven't already.
```shell
```shell {% skipRescope=true %}
nx add @nx/netlify
```

View File

@ -14,7 +14,7 @@ caption="Demoes how to use Nx generators in a PNPM workspace to automate the cre
If you don't already have a local plugin, use Nx to generate one:
```shell
```shell {% skipRescope=true %}
nx add @nx/plugin
nx g @nx/plugin:plugin my-plugin
```

View File

@ -12,7 +12,7 @@ Ensure that Nx is installed in your monorepo. Check out the [Installation docs](
The [`@nx/js` package](/nx-api/js) is required for Nx Release to manage and release JavaScript packages. Add it if it is not already installed:
```shell
```shell {% skipRescope=true %}
nx add @nx/js
```

View File

@ -8,7 +8,7 @@ This guide shows you how to create, run, and customize executors within your Nx
If you don't already have a local plugin, use Nx to generate one:
```shell
```shell {% skipRescope=true %}
nx add @nx/plugin
nx g @nx/plugin:plugin my-plugin
```

View File

@ -11,7 +11,7 @@ It can be difficult to set up a typescript library to compile to ESM and CommonJ
If you do not use Rollup already, install the corresponding Nx plugin as follows:
```shell
```shell {% skipRescope=true %}
nx add @nx/rollup
```

View File

@ -92,6 +92,7 @@ export interface FenceProps {
lineGroups: Record<string, number[]>;
language: string;
enableCopy: boolean;
skipRescope?: boolean;
selectedLineGroup?: string;
onLineGroupSelectionChange?: (selection: string) => void;
}
@ -106,6 +107,7 @@ export function Fence({
language,
enableCopy,
selectedLineGroup,
skipRescope,
onLineGroupSelectionChange,
}: FenceProps) {
if (highlightLines) {
@ -162,7 +164,7 @@ export function Fence({
};
}, [copied]);
const showRescopeMessage =
children.includes('@nx/') || command.includes('@nx/');
(!skipRescope && children.includes('@nx/')) || command.includes('@nx/');
function highlightChange(item: { label: string; value: string }) {
onLineGroupSelectionChange?.(item.value);
}

View File

@ -11,6 +11,7 @@ export const fence: Schema = {
command: { type: 'String', default: '' },
path: { type: 'String', default: '~/workspace' },
process: { type: 'Boolean', render: false, default: true },
skipRescope: { type: 'Boolean', default: false },
enableCopy: { type: 'Boolean', default: true },
},
transform(node, config) {