Skip to content

Commit

Permalink
docs(bundling): add info on adding deps to package.json (#14963)
Browse files Browse the repository at this point in the history
  • Loading branch information
barbados-clemens committed Feb 13, 2023
1 parent d0ad53c commit 0b7ef8f
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 2 deletions.
15 changes: 14 additions & 1 deletion docs/generated/packages/rollup/executors/rollup.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@
"description": "Packages a library for different web usages (ESM, CommonJS).",
"cli": "nx",
"type": "object",
"presets": [
{
"name": "Including Dependencies in package.json",
"keys": [
"main",
"outputPath",
"project",
"tsConfig",
"buildableProjectDepsInPackageJsonType",
"updateBuildableProjectDepsInPackageJson"
]
}
],
"properties": {
"project": {
"type": "string",
Expand Down Expand Up @@ -172,7 +185,7 @@
]
}
},
"presets": []
"examplesFile": "{% tabs %}\n{% tab label=\"Including Dependencies\" %}\nTo include dependencies in the output `package.json`, the dependencies must be installed as a **dependencies** in the root `package.json`\n\n```json {% fileName=\"package.json\" %}\n{\n \"dependencies\": {\n \"some-dependency\": \"^1.0.0\"\n }\n}\n```\n\nTo have dependencies in the be listed in the final `package.json` of your project, set the `updateBuildableProjectDepsInPackageJson` option to `true`. After than dependencies will be added to the `peerDependencies` field of the output `package.json`. You can use `buildableProjectDepsInPackageJsonType` option to change which field the dependencies are output to.\n\n```json {% fileName=\"project.json\" %}\n{\n \"targets\": {\n \"build\": {\n \"executor\": \"@nrwl/rollup:rollup\",\n \"options\": {\n \"buildableProjectDepsInPackageJsonType\": \"dependencies\",\n \"updateBuildableProjectDepsInPackageJson\": true\n }\n }\n }\n}\n```\n\n{% /tab}\n{% /tabs %}\n"
},
"description": "Bundle a package using Rollup.",
"aliases": [],
Expand Down
30 changes: 30 additions & 0 deletions packages/rollup/src/docs/rollup-examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{% tabs %}
{% tab label="Including Dependencies" %}
To include dependencies in the output `package.json`, the dependencies must be installed as a **dependencies** in the root `package.json`

```json {% fileName="package.json" %}
{
"dependencies": {
"some-dependency": "^1.0.0"
}
}
```

To have dependencies in the be listed in the final `package.json` of your project, set the `updateBuildableProjectDepsInPackageJson` option to `true`. After than dependencies will be added to the `peerDependencies` field of the output `package.json`. You can use `buildableProjectDepsInPackageJsonType` option to change which field the dependencies are output to.

```json {% fileName="project.json" %}
{
"targets": {
"build": {
"executor": "@nrwl/rollup:rollup",
"options": {
"buildableProjectDepsInPackageJsonType": "dependencies",
"updateBuildableProjectDepsInPackageJson": true
}
}
}
}
```

{% /tab}
{% /tabs %}
16 changes: 15 additions & 1 deletion packages/rollup/src/executors/rollup/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
"description": "Packages a library for different web usages (ESM, CommonJS).",
"cli": "nx",
"type": "object",
"presets": [
{
"name": "Including Dependencies in package.json",
"keys": [
"main",
"outputPath",
"project",
"tsConfig",
"buildableProjectDepsInPackageJsonType",
"updateBuildableProjectDepsInPackageJson"
]
}
],
"properties": {
"project": {
"type": "string",
Expand Down Expand Up @@ -154,5 +167,6 @@
}
]
}
}
},
"examplesFile": "../../docs/rollup-examples.md"
}

1 comment on commit 0b7ef8f

@vercel
Copy link

@vercel vercel bot commented on 0b7ef8f Feb 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-nrwl.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-five.vercel.app
nx.dev

Please sign in to comment.