138 Commits

Author SHA1 Message Date
Jason Jean
23a217d8dd
feat(core): deprecate custom task runners (#28253)
## Current Behavior
<!-- This is the behavior we have today -->

Custom task runners are a high level abstraction to customize caching, a
relatively low level mechanism, to utilize other methods of remote
caching. The abstraction of custom task runners makes it hard for Nx to
make guarantees to make it faster.

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

Custom task runners are now deprecated. They will still work for Nx 20
but a warning will be shown when they are being used. The migration path
is to use Nx Cloud (the ideal caching solution) or a Nx Powerpack cache
(written by the Nx Core team which we can make guarantees about).

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

Fixes #
2024-10-02 20:33:10 -04:00
Jason Jean
4081901b8d
fix(core): several powerpack fixes (#28088)
<!-- 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 -->

* There is no flag in `nx.json` to enable the db cache
* Typings for powerpack are `any`
* Powerpack errors are not shown in `nx report`
* 9999 workspaces show up when user purchases unlimited license
* There is no indication from caching that license has expired.

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

* There is an `enableDbCache` flag for `nx.json`. It'll probably be
changed soon.
* Typings for powerpack come from the powerpack packages
* Powerpack errors are shown in nx report
* "an unlimited number of workspaces" shows up when user purchases
unlimited license
* There is an indication when licenses expire.

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

Fixes #
2024-09-24 18:14:17 -04:00
Paweł Twardziak
2c0a50c0d8
feat(core): expose graph json type (#27496)
Closes #3283

## Current Behavior
See #3283

## Expected Behavior
See #3283

## Related Issue(s)
#3283

Fixes #
-  expose graph json type

---------

Co-authored-by: @NgDaddy Paweł Twardziak <contact@ngdaddy.com>
Co-authored-by: FrozenPandaz <jasonjean1993@gmail.com>
2024-08-23 18:20:59 -04:00
Leosvel Pérez Espinosa
add5a675c3
feat(misc): add nx syncing mechanism and update the typescript-sync generator (#26793)
- Add the `nx sync` command to run sync generators and apply changes to
bring the workspace up to date according to their logic.
- Add the `nx sync:check` command to validate that the workspace is up
to date by running the sync generators without applying the changes. It
can be used on CI as a validation check.
- Update the task runner to run the sync generators (or obtain their
state from the daemon) and prompt the user whether to apply the changes,
if any
- This is only run if the `NX_ENABLE_SYNC_GENERATORS` environment
variable is set to `'true'`
  - Allow the user to configure a default value for the prompt
- Update the `@nx/js:typescript-sync` generator (keep tsconfig project
references in sync with the project graph) with misc fixes

<!-- 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 NXC-787 -->
<!-- Fixes NXC-788 -->
<!-- Fixes NXC-789 -->

Fixes #
2024-08-12 10:44:04 -04:00
Louie Weng
fbecedce0f
feat(nx-cloud): add nxCloudId field for auth (#27197)
<!-- 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
-->

Instead of `nxCloudAccessToken`, users can now connect to nx-cloud with
`nxCloudId`. This value will also default the runner to the cloud
runner.

Also modified the `connect-to-nx-cloud` generator such that it hits a
new API endpoint to grab a workspace's nxCloudId instead of access
token. (This feature is gated).

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

Fixes #
2024-08-06 16:29:33 -05:00
Jason Jean
2ec25640b3
fix(core): move token generation into new (#27266)
<!-- 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 Cloud token is generated after the workspace and preset have been
generated. This makes it hard to use the Nx Cloud token for generating
the workspace and preset.

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

The Nx Cloud token is generated in the workspace creation. This makes it
easier to use the Nx Cloud token during the workspace creation process.

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

Fixes #
2024-08-02 16:47:10 -04:00
Jack Hsu
45c458e677
fix(react): generate valid Vite + JSX setup for React (#27130)
The current `@nx/react:app` generator does not take the `--js` option
into account. There are two problems:

1. `index.html` includes `main.tsx` not `main.jsx`.
2. `.js` files with JSX are invalid in Vite, and must be named `.jsx`.

This PR adds a new option to the `toJS` devkit util to preserve `.jsx`
rather than renaming them to `.js`. The vast majority of non-Vite React
projects will use `.js` and not `.jsx` (e.g. Next.js, Expo, Remix, etc.)
so we just want to apply this change to Vite only for now.

In the future we could enhance React generators to support `--jsx`, for
example.

## 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 #20810
2024-07-26 08:30:16 -04:00
Emily Xiong
39e104b6c3
feat(core): add parallelism to target configuration (#26820)
<!-- 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-07-12 16:35:45 -04:00
LongYinan
981eb30a0f
feat(core): support compile to wasi target (#22870)
This pull request is trying to add wasm32-wasi target support for the
nx/native

To test the build, you can run the following commands:

- `rustup target add wasm32-wasip1-threads`
- `pnpm exec napi build --release --platform --package-json-path
packages/nx/package.json --manifest-path packages/nx/Cargo.toml --js
./native-bindings.js -o packages/nx/src/native --target
wasm32-wasip1-threads`

And the wasm file will be built at
packages/nx/src/native/nx.wasm32-wasi.wasm

Blocked by:

- Support @napi-rs/cli 3.0  Cammisuli/monodon#48
- https://github.com/napi-rs/napi-rs/issues/2009

The pseudo_terminal mod is excluded on the wasm32 targets, which is as
expected.

The watch mod is excluded because of the upstream `watchexec` deps
introduced by ignore-files don't support the wasi target at this moment
(but we can improve it).

## Related Issues
Fixes https://github.com/nrwl/nx/issues/21860
Fixes https://github.com/nrwl/nx/issues/23821

---------

Co-authored-by: FrozenPandaz <jasonjean1993@gmail.com>
2024-07-05 15:55:35 -04:00
Michal Jez
6d2e7cd2cf
feat(nx-plugin): update executor generator to have context (#16982)
Co-authored-by: Craigory Coppola <craigorycoppola@gmail.com>
2024-06-04 17:49:50 -04:00
Craigory Coppola
dd6eda84b0
feat(devkit): allow to customize overwrite mode in generateFiles (#26354)
Adds a new capability to choose how to handle already existing target
files when using a generator.

See #17925

Co-authored-by: Michael Monerau <micmo@qontrol.io>
2024-06-04 16:12:15 -04:00
Craigory Coppola
6f223005b8
fix(misc): ensure plugins are not creating workspace context while creating nodes (#26253) 2024-05-31 18:54:56 -04:00
Jason Jean
b558f56c69
feat(testing): use createNodesV2 for jest (#26292)
<!-- 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 -->

`@nx/jest/plugin` uses CreateNodesV1. Multiple Jest plugins are not able
to be run in parallel and in isolation.

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

`@nx/jest/plugin` uses CreateNodesV2. Multiple jest plugins are able to
run in parallel and in isolation.

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

Fixes #
2024-05-31 15:43:01 -04:00
Craigory Coppola
a5682d1ca5
feat(core): add create nodes v2 for batch processing config files (#26250) 2024-05-30 15:28:59 -04:00
Jordan Hall
80702b59c7
feat(core): add bun package manager (#22602)
Bun uses yarn lock for it's binary file. Running the binary will produce
the content of a yarn lock file (v1)

Other option is to use the -y command on add and install. This will
create a yarn lock file and then createLockFile can just modify the
yarn.lock file instead?

This is the PR made from #19113 and pushed due to #22402 being closed.

PS Bun feels more stable since the PR was first created!

This PR will resolve #22283 and start of #21075
2024-05-22 16:51:21 -04:00
Jason Jean
8f705e31e2
fix(misc): adjust deprecation messages to v20 (#23223)
<!-- 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` -->

## Breaking Changes:


BREAKING CHANGE: `nx print-affected` was deprecated in 16.4.0 and has
been removed.
BREAKING CHANGE: `nx affected:graph` was deprecated in 16.4.0 and has
been removed.
BREAKING CHANGE: The `criticalPath` and `affectedProjects` properties of
the JSON created by `nx graph --file graph.json` was deprecated in
16.2.0 and has been removed.

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

Some deprecation messages still reference v19.

`nx print-affected` was deprecated in 16.4.0 to be removed in Nx 19 but
was not removed.
`nx affected:graph` was deprecated in 16.4.0 to be removed in Nx 19 but
was not removed.

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

Deprecation messages reference v20 now.

`nx print-affected` is removed.
`nx affected:graph` is removed.

There are redirects to a `deprecated` page describing those commands for
Nx users using Nx <19

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

Fixes #
2024-05-08 21:54:41 -04:00
Jason Jean
a64a7e2db9
feat(core): cleanup for v19 (#22993) 2024-05-01 12:12:32 -04:00
Craigory Coppola
0fd6d23e3f
fix(core): ensure create nodes functions are properly parallelized (#23005) 2024-04-25 16:45:26 -04:00
Colum Ferry
25eeddc338
feat(testing): add playwright generator to convert from executors to plugin (#22784)
Co-authored-by: FrozenPandaz <jasonjean1993@gmail.com>
2024-04-24 09:06:23 -04:00
Craigory Coppola
7bb6e9ee14
feat(core): add API entrypoint to register metadata (#22773) 2024-04-23 17:04:51 -04:00
Leosvel Pérez Espinosa
d7f1b3db73
fix(angular): execute wrapped schematics post tasks and log messages (#22780) 2024-04-11 16:57:17 +02:00
Craigory Coppola
7a7cbeca44
feat(core): re-enable running plugins in isolation (#22527) 2024-04-09 18:36:33 -04:00
Jason Jean
21f90cae85
feat(core): add metadata to targets (#22655) 2024-04-04 23:19:10 -04:00
Jason Jean
777fbd1673
feat(core): add ability to scope plugins (#22379) 2024-03-22 18:33:16 -04:00
Jason Jean
5a9671b3fa
feat(core): add ability to add metadata to projects (#22299) 2024-03-19 13:33:25 -04:00
James Henry
1fe5b98f45
fix(linter): refactor pcv3 plugin, expose configFiles on context (#21677) 2024-03-15 16:29:13 -04:00
Leosvel Pérez Espinosa
5978e30d20
docs(misc): update typedoc (#22264) 2024-03-12 09:33:44 +01:00
Jason Jean
c01b566728
feat(core): revert running plugins in isolation (#22246) 2024-03-09 11:30:10 -05:00
Bacary Bruno Bodian
3b2e5a82f7
chore(nx): pass generic to CreateNodes (#22157) 2024-03-05 18:02:46 -05:00
Austin Fahsl
8bde48fc7a
fix(release): skip lock file update if workspaces are not enabled (#22055) 2024-03-01 10:15:55 -07:00
Craigory Coppola
a89c73483e
feat(core): use flag in nx.json for toggling crystal (#21980) 2024-02-29 15:18:46 -05:00
Craigory Coppola
c2581dcf0b
feat(core): execute plugins in isolated processes (#21760) 2024-02-23 13:20:44 -05:00
Craigory Coppola
95b77f8fb0
feat(core): flatten default base config to base (#19964) 2024-02-22 16:50:25 -05:00
Austin Fahsl
b625a79cca
fix(release): move github release creation to git tasks (#21510) 2024-02-13 17:32:35 -07:00
Isaac Mann
7d2cb37784
docs(core): release is no longer alpha (#21780) 2024-02-12 17:29:25 -05:00
Craigory Coppola
deb0f1a492
chore(repo): bump deprecation messages to v19 (#21430) 2024-01-30 16:29:05 -05:00
Kaden Wilkinson
8274f3419d
fix(devkit): fix extractLayoutDirectory typescript types to better reflect allowed params and return value (#15339) 2024-01-29 13:01:14 -05:00
James Henry
bba9600d6e
feat(release): allow overriding generator and generatorOptions per project (#21298) 2024-01-24 10:17:12 -05:00
Jack Hsu
253c0ff2ab
feat(devkit): add a flag to keep existing versions when calling addDependenciesToPackageJson (#21123) 2024-01-16 14:24:14 -05:00
Craigory Coppola
2374d8eaba
feat(testing): add create-nodes plugin for playwright e2e targets (#20099) 2023-12-20 16:34:32 -05:00
Leosvel Pérez Espinosa
5befe533fc
docs(misc): update typedoc (#20603) 2023-12-13 16:49:46 +01:00
Craigory Coppola
30d94f76ee
cleanup(core): remove async flag from signature of buildProjectsConfigurationsFromProjectPathsAndPlugins (#20228) 2023-11-17 15:31:03 -05:00
Craigory Coppola
206247f9ad
feat(core): make createNodes async (#20195)
Co-authored-by: Jonathan Cammisuli <jon@cammisuli.ca>
2023-11-13 16:57:20 -05:00
Craigory Coppola
08a4891494
feat(core): change the signature of createNodes to return a project root map instead of project name map (#20102) 2023-11-08 13:20:53 -05:00
James Henry
39423322c1
feat(core): support changelog customizations and project changelogs (#19704) 2023-10-20 16:27:03 -04:00
Craigory Coppola
024abd2cdb
fix(core): only show cloud messaging when migrating if not using cloud (#19709) 2023-10-18 19:20:47 -04:00
Jason Jean
d0005c954f
feat(core): remove deprecated defaultCollection and npmScope nx.json … (#19708) 2023-10-18 18:03:57 -04:00
Craigory Coppola
c56b5a3c77
fix(devkit): correct nx-json typing after plugin tweaks (#19706) 2023-10-18 15:15:00 -04:00
Craigory Coppola
2a18fd1f3f
feat(core): allow specifying cacheability per target (#19672) 2023-10-17 20:14:39 -04:00
Craigory Coppola
882dd08a6a
chore(core): tweak nx-plugin-v2 options typing (#19673) 2023-10-17 19:16:23 -04:00