Skip to content

Commit 24e45d4

Browse files
authored
feat(bundling): rename esbuild-project, rollup-project, and webpack-project generators to "configuration" generators for consistency in naming (#18003)
1 parent 8d5cfcc commit 24e45d4

File tree

35 files changed

+388
-120
lines changed

35 files changed

+388
-120
lines changed

docs/generated/manifests/menus.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4841,9 +4841,9 @@
48414841
"disableCollapsible": false
48424842
},
48434843
{
4844-
"id": "esbuild-project",
4845-
"path": "/packages/esbuild/generators/esbuild-project",
4846-
"name": "esbuild-project",
4844+
"id": "configuration",
4845+
"path": "/packages/esbuild/generators/configuration",
4846+
"name": "configuration",
48474847
"children": [],
48484848
"isExternal": false,
48494849
"disableCollapsible": false
@@ -6530,9 +6530,9 @@
65306530
"disableCollapsible": false
65316531
},
65326532
{
6533-
"id": "rollup-project",
6534-
"path": "/packages/rollup/generators/rollup-project",
6535-
"name": "rollup-project",
6533+
"id": "configuration",
6534+
"path": "/packages/rollup/generators/configuration",
6535+
"name": "configuration",
65366536
"children": [],
65376537
"isExternal": false,
65386538
"disableCollapsible": false
@@ -6986,9 +6986,9 @@
69866986
"disableCollapsible": false
69876987
},
69886988
{
6989-
"id": "webpack-project",
6990-
"path": "/packages/webpack/generators/webpack-project",
6991-
"name": "webpack-project",
6989+
"id": "configuration",
6990+
"path": "/packages/webpack/generators/configuration",
6991+
"name": "configuration",
69926992
"children": [],
69936993
"isExternal": false,
69946994
"disableCollapsible": false

docs/generated/manifests/packages.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -651,13 +651,13 @@
651651
"path": "/packages/esbuild/generators/init",
652652
"type": "generator"
653653
},
654-
"/packages/esbuild/generators/esbuild-project": {
654+
"/packages/esbuild/generators/configuration": {
655655
"description": "Add esbuild configuration to a project.",
656-
"file": "generated/packages/esbuild/generators/esbuild-project.json",
656+
"file": "generated/packages/esbuild/generators/configuration.json",
657657
"hidden": true,
658-
"name": "esbuild-project",
659-
"originalFilePath": "/packages/esbuild/src/generators/esbuild-project/schema.json",
660-
"path": "/packages/esbuild/generators/esbuild-project",
658+
"name": "configuration",
659+
"originalFilePath": "/packages/esbuild/src/generators/configuration/schema.json",
660+
"path": "/packages/esbuild/generators/configuration",
661661
"type": "generator"
662662
}
663663
},
@@ -2336,13 +2336,13 @@
23362336
"path": "/packages/rollup/generators/init",
23372337
"type": "generator"
23382338
},
2339-
"/packages/rollup/generators/rollup-project": {
2339+
"/packages/rollup/generators/configuration": {
23402340
"description": "Add rollup configuration to a project.",
2341-
"file": "generated/packages/rollup/generators/rollup-project.json",
2341+
"file": "generated/packages/rollup/generators/configuration.json",
23422342
"hidden": true,
2343-
"name": "rollup-project",
2344-
"originalFilePath": "/packages/rollup/src/generators/rollup-project/schema.json",
2345-
"path": "/packages/rollup/generators/rollup-project",
2343+
"name": "configuration",
2344+
"originalFilePath": "/packages/rollup/src/generators/configuration/schema.json",
2345+
"path": "/packages/rollup/generators/configuration",
23462346
"type": "generator"
23472347
}
23482348
},
@@ -2782,13 +2782,13 @@
27822782
"path": "/packages/webpack/generators/init",
27832783
"type": "generator"
27842784
},
2785-
"/packages/webpack/generators/webpack-project": {
2785+
"/packages/webpack/generators/configuration": {
27862786
"description": "Add webpack configuration to a project.",
2787-
"file": "generated/packages/webpack/generators/webpack-project.json",
2787+
"file": "generated/packages/webpack/generators/configuration.json",
27882788
"hidden": true,
2789-
"name": "webpack-project",
2790-
"originalFilePath": "/packages/webpack/src/generators/webpack-project/schema.json",
2791-
"path": "/packages/webpack/generators/webpack-project",
2789+
"name": "configuration",
2790+
"originalFilePath": "/packages/webpack/src/generators/configuration/schema.json",
2791+
"path": "/packages/webpack/generators/configuration",
27922792
"type": "generator"
27932793
}
27942794
},

docs/generated/packages-metadata.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -642,11 +642,11 @@
642642
},
643643
{
644644
"description": "Add esbuild configuration to a project.",
645-
"file": "generated/packages/esbuild/generators/esbuild-project.json",
645+
"file": "generated/packages/esbuild/generators/configuration.json",
646646
"hidden": true,
647-
"name": "esbuild-project",
648-
"originalFilePath": "/packages/esbuild/src/generators/esbuild-project/schema.json",
649-
"path": "esbuild/generators/esbuild-project",
647+
"name": "configuration",
648+
"originalFilePath": "/packages/esbuild/src/generators/configuration/schema.json",
649+
"path": "esbuild/generators/configuration",
650650
"type": "generator"
651651
}
652652
],
@@ -2313,11 +2313,11 @@
23132313
},
23142314
{
23152315
"description": "Add rollup configuration to a project.",
2316-
"file": "generated/packages/rollup/generators/rollup-project.json",
2316+
"file": "generated/packages/rollup/generators/configuration.json",
23172317
"hidden": true,
2318-
"name": "rollup-project",
2319-
"originalFilePath": "/packages/rollup/src/generators/rollup-project/schema.json",
2320-
"path": "rollup/generators/rollup-project",
2318+
"name": "configuration",
2319+
"originalFilePath": "/packages/rollup/src/generators/configuration/schema.json",
2320+
"path": "rollup/generators/configuration",
23212321
"type": "generator"
23222322
}
23232323
],
@@ -2754,11 +2754,11 @@
27542754
},
27552755
{
27562756
"description": "Add webpack configuration to a project.",
2757-
"file": "generated/packages/webpack/generators/webpack-project.json",
2757+
"file": "generated/packages/webpack/generators/configuration.json",
27582758
"hidden": true,
2759-
"name": "webpack-project",
2760-
"originalFilePath": "/packages/webpack/src/generators/webpack-project/schema.json",
2761-
"path": "webpack/generators/webpack-project",
2759+
"name": "configuration",
2760+
"originalFilePath": "/packages/webpack/src/generators/configuration/schema.json",
2761+
"path": "webpack/generators/configuration",
27622762
"type": "generator"
27632763
}
27642764
],

docs/generated/packages/esbuild/documents/overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ This command will install the esbuild plugin if needed, and set `@nx/esbuild:esb
4545
If you already have a JS project that you want to use esbuild for, run this command:
4646

4747
```shell
48-
nx g esbuild-project mylib
48+
nx g @nx/esbuild:configuration mylib
4949
```
5050

5151
This generator validates there isn't an existing `build` target. If you want to overwrite the existing target you can pass the `--skipValidation` option.
5252

5353
```shell
54-
nx g esbuild-project mylib --skipValidation
54+
nx g @nx/esbuild:configuration mylib --skipValidation
5555
```
5656

5757
## Using esbuild

docs/generated/packages/esbuild/executors/esbuild.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@
206206
}
207207
},
208208
"additionalProperties": true,
209-
"examplesFile": "`<app-root>/project.json`:\n\n```json\n{\n //...\n \"targets\": {\n //...\n \"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\"\n }\n }\n }\n}\n```\n\n```bash\nnx build <app-name>\n```\n\n## Examples\n\n{% tabs %}\n{% tab label=\"CommonJS output\" %}\n\nThe CommonJS format is required in some environments, such as Electron applications. By default, `esbuild` will use the ESM format, which is recommended for Web and Node applications. You may also output to multiple formats.\n\n```bash\nnx build <app-name> --format=cjs\nnx build <app-name> --format=esm,cjs\nnx build <app-name> # defaults to es# defaults to esm\n```\n\n```json\n\"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\",\n \"format\": [\"esm\", \"cjs\"]\n}\n```\n\n{% /tab %}\n{% tab label=\"External packages\" %}\n\nYou can avoid packages from being bundled by providing the `external` option with a list of packages to skip.\n\nYou can also use `*` wildcard to match assets.\n\n```json\n\"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\",\n \"external\": [\"lodash\", \"*.png\"]\n}\n```\n\n{% /tab %}\n{% tab label=\"Skip type checking\" %}\n\nType checking is the slowest part of the build. You may want to skip type checking during build and run it as another job in CI.\n\n```json\n\"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\",\n \"skipTypeCheck\": true\n}\n```\n\n{% /tab %}\n{% tab label=\"Additional esbuild options\" %}\n\nAdditional [esbuild options](https://esbuild.github.io/api/) can be passed using `esbuildOptions` in your project configuration.\n\n```json\n\"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\",\n \"esbuildOptions\": {\n \"legalComments\": \"inline\"\n \"banner\": {\n \".js\": \"// banner\"\n },\n \"footer\": {\n \".js\": \"// footer\"\n }\n }\n}\n```\n\n{% /tab %}\n{% tabs %}\n",
209+
"examplesFile": "`<app-root>/project.json`:\n\n```jsonc\n{\n //...\n \"targets\": {\n //...\n \"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\"\n }\n }\n }\n}\n```\n\n```bash\nnx build <app-name>\n```\n\n## Examples\n\n{% tabs %}\n{% tab label=\"CommonJS output\" %}\n\nThe CommonJS format is required in some environments, such as Electron applications. By default, `esbuild` will use the ESM format, which is recommended for Web and Node applications. You may also output to multiple formats.\n\n```bash\nnx build <app-name> --format=cjs\nnx build <app-name> --format=esm,cjs\nnx build <app-name> # defaults to es# defaults to esm\n```\n\n```json\n\"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\",\n \"format\": [\"esm\", \"cjs\"]\n}\n```\n\n{% /tab %}\n{% tab label=\"External packages\" %}\n\nYou can avoid packages from being bundled by providing the `external` option with a list of packages to skip.\n\nYou can also use `*` wildcard to match assets.\n\n```json\n\"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\",\n \"external\": [\"lodash\", \"*.png\"]\n}\n```\n\n{% /tab %}\n{% tab label=\"Skip type checking\" %}\n\nType checking is the slowest part of the build. You may want to skip type checking during build and run it as another job in CI.\n\n```json\n\"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\",\n \"skipTypeCheck\": true\n}\n```\n\n{% /tab %}\n{% tab label=\"Additional esbuild options\" %}\n\nAdditional [esbuild options](https://esbuild.github.io/api/) can be passed using `esbuildOptions` in your project configuration.\n\n```json\n\"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\",\n \"esbuildOptions\": {\n \"legalComments\": \"inline\"\n \"banner\": {\n \".js\": \"// banner\"\n },\n \"footer\": {\n \".js\": \"// footer\"\n }\n }\n}\n```\n\n{% /tab %}\n{% tabs %}\n",
210210
"presets": []
211211
},
212212
"description": "Bundle a package using EsBuild.",
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"name": "configuration",
3+
"aliases": ["esbuild-project"],
4+
"factory": "./src/generators/configuration/configuration",
5+
"schema": {
6+
"$schema": "http://json-schema.org/schema",
7+
"$id": "NxEsBuildProject",
8+
"cli": "nx",
9+
"title": "Add esbuild configuration to a project",
10+
"description": "Add esbuild configuration to a project.",
11+
"type": "object",
12+
"properties": {
13+
"project": {
14+
"type": "string",
15+
"description": "The name of the project.",
16+
"$default": { "$source": "argv", "index": 0 },
17+
"x-dropdown": "project",
18+
"x-prompt": "What is the name of the project to set up a esbuild for?",
19+
"x-priority": "important"
20+
},
21+
"main": {
22+
"type": "string",
23+
"description": "Path relative to the workspace root for the main entry file. Defaults to `<project-root>/src/main.ts` or `<project-root>src/index.ts`, whichever is found.",
24+
"alias": "entryFile",
25+
"x-priority": "important"
26+
},
27+
"tsConfig": {
28+
"type": "string",
29+
"description": "Path relative to the workspace root for the tsconfig file to build with. Defaults to `<project-root>/tsconfig.app.json` or `<project-root>/tsconfig.lib.json`, whichever is found.",
30+
"x-priority": "important"
31+
},
32+
"skipFormat": {
33+
"description": "Skip formatting files.",
34+
"type": "boolean",
35+
"default": false,
36+
"x-priority": "internal"
37+
},
38+
"skipPackageJson": {
39+
"type": "boolean",
40+
"default": false,
41+
"description": "Do not add dependencies to `package.json`.",
42+
"x-priority": "internal"
43+
},
44+
"skipValidation": {
45+
"type": "boolean",
46+
"default": false,
47+
"description": "Do not perform any validation on existing project.",
48+
"x-priority": "internal"
49+
},
50+
"importPath": {
51+
"type": "string",
52+
"description": "The library name used to import it, like `@myorg/my-awesome-lib`."
53+
},
54+
"platform": {
55+
"type": "string",
56+
"description": "Platform target for outputs.",
57+
"enum": ["browser", "node", "neutral"],
58+
"default": "node"
59+
},
60+
"buildTarget": {
61+
"description": "The build target to add.",
62+
"type": "string",
63+
"default": "build"
64+
}
65+
},
66+
"required": [],
67+
"examplesFile": "```bash\nnx g @nx/esbuild:configuration my-package\n```\n\n{% callout type=\"note\" title=\"Overwriting existing build option\" %}\nThe `configuration` generator validates that an existing `build` target isn't already defined for the project. If you are adding esbuild to a project with an existing `build` target, pass the `--skipValidation` option.\n{% /callout %}\n\nYou may also provide a custom main entry file, or a custom tsconfig file if the defaults don't work. By default, the generator will look for a main file matching `src/index.ts` or `src/main.ts`, and a tsconfig file matching `tsconfig.app.json` or `tsconfig.lib.json`.\n\n```bash\nnx g @nx/esbuild:configuration my-package \\\n--main=packages/my-package/src/entry.ts \\\n--tsConfig=packages/my-package/tsconfig.custom.json\n```\n",
68+
"presets": []
69+
},
70+
"description": "Add esbuild configuration to a project.",
71+
"hidden": true,
72+
"implementation": "/packages/esbuild/src/generators/configuration/configuration.ts",
73+
"path": "/packages/esbuild/src/generators/configuration/schema.json",
74+
"type": "generator"
75+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"name": "configuration",
3+
"aliases": ["rollup-project"],
4+
"factory": "./src/generators/configuration/configuration",
5+
"schema": {
6+
"$schema": "http://json-schema.org/schema",
7+
"$id": "NxRollupProject",
8+
"cli": "nx",
9+
"title": "Add Rollup Configuration to a project",
10+
"description": "Add Rollup Configuration to a project.",
11+
"type": "object",
12+
"properties": {
13+
"project": {
14+
"type": "string",
15+
"description": "The name of the project.",
16+
"$default": { "$source": "argv", "index": 0 },
17+
"x-dropdown": "project",
18+
"x-prompt": "What is the name of the project to set up a rollup for?",
19+
"x-priority": "important"
20+
},
21+
"compiler": {
22+
"type": "string",
23+
"enum": ["babel", "swc", "tsc"],
24+
"description": "The compiler to use to build source.",
25+
"default": "babel"
26+
},
27+
"main": {
28+
"type": "string",
29+
"description": "Path relative to the workspace root for the main entry file. Defaults to '<projectRoot>/src/main.ts'.",
30+
"alias": "entryFile",
31+
"x-priority": "important"
32+
},
33+
"tsConfig": {
34+
"type": "string",
35+
"description": "Path relative to the workspace root for the tsconfig file to build with. Defaults to '<projectRoot>/tsconfig.app.json'.",
36+
"x-priority": "important"
37+
},
38+
"skipFormat": {
39+
"description": "Skip formatting files.",
40+
"type": "boolean",
41+
"default": false,
42+
"x-priority": "internal"
43+
},
44+
"skipPackageJson": {
45+
"type": "boolean",
46+
"default": false,
47+
"description": "Do not add dependencies to `package.json`.",
48+
"x-priority": "internal"
49+
},
50+
"skipValidation": {
51+
"type": "boolean",
52+
"default": false,
53+
"description": "Do not perform any validation on existing project.",
54+
"x-priority": "internal"
55+
},
56+
"importPath": {
57+
"type": "string",
58+
"description": "The library name used to import it, like `@myorg/my-awesome-lib`."
59+
},
60+
"external": {
61+
"type": "array",
62+
"description": "A list of external modules that will not be bundled (`react`, `react-dom`, etc.).",
63+
"items": { "type": "string" }
64+
},
65+
"rollupConfig": {
66+
"type": "string",
67+
"description": "Path relative to workspace root to a custom rollup file that takes a config object and returns an updated config."
68+
},
69+
"buildTarget": {
70+
"description": "The build target to add.",
71+
"type": "string",
72+
"default": "build"
73+
}
74+
},
75+
"required": [],
76+
"presets": []
77+
},
78+
"description": "Add rollup configuration to a project.",
79+
"hidden": true,
80+
"implementation": "/packages/rollup/src/generators/configuration/configuration.ts",
81+
"path": "/packages/rollup/src/generators/configuration/schema.json",
82+
"type": "generator"
83+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy