71 Commits

Author SHA1 Message Date
Younes Jaaidi
9fe8274367
feat(angular): add vitest option to angular (#27311)
- This adds `vitest` option to `unitTestRunner` for Angular generators.
- This **does not** add vitest option to `create-nx-workspace` but I
think we should provide this as an option in the future. Please let me
know if you wantme to add this here or as a future feature.

---------

Co-authored-by: Colum Ferry <cferry09@gmail.com>
2024-10-29 14:31:48 -04:00
Leosvel Pérez Espinosa
f357b4ed53
feat(js): update the setup-build generator to support the new ts setup (#28446)
Update the `@nx/js:setup-build` and the generators it depends on to
support the new TS setup with project references.

<!-- 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 #
2024-10-28 14:34:57 -04:00
Leosvel Pérez Espinosa
49c5a73cd0
feat(js): generate experimental simplified library with ts solution setup (#27910)
<!-- 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: Jack Hsu <jack.hsu@gmail.com>
2024-09-27 14:14:19 -04:00
Jack Hsu
ca9f3cce0b
feat(bundling): add nxCopyAssetsPlugin for Vite to use in JS libs (#27593)
This PR adds a `nxCopyAssetsPlugin` for Vite to brings it to parity with
the other compilers/bundlers (tsc, swc, esbuild, rollup, and webpack).

When generate a lib with Vite (e.g.`nx g @nx/js:lib --bundler=vite` or
`nx g @nx/react:lib --bundler=vite`), we expect it to at least copy
`README.md` as an asset.

Note: Vite has support for copying assets from `public/` but that is
less flexible and more intended for apps, not libs.

<!-- 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 #27351
2024-08-22 13:30:40 -04:00
Colum Ferry
dfd7241ed5
fix(testing): adding e2e projects should register e2e-ci targetDefaults (#27185)
<!-- 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 #
2024-08-07 12:25:32 -04:00
Colum Ferry
1dcfbeeeee
feat(testing): e2e-ci should use serve-static or vite preview for playwright and cypress (#27240)
- fix(vite): preview should dependOn build
- fix(react): playwright should use vite preview
- fix(vue): playwright should use vite preview
- fix(web): playwright should use vite preview
- chore(testing): add e2e test

<!-- 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 -->
Currently, `playwright` uses the `vite serve` command when setting up
the web server to run the e2e tests against.

The `vite preview` command/target should also depend on `vite build`.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
`playwright` should use the `vite preview` command when setting up the
web server

`vite preview` targets add a `dependsOn["build"]`

Ensure `serve-static` has a dependsOn: ['build']

Cypress should use the `ciBaseUrl` if it exists when running the
`e2e-ci` targets

Migrations for Playwright and Cypress to use serve-static and preview
correctly

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

Fixes #
2024-08-02 11:56:07 -04:00
Colum Ferry
996c97f13e
fix(vite): remove cache.dir option from test utils (#27087)
<!-- 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 -->
`cache.dir` is still generating when it shouldn't be.


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
`cache.dir` option should not be generating

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

Fixes #27039
2024-07-24 08:29:23 -04:00
Colum Ferry
8f65944405
fix(vite): remove deprecated cache.dir from vitest generation (#26756)
<!-- 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 `cache.dir` option for `vitest` is deprecated in favour of
`config.cacheDir` which we already generate.

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

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

Fixes #
2024-07-02 16:24:00 +01:00
Colum Ferry
fb0430012c
feat(vite): set watch:false in test config by default (#26267)
<!-- 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` -->

## Current Behavior
<!-- This is the behavior we have today -->
Currently, running vitest with inference will result in a process that
waits for the user to end it as vitest defaults to running in watch
mode.


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
We should set watch:false to allow users to specifically choose watch
mode by passing `--watch`

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

Fixes #
2024-05-30 12:52:01 -04:00
Colum Ferry
9451046a40
fix(vite): add prop to config to ensure output dir is emptied #23382 (#23466)
<!-- 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` -->

## Current Behavior
<!-- This is the behavior we have today -->
We do not generate `emptyOutDir` when creating vite config, which throws
a warning and does not delete the output directory when it is outside
the project root.
This is common in integrated workspaces


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
`emptyOutDir` should be added to the config

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

Fixes #23382
2024-05-17 10:05:17 -06:00
Leosvel Pérez Espinosa
5fea49a980
fix(vite): generate vitest cache dir scoped to each project root and normalize vite cache dir (#23330)
- Update Vitest `cache.dir` to be scoped to each project root to avoid
collisions (same as what's already done for Vite)
- Normalize Vite `cacheDir` to avoid trailing `/.` paths for root
projects
- Fix Remix & Storybook Vite `cacheDir` generation 

<!-- 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` -->

## 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 #21775
2024-05-13 14:14:43 -04:00
Colum Ferry
9e13c8537a
feat(vite): migrate to latest vite-plugin-dts (#22614) 2024-04-02 16:33:01 +01:00
Katerina Skroumpelou
fe17fc3287
fix(vite): project conversion generator (#21646) 2024-02-20 16:38:12 +02:00
Katerina Skroumpelou
a4aa805c15
fix(react): extensions - vite e2e test (#21530) 2024-02-02 10:16:00 -05:00
Jason Jean
1ffd6731dc
feat(core): add target defaults in configuration generators rather th… (#21105) 2024-01-17 16:02:47 -05:00
Katerina Skroumpelou
7da53c026e
fix(vite): replaceFile and fileReplacement fixes (#21077) 2024-01-10 18:53:34 +02:00
Katerina Skroumpelou
84c9533d9a
fix(vite): dist and coverage paths for root projects (#20878) 2023-12-21 14:07:17 +00:00
Katerina Skroumpelou
f04ed1f24a
fix(nuxt): correct outputs for nuxt and vite (#20627) 2023-12-07 08:45:08 -05:00
Katerina Skroumpelou
2c88282e8a
fix(vite): adjust config generation (#20367) 2023-11-29 15:58:49 +02:00
Nicholas Cunningham
04e4e25db1
fix(js): should respect vitest test environment (#19859) 2023-10-26 09:17:29 -06:00
Katerina Skroumpelou
541af1129f
fix(vite): configuration generator fixes (#19628) 2023-10-16 19:20:42 +03:00
Jack Hsu
769974b45a
feat(vue): init, app, component and lib generators (#19130)
Co-authored-by: Katerina Skroumpelou <sk.katherine@gmail.com>
2023-09-13 15:05:10 -04:00
Jason Jean
7900d56ff2
fix(testing): fix outputs for vitest generator (#18709) 2023-08-21 15:05:18 -04:00
Caleb Ukle
6529be96cf
feat(vite): add tsconfig paths resolution plugin (#17844) 2023-07-17 15:42:12 +00:00
Jack Hsu
bb88dd934a
fix(testing): set jsdom as the default vitest environment when calling the generator programmatically (#17632) 2023-06-16 10:46:13 -04:00
Jack Hsu
8d5ef222cc
feat(testing): add support for additional environment options when generating vite config (#17560) 2023-06-13 13:30:52 -04:00
Luca Becker
26e3e16cb9
chore(vite): remove typo in the comment / documentation (#17488) 2023-06-08 09:54:47 -04:00
Katerina Skroumpelou
b953565bc2
feat(vite): add type check to vite builder (#17487) 2023-06-08 15:57:51 +03:00
Emily Xiong
631a948ded
feat(react): add swc as compiler option for react vite (#17224) 2023-05-30 14:06:50 -04:00
Emily Xiong
e8c31d7ac7
fix(react): fix react windows e2e tests (#16959) 2023-05-12 11:09:46 +03:00
Jack Hsu
8de17ab1e0
feat(web): remove deprecated executors (#16416) 2023-04-20 17:50:31 -04:00
Jason Jean
5a0a4e8d26
feat(repo): replace usages of @nrwl/ with @nx/ in tooling packages (#16351) 2023-04-18 12:15:33 -04:00
Jason Jean
2d195007b0
feat(core): switch packages to use the @nx scope (#16069) 2023-04-14 19:56:37 -04:00
Katerina Skroumpelou
8e838b5aac
fix(vite): configuration docs and optional chain targets (#15655) 2023-03-14 19:56:04 +02:00
Katerina Skroumpelou
bff786962b
fix(vite): set root and path on dts plugin (#14964) 2023-02-14 12:08:46 +00:00
Dmitriy Stepanenko
0e7e76f3e1
fix(vite): expose all executors and schemas (#14763) 2023-02-07 10:15:30 +02:00
Katerina Skroumpelou
b01aa846fb
fix(vite): delete webpack config when converting (#14582) 2023-01-24 18:32:18 +02:00
Katerina Skroumpelou
fea80afd5c
fix(vite): proper path for main.tsx for standalone (#14575) 2023-01-24 10:07:45 -05:00
Katerina Skroumpelou
51b1f482a3
fix(vite): add configDir to vite config (#14559) 2023-01-23 14:05:56 -05:00
Nicholas Cunningham
351b4aabf2
fix(vite): add fix for vitest configuration (#14404) 2023-01-16 12:26:47 -07:00
Victor Berchet
c86a361e1c
Vite: preview generator (#14375) 2023-01-16 14:12:37 +02:00
Victor Berchet
8d382fb05f
fix(vite): do not include vitest types in tsconfig.json (#14200) 2023-01-09 11:14:54 -05:00
Katerina Skroumpelou
29f16483c7
fix(vite): correct worker plugin (#14147) 2023-01-04 19:46:25 +00:00
Katerina Skroumpelou
41898df3bb
fix(storybook): refactor target finding function (#14130) 2023-01-04 11:42:47 +00:00
Katerina Skroumpelou
5c962d0e3b
fix(vite): add paths plugin for worker (#14115) 2023-01-03 12:53:05 -05:00
Caleb Ukle
c82975685d
fix(testing): correctly set task status for failed coverage reports (#14008) 2023-01-03 12:09:57 +02:00
Katerina Skroumpelou
6c6fd7ce1d
fix(vite): improve vite configuration (#13978) 2022-12-22 16:56:39 +02:00
Katerina Skroumpelou
3bb773da20
fix(vite): add dts to build options (#13934) 2022-12-22 12:32:38 +02:00
Katerina Skroumpelou
7beee3c103
fix(vite): dont add server config for libs (#13931) 2022-12-20 13:12:19 -05:00
Katerina Skroumpelou
4f50b8929b
fix(vite): inform user to add build config (#13876) 2022-12-20 15:44:33 +00:00