Skip to content

Commit

Permalink
feat(bundling): add convert-to-inferred generator for @nx/rollup (nrw…
Browse files Browse the repository at this point in the history
…l#26280)

This PR adds `@nx/rollup:convert-to-inferred` generator.


## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
  • Loading branch information
jaysoo authored Jun 13, 2024
1 parent 364198f commit 8804f12
Show file tree
Hide file tree
Showing 14 changed files with 992 additions and 15 deletions.
8 changes: 8 additions & 0 deletions docs/generated/manifests/menus.json
Original file line number Diff line number Diff line change
Expand Up @@ -9368,6 +9368,14 @@
"children": [],
"isExternal": false,
"disableCollapsible": false
},
{
"id": "convert-to-inferred",
"path": "/nx-api/rollup/generators/convert-to-inferred",
"name": "convert-to-inferred",
"children": [],
"isExternal": false,
"disableCollapsible": false
}
],
"isExternal": false,
Expand Down
9 changes: 9 additions & 0 deletions docs/generated/manifests/nx-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -2755,6 +2755,15 @@
"originalFilePath": "/packages/rollup/src/generators/configuration/schema.json",
"path": "/nx-api/rollup/generators/configuration",
"type": "generator"
},
"/nx-api/rollup/generators/convert-to-inferred": {
"description": "Convert existing Rollup project(s) using `@nx/rollup:*` executors to use `@nx/rollup/plugin`.",
"file": "generated/packages/rollup/generators/convert-to-inferred.json",
"hidden": false,
"name": "convert-to-inferred",
"originalFilePath": "/packages/rollup/src/generators/convert-to-inferred/schema.json",
"path": "/nx-api/rollup/generators/convert-to-inferred",
"type": "generator"
}
},
"path": "/nx-api/rollup"
Expand Down
9 changes: 9 additions & 0 deletions docs/generated/packages-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2726,6 +2726,15 @@
"originalFilePath": "/packages/rollup/src/generators/configuration/schema.json",
"path": "rollup/generators/configuration",
"type": "generator"
},
{
"description": "Convert existing Rollup project(s) using `@nx/rollup:*` executors to use `@nx/rollup/plugin`.",
"file": "generated/packages/rollup/generators/convert-to-inferred.json",
"hidden": false,
"name": "convert-to-inferred",
"originalFilePath": "/packages/rollup/src/generators/convert-to-inferred/schema.json",
"path": "rollup/generators/convert-to-inferred",
"type": "generator"
}
],
"githubRoot": "https://github.com/nrwl/nx/blob/master",
Expand Down
30 changes: 30 additions & 0 deletions docs/generated/packages/rollup/generators/convert-to-inferred.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "convert-to-inferred",
"factory": "./src/generators/convert-to-inferred/convert-to-inferred",
"schema": {
"$schema": "https://json-schema.org/schema",
"$id": "NxRollupConvertToInferred",
"description": "Convert existing Rollup project(s) using `@nx/rollup:rollup` executor to use `@nx/rollup/plugin`. Defaults to migrating all projects. Pass '--project' to migrate only one target.",
"title": "Convert Rollup project from executor to plugin",
"type": "object",
"properties": {
"project": {
"type": "string",
"description": "The project to convert from using the `@nx/rollup:rollup` executor to use `@nx/rollup/plugin`.",
"x-priority": "important"
},
"skipFormat": {
"type": "boolean",
"description": "Whether to format files at the end of the migration.",
"default": false
}
},
"presets": []
},
"description": "Convert existing Rollup project(s) using `@nx/rollup:*` executors to use `@nx/rollup/plugin`.",
"implementation": "/packages/rollup/src/generators/convert-to-inferred/convert-to-inferred.ts",
"aliases": [],
"hidden": false,
"path": "/packages/rollup/src/generators/convert-to-inferred/schema.json",
"type": "generator"
}
1 change: 1 addition & 0 deletions docs/shared/reference/sitemap.md
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@
- [generators](/nx-api/rollup/generators)
- [init](/nx-api/rollup/generators/init)
- [configuration](/nx-api/rollup/generators/configuration)
- [convert-to-inferred](/nx-api/rollup/generators/convert-to-inferred)
- [storybook](/nx-api/storybook)
- [documents](/nx-api/storybook/documents)
- [Overview](/nx-api/storybook/documents/overview)
Expand Down
30 changes: 15 additions & 15 deletions e2e/webpack/src/webpack.legacy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,21 +118,21 @@ describe('Webpack Plugin (legacy)', () => {
updateFile(
`${appName}/webpack.config.js`,
`
const { join } = require('path');
const {NxWebpackPlugin} = require('@nx/webpack');
module.exports = {
output: {
path: join(__dirname, '../dist/app9524918'),
},
plugins: [
new NxAppWebpackPlugin({
main: './src/main.ts',
compiler: 'tsc',
index: './src/index.html',
tsConfig: './tsconfig.app.json',
})
]
};
const { join } = require('path');
const {NxWebpackPlugin} = require('@nx/webpack');
module.exports = {
output: {
path: join(__dirname, '../dist/app9524918'),
},
plugins: [
new NxAppWebpackPlugin({
main: './src/main.ts',
compiler: 'tsc',
index: './src/index.html',
tsConfig: './tsconfig.app.json',
})
]
};
`
);

Expand Down
1 change: 1 addition & 0 deletions packages/react/plugins/bundle-rollup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as rollup from 'rollup';

// TODO(v20): This should be deprecated and removed in v22.
function getRollupOptions(options: rollup.RollupOptions) {
const extraGlobals = {
react: 'React',
Expand Down
5 changes: 5 additions & 0 deletions packages/rollup/generators.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
"factory": "./src/generators/configuration/configuration",
"schema": "./src/generators/configuration/schema.json",
"description": "Add rollup configuration to a project."
},
"convert-to-inferred": {
"factory": "./src/generators/convert-to-inferred/convert-to-inferred",
"schema": "./src/generators/convert-to-inferred/schema.json",
"description": "Convert existing Rollup project(s) using `@nx/rollup:*` executors to use `@nx/rollup/plugin`."
}
}
}
Loading

0 comments on commit 8804f12

Please sign in to comment.