268 Commits

Author SHA1 Message Date
Jason Jean
cfadd7d8cf
Revert "fix(core): addPlugin should not conflict on project.json targ… (#23391)
…ets (#23264)"

This reverts commit 85c89160

<!-- 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 #
2024-05-14 18:01:30 -04:00
Colum Ferry
88297dd727
fix(vite): migration should handle config object correctly #20921 (#23364)
<!-- 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 -->
The migration to update vite config is incorrectly matching other object
literal and arrow functions


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Ensure more accurate updating of vite config file

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

Fixes #20921
2024-05-14 14:21:22 +01: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
85c8916087
fix(core): addPlugin should not conflict on project.json targets (#23264)
<!-- 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 -->
Calculating conflicts in target names does not consider if the
project.json defined targets will actually be impacted by the plugin
that wants to be added creating false negatives

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Calculating conflicts should be more accurate

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

Fixes #22476
2024-05-13 10:53:09 -04:00
Colum Ferry
7cf09a677f
fix(vite): support passing --watch to inferred vitest commands (#23298)
<!-- 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 currently do not handle passing `--watch` when running inferred
`vitest` commands

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
We should support handling `--watch`

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

Fixes #23185
2024-05-10 15:31:59 +03:00
Matthias Stemmler
b4f6e425c4
fix(vite): get tsconfig from new path including target (#22775)
## Current Behavior
Since v18.2.3 (e4c4697f69cf29c50aced1997715a7da5f680e23) the
`tsconfig.generated.json` file generated if `"buildLibsFromSource":
false` is placed under a path containing the current build target. The
`nx-tsconfig-paths` plugin of `@nx/vite` was not updated accordingly, so
now it doesn't find `tsconfig.generated.json`, effectively causing
`@nx/vite` to ignore the `"buildLibsFromSource": false` setting.

## Expected Behavior
With this PR, `nx-tsconfig-paths` finds `tsconfig.generated.json` at the
correct path, so `"buildLibsFromSource": false` works as it did before
v18.2.3.
2024-05-08 12:30:07 +01:00
Sean Sanker
1502433673
fix(vite): don't generate tasks for remix projects (#22551)
<!-- 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 -->
Attempting to use Remix + Vite results in a few errors. I assume this is
due to the vite and remix plugins conflicting with each other.

One of which being:
```
Failed to process project graph.
  The "@nx/vite/plugin" plugin threw an error while creating nodes from myremixapp/vite.config.ts:
    Error: Missing "root" route file in /Users/username/work/remix-demo/app
        at Object.resolveConfig (/Users/username/work/remix-demo/node_modules/@remix-run/dev/dist/config.js:154:11)
        at updateRemixPluginContext (/Users/username/work/remix-demo/node_modules/@remix-run/dev/dist/vite/plugin.js:367:9)
        at config (/Users/username/work/remix-demo/node_modules/@remix-run/dev/dist/vite/plugin.js:598:7)
```

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
It should work just like it currently does for Remix Classic.

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

## PR Status
This is a very early draft. I don't think this is a good approach but it
does work for me at the moment. I'm not sure exactly how we can discern
a remix project from a vanilla vite project (that you can use standard
tooling for) without parsing the `package.json` or `vite.config.ts` and
searching for remix-specific content.

## Steps to reproduce my current state
Set up a standard @nx/remix project as shown
[here](https://nx.dev/recipes/react/remix).
Follow the instructions
[here](https://remix.run/docs/en/main/future/vite#migrating) from
`Migrating` down to but NOT including `Migrating a custom server`.

Once I use the modified @nx/vite code provided in this PR, I'm able to
run `npx nx dev [app-name]` successfully.

## A Personal Note
I'd love to contribute more to nrwl/nx.
I'm quite a fan of Nx and use it in a few separate projects. 
That being said, I don't currently have a comprehensive knowledge of its
internals.
If anyone wants to give me some guidance (text-based or we can hop on a
call), I'd be more than happy to contribute the rest of this myself (and
other fixes).

---------

Co-authored-by: Colum Ferry <cferry09@gmail.com>
2024-05-08 11:45:46 +01:00
Jason Jean
a64a7e2db9
feat(core): cleanup for v19 (#22993) 2024-05-01 12:12:32 -04:00
Jack Hsu
bc43243498
chore(repo): add eslint and jest plugins to use inferred targets (#22946) 2024-04-23 21:52:13 -04:00
Jason Jean
bf206e578e
feat(misc): non conflicting init/add flow (#22791) 2024-04-15 16:45:08 -04:00
Thomas Dekiere
637a00469e
fix(vite): pass cli arguments as options to vitest (#22355) 2024-04-12 10:28:08 +01:00
Colum Ferry
2149fa292d
fix(vite): ensure cache is created correctly for separate vite and vitest config files #22244 (#22618) 2024-04-03 07:57:51 -07:00
Colum Ferry
9e13c8537a
feat(vite): migrate to latest vite-plugin-dts (#22614) 2024-04-02 16:33:01 +01:00
Colum Ferry
29c80a33de
fix(web): spa flag should correctly define redirect (#22487) 2024-03-26 16:51:03 +00:00
Noriyuki Shinpuku
54d47805de
chore(vite): revert comment about closeAllConnections (#21634) 2024-03-22 18:40:08 -04:00
Nicholas Cunningham
b6cd1962c8
fix(vite): Storing nxjson details too early (#22285) 2024-03-12 23:22:50 +04:00
Craigory Coppola
a89c73483e
feat(core): use flag in nx.json for toggling crystal (#21980) 2024-02-29 15:18:46 -05:00
Katerina Skroumpelou
00dae6a811
fix(vite): update vitest and use parseCLI (#21890) 2024-02-22 11:03:08 -05:00
Katerina Skroumpelou
f061f57836
feat(vite): add vitest.workspace.ts at root (#21915) 2024-02-22 16:43:06 +02:00
Katerina Skroumpelou
fe17fc3287
fix(vite): project conversion generator (#21646) 2024-02-20 16:38:12 +02:00
Leosvel Pérez Espinosa
077debe2b2
fix(vite): normalize vitest cli args in executor (#21870) 2024-02-19 17:28:05 +01:00
Leosvel Pérez Espinosa
d2272fdebd
fix(misc): pin generated vite version to ~5.0.0 to avoid issues with storybook (#21740) 2024-02-09 08:13:17 -05:00
Jack Hsu
db8b37f809
fix(vite): import esbuild before loading config to keep it in cache (#21685) 2024-02-07 17:18:27 -05:00
Ian Chadwick
9a9bd2abd3
fix(vite): deep file resolution in nx-tsconfig-paths.plugin.ts (#21513) 2024-02-02 18:33:50 +02:00
Katerina Skroumpelou
a4aa805c15
fix(react): extensions - vite e2e test (#21530) 2024-02-02 10:16:00 -05:00
Jason Jean
396ffc4636
feat(core): enable project crystal by default (#21403)
Co-authored-by: Katerina Skroumpelou <sk.katherine@gmail.com>
Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
Co-authored-by: Colum Ferry <cferry09@gmail.com>
Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
Co-authored-by: Emily Xiong <xiongemi@gmail.com>
Co-authored-by: Nicholas Cunningham <ndcunningham@gmail.com>
2024-02-02 03:40:59 -05:00
Craigory Coppola
deb0f1a492
chore(repo): bump deprecation messages to v19 (#21430) 2024-01-30 16:29:05 -05:00
Jan Pretzel
82a0d613d2
fix(bundling): consider index/folder imports in manual file resolution (#19030) 2024-01-30 19:24:51 +02:00
beeman
a9974d3f25
docs(misc): change http:// to https:// (#19534) 2024-01-30 11:33:13 -05:00
Vinit Neogi
d147604c7f
feat(vite): allow passing path to custom tsconfig file when skipTypeCheck is false (#19784) 2024-01-30 16:14:53 +02:00
Vinit Neogi
85b3a5f3b9
fix(vite): prevent vite:build copying package.json when generatePackageJson false (#19780) 2024-01-30 16:13:33 +02:00
Nicholas Cunningham
79a7e79eb2
fix(vite): PCV3 multiple targets (#21366) 2024-01-26 19:15:20 -07:00
Nicholas Cunningham
bf6f78f792
fix(vite): PCV3 Plugin update to use resolveConfig (#21287) 2024-01-26 12:06:45 -05:00
Leosvel Pérez Espinosa
e4758358b0
feat(misc): optionally update package.json scripts in init generators (#21204) 2024-01-22 13:51:41 -05:00
Jason Jean
1ffd6731dc
feat(core): add target defaults in configuration generators rather th… (#21105) 2024-01-17 16:02:47 -05:00
Emily Xiong
6141f44203
feat(core): add keepExistingVersions to all packages (#21169) 2024-01-17 14:22:58 -05:00
Julien Simonet
ea3c2426d3
fix(js): ensure result is valid before attempting to close it during rollup watch 2024-01-17 12:35:21 -05:00
Leosvel Pérez Espinosa
047dc22aed
cleanup(misc): clean up init generators (#21088) 2024-01-16 15:29:44 +01:00
Katerina Skroumpelou
e5a22a94c6
fix(vite): do not add test target if test is not defined (#21076) 2024-01-11 12:20:08 +02:00
Katerina Skroumpelou
7da53c026e
fix(vite): replaceFile and fileReplacement fixes (#21077) 2024-01-10 18:53:34 +02:00
Katerina Skroumpelou
c79377e735
fix(vite): only import vite dynamically (#21050) 2024-01-09 15:48:32 +01:00
Katerina Skroumpelou
ce81133162
fix(vite): build executor watch (#21042) 2024-01-08 20:46:02 +02:00
Katerina Skroumpelou
688b83f66a
feat(vite): recognize all vite.config file extensions (#20971) 2024-01-03 08:06:13 -07:00
Katerina Skroumpelou
f7d179522f
fix(vite): include vitest config in nodes plugin (#20887) 2024-01-02 16:17:58 +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
dd44ad9778
fix(vite): more properly resolve arguments from configurations (#20825) 2023-12-19 17:36:16 +02:00
Katerina Skroumpelou
de0d238e13
fix(vite): vitest migration add reporters (#20823) 2023-12-18 17:54:58 +02:00
Katerina Skroumpelou
7641f73278
fix(vite): only dynamically import vite (#20774) 2023-12-15 15:24:05 +02:00
Katerina Skroumpelou
cac2c173c5
feat(vite): update to vitest v1 (#20747) 2023-12-14 19:55:08 +04:00
Katerina Skroumpelou
c9832f4750
fix(vite): allow vitest to be v1 (#20760) 2023-12-14 14:32:28 +02:00