12 Commits

Author SHA1 Message Date
Colum Ferry
aefafc55ba
feat(module-federation): alias host and remote generators to consumer and producer (#29190)
## Current Behavior
Our Module Federation support across Angular and React contains Host and
Remote generators.
The module-federation.io docs have started to shift towards Consumer and
Producer terminology for better translation of meanings across
languages.


## Expected Behavior
To stay consistent with official terminology, add aliases for the host
and remote generators to allow for the new terminology. i.e. host ->
consumer, remote -> producer.

Therefore the following are all valid

```shell
nx g host shell --remotes=remote1
nx g host shell --producers=producer1
nx g consumer shell --remotes=remote1
nx g consumer shell --producers=remote1

nx g remote remote1 --host=shell
nx g remote remote1 --consumer=shell
nx g producer producer1 --host=shell
nx g producer producer1 --consumer=shell
```
2024-12-04 16:45:27 +00:00
Jack Hsu
ec5a5e6360
feat(react): update app and lib generators to support new TS solution setup (#28808)
This PR updates app and lib generators in the following packages such
that they will generate files with the TS solution setup if it is
detected.

- `@nx/react`
- `@nx/next`
- `@nx/remix`
- `@nx/expo`
- `@nx/react-native`

React apps and libs will be linked using npm/pnpm/yarn/bun workspaces
feature rather than through tsconfig paths. This means that local
aliases like `@/` will work with Next.js and Remix apps.

Note: This will be behind `--workspaces` flag when using `npx
create-nx-workspace` and choosing React stack. If you use the None/TS
stack then adding plugins like `nx add @nx/react` then generating apps,
it will automatically pick up the new TS solution setup.


<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
React generators are not compatible with TS solution setup (i.e.
workspaces + TS project references).

## Expected Behavior
React generators work with new TS solution setup (Plain, Next.js, Remix,
Expo, React Native).

## Related Issue(s)
#28322

---------

Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
Co-authored-by: Nicholas Cunningham <ndcunningham@gmail.com>
2024-11-28 22:18:45 -05:00
Colum Ferry
5cc88b87a2
feat(rspack): add convert-to-inferred generator (#29012)
- feat(module-federation): migrate to latest
- feat(rspack): add convert to legacy plugin
- feat(rspack): add convert-to-inferred generator

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
Our current rspack configs rely on executor usage.
But there is no automated method to convert the config to use inferred
targets

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Add convert-to-inferred generator

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

Fixes #
2024-11-21 09:19:08 -05:00
Nicholas Cunningham
da60c38a34
feat(rspack): update executor to be in line with webpack (#28913)
This PR brings the rspack executor `@nx/rspack:rspack` inline with
webpack.

It also prepares the executor to be used with the soon to be implemented
`NxRspackAppPlugin` so that we can support executor and inferred
targets.
2024-11-14 18:31:54 +00:00
Colum Ferry
fd2e8d0f55
feat(rspack): move logic for withWeb to applyWebConfig and bring in line with webpack (#28803)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
`withWeb` from `@nx/rspack` is not reflective of what `@nx/webpack`
does.


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Bring `withWeb` in line with `@nx/webpack`

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

Fixes #
2024-11-06 21:13:56 -05:00
Colum Ferry
b69ef46dcd
fix(rspack): remove unnecessary required properties in schema validation (#28796)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
The `@nx/rspack:rspack` executor had listed other properties as required
in the schema that could have been set by the rspack config.



## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Make those properties optional and add validation after config is
resolved

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

Fixes #
2024-11-05 17:47:49 +00:00
Colum Ferry
7e3f256756
fix(rspack): move main validation to implementation (#28794)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
We currently have validation for the `main` property in the `executor`
schema, however, this value could be defined in the `rspack.config`
file.
This can cause an inaccurate schema validation error

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
After loading the config file and applying the executor options, run
validation over the config.

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

Fixes #
2024-11-05 12:22:49 -05:00
Colum Ferry
735300c63e
feat(rspack): make target property optional (#28785)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
The `target` property is currently required by the `@nx/rspack:rspack`
executor, but is not by the `@nx/webpack:webpack` executor.
This can make migrating between the two a little more difficult.


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Target should be handled by Nx's `withWeb` helper or set intentionally
by the user in their `rspack.config` file.

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

Fixes #
2024-11-04 17:28:00 +00:00
Colum Ferry
36556f6f23
feat(rspack): add convert-webpack generator (#28167)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
We do not have an automated method for people to switch to rspack from
webpack applications


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
We should have a generator that will convert webpack application
projects to use rspack

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

Fixes #
2024-10-23 09:54:49 +01:00
Colum Ferry
216bd633e4
docs(rspack): remove incorrect information (#28383)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
The docs specify that the react library generator supports using rspack
as a bundler option.
The react library generator does not have rspack as an option.


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


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

Fixes #
2024-10-15 10:36:04 -04:00
Jack Hsu
27edf71cef
feat(misc): make directory a required option for generators (#28093)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## 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 #

---------

Co-authored-by: Colum Ferry <cferry09@gmail.com>
Co-authored-by: Nicholas Cunningham <ndcunningham@gmail.com>
2024-10-01 09:29:44 -04:00
Colum Ferry
6c032ab800 docs(rspack): add docs for rspack 2024-09-18 10:27:05 +01:00