diff --git a/docs/generated/packages/js.json b/docs/generated/packages/js.json index a18f28155a..c39b7b743f 100644 --- a/docs/generated/packages/js.json +++ b/docs/generated/packages/js.json @@ -11,7 +11,7 @@ "id": "overview", "path": "/packages/js", "file": "shared/js-plugin", - "content": "The JS plugin contains executors and generators that are useful for JavaScript/TypeScript projects in an Nx workspace.\n\n## Setting Up JS\n\n### Installation\n\nIn any Nx workspace, you can install `@nrwl/js` by running the following commands if `@nrwl/js` package is not installed:\n\n```shell\nnpm i --save-dev @nrwl/js\n```\n\n```shell\nyarn add --dev @nrwl/js\n```\n\n### `ts` Preset\n\nWhen initializing a new Nx workspace, specifying `--preset=ts` will generate a workspace with `@nrwl/js` pre-installed.\n\n```shell\nnpx create-nx-workspace my-org --preset=ts\n```\n\n```shell\nyarn create nx-workspace my-org --preset=ts\n```\n\n## Create Libraries\n\nYou can add a new JS/TS library with the following command:\n\n```shell\nnx g @nrwl/js:lib my-lib\n```\n\n## Build\n\nYou can `build` libraries that are generated with `--buildable` flag.\n\n```shell\nnx g @nrwl/js:lib my-buildable-lib --buildable\n```\n\nGenerating a library with `--buildable` will add a `build` target to the library's `project.json` file allows the library to be built.\n\n```shell\nnx build my-buildable-lib\n```\n\n## Test\n\nYou can test a library with the following command:\n\n```shell\nnx test my-lib\n```\n\n## Lint\n\nYou can lint a library with the following command:\n\n```shell\nnx lint my-lib\n```\n\n## Compiler\n\nBy default, `@nrwl/js` uses [TypeScript Compiler (TSC)](https://www.typescriptlang.org/docs/handbook/2/basic-types.html#tsc-the-typescript-compiler), via `@nrwl/js:tsc` executor, to compile your libraries. Optionally, you can switch `tsc` out for a different compiler with `--compiler` flag when executing the generators.\n\nCurrently, `@nrwl/js` supports the following compilers:\n\n- [Speedy Web Compiler (SWC)](https://swc.rs)\n\n### SWC\n\n- Create a buildable library with `swc`\n\n```shell\nnx g @nrwl/js:lib my-swc-lib --compiler=swc --buildable\n```\n\n- Convert a `tsc` library to use `swc`\n\n```shell\nnx g @nrwl/js:convert-to-swc my-buildable-lib\n```\n\nNow the `build` command will use `@nrwl/js:swc` executor to compile your libraries.\n\n> The first time you generate a `swc` library or convert a `tsc` library over to `swc`, `@nrwl/js` will install the necessary dependencies to use `swc`.\n" + "content": "The JS plugin contains executors and generators that are useful for JavaScript/TypeScript projects in an Nx workspace.\n\n## Setting Up JS\n\n### Installation\n\nIn any Nx workspace, you can install `@nrwl/js` by running the following commands if `@nrwl/js` package is not installed:\n\n{% tabs %}\n{%tab label=\"npm\"%}\n\n```bash\nnpm i --save-dev @nrwl/js\n```\n\n{% /tab %}\n{%tab label=\"yarn\"%}\n\n```bash\nyarn add --dev @nrwl/js\n```\n\n{% /tab %}\n{% /tabs %}\n\n### `ts` Preset\n\nWhen initializing a new Nx workspace, specifying `--preset=ts` will generate a workspace with `@nrwl/js` pre-installed.\n\n{% tabs %}\n{%tab label=\"npm\"%}\n\n```bash\nnpx create-nx-workspace my-org --preset=ts\n```\n\n{% /tab %}\n{%tab label=\"yarn\"%}\n\n```bash\nyarn create nx-workspace my-org --preset=ts\n```\n\n{% /tab %}\n{% /tabs %}\n\n## Create Libraries\n\nYou can add a new JS/TS library with the following command:\n\n```shell\nnx g @nrwl/js:lib my-lib\n```\n\n## Build\n\nYou can `build` libraries that are generated with `--buildable` flag.\n\n```shell\nnx g @nrwl/js:lib my-buildable-lib --buildable\n```\n\nGenerating a library with `--buildable` will add a `build` target to the library's `project.json` file allows the library to be built.\n\n```shell\nnx build my-buildable-lib\n```\n\n## Test\n\nYou can test a library with the following command:\n\n```shell\nnx test my-lib\n```\n\n## Lint\n\nYou can lint a library with the following command:\n\n```shell\nnx lint my-lib\n```\n\n## Compiler\n\nBy default, `@nrwl/js` uses [TypeScript Compiler (TSC)](https://www.typescriptlang.org/docs/handbook/2/basic-types.html#tsc-the-typescript-compiler), via `@nrwl/js:tsc` executor, to compile your libraries. Optionally, you can switch `tsc` out for a different compiler with `--compiler` flag when executing the generators.\n\nCurrently, `@nrwl/js` supports the following compilers:\n\n- [Speedy Web Compiler (SWC)](https://swc.rs)\n\n### SWC\n\n- Create a buildable library with `swc`\n\n```shell\nnx g @nrwl/js:lib my-swc-lib --compiler=swc --buildable\n```\n\n- Convert a `tsc` library to use `swc`\n\n```shell\nnx g @nrwl/js:convert-to-swc my-buildable-lib\n```\n\nNow the `build` command will use `@nrwl/js:swc` executor to compile your libraries.\n\n> The first time you generate a `swc` library or convert a `tsc` library over to `swc`, `@nrwl/js` will install the necessary dependencies to use `swc`.\n" } ], "generators": [ diff --git a/docs/shared/js-plugin.md b/docs/shared/js-plugin.md index 545e7c0d6d..e78c11ab81 100644 --- a/docs/shared/js-plugin.md +++ b/docs/shared/js-plugin.md @@ -6,26 +6,44 @@ The JS plugin contains executors and generators that are useful for JavaScript/T In any Nx workspace, you can install `@nrwl/js` by running the following commands if `@nrwl/js` package is not installed: -```shell +{% tabs %} +{%tab label="npm"%} + +```bash npm i --save-dev @nrwl/js ``` -```shell +{% /tab %} +{%tab label="yarn"%} + +```bash yarn add --dev @nrwl/js ``` +{% /tab %} +{% /tabs %} + ### `ts` Preset When initializing a new Nx workspace, specifying `--preset=ts` will generate a workspace with `@nrwl/js` pre-installed. -```shell +{% tabs %} +{%tab label="npm"%} + +```bash npx create-nx-workspace my-org --preset=ts ``` -```shell +{% /tab %} +{%tab label="yarn"%} + +```bash yarn create nx-workspace my-org --preset=ts ``` +{% /tab %} +{% /tabs %} + ## Create Libraries You can add a new JS/TS library with the following command: