134 Commits

Author SHA1 Message Date
Benjamin Cabanes
1e30f3d148
chore(nx-dev): update tagline across projects (#31318)
Aligned all instances of the tagline. Changes include documentation, metadata, UI content, test assertions, and other project assets.
2025-05-23 16:20:35 -04:00
Tyler Hendrickson
21bdb35a07
fix(esbuild): update peerDep range (#30402)
## Current Behavior
`esbuild` has a [security
advisory](https://github.com/advisories/GHSA-67mh-4wv8-2f99) for
versions older than 0.25.0. `@nx/esbuild` does not allow versions
greater than 0.19.2 due to the range specified in peer dependencies.

A fix for this was attempted in #30167, but it still does not allow any
versions greater than 0.19.x due to the way [0.x.x releases are
handled](https://github.com/npm/node-semver#caret-ranges-123-025-004).

## Expected Behavior
`@nx/esbuild` allows any version from the current 0.19.2 onwards, not
including a future 1.x.x version. This will allow non-vulnerable
versions of `esbuild` to be used.

## Related Issue(s)
Fixes #30009 
Fixes #30370
2025-05-14 16:00:34 +00:00
Jason Jean
8214ab49f2
chore(repo): assign proper outputs to build targets (#30865)
<!-- 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 -->

`nx:build` cannot be run in parallel with any other tasks. It was an
improper fix for an issue we were facing in our task graph. This is also
not workable if any continuous tasks are running.. which I want
`local-registry` to be running while things are built.

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

The proper outputs are set on `build` targets. Most of them only need
`README.md` as the output. `nx`, `create-nx-workspace`, and
`create-nx-plugin` are different and need a few more files.

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

Fixes #
2025-04-25 13:23:44 -04:00
Leosvel Pérez Espinosa
176c792e34
feat(misc): set a development conditional export for buildable libraries when using the ts solution setup (#30451)
Update library generators to set a `development` conditional export for
buildable libraries' `package.json` files and set the
`customConditions` compiler options in `tsconfig.base.json`. This will
only be done for workspaces using the TS solution setup.

## Current Behavior

## Expected Behavior

## Related Issue(s)

Fixes #
2025-03-21 17:00:25 -04:00
Jack Hsu
e0cae539d6
fix(js): update tinyglobby to speed up shallow file matching (#30415)
`tinyglobby` at `0.2.10` (what we use now) is slow on shallow files, but
the latest version `0.2.12` is fast due to this PR
https://github.com/SuperchupuDev/tinyglobby/pull/69/files.

This PR updates both the js and esbuild plugins to use the newest
versions, but also adds `tinyglobby@^0.2.12` to our root `package.json`
so we get the speed increase right away. I removed `fast-glob` in our
repo scripts and replaced it with `tinyglobby`.

## Current Behavior
Asset handling is slow for shallow files like `LICENSE` but is fine for
scoped patterns like `src/**/*.ts`.

## Expected Behavior
Asset handling should be fast for shallow files.

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

Fixes #
2025-03-19 09:20:18 -04:00
Leosvel Pérez Espinosa
ada8be473d
fix(misc): fix misc issues in project generators for the ts solution setup (#30111)
The following are the main changes in the context of the TS solution
setup:

- Ensure `name` in `package.json` files is set to the import path for
all projects
- Set `nx.name` in `package.json` files when the user provides a name
different than the package name (import path)
- Clean up project generators so they don't set the `nx` property in
`package.json` files unless strictly needed
- Fix `@nx/vue:application` generator so it creates the Nx config in a
`package.json` file for e2e projects
- Ensure `@types/node` is installed in `vitest` generator
- Fix generated Vite config typing error (surfaced with Vite 6)
- Ensure `jsonc-eslint-parser` is installed when the
`@nx/dependency-checks` rule is added to the ESLint config
- Misc minor alignment changes

## Current Behavior

## Expected Behavior

## Related Issue(s)

Fixes #
2025-03-05 20:08:10 -05:00
Nicholas Cunningham
7da48d6471
fix(bundling): fix esbuild to work with ts project references (#30230)
<!-- 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 -->
If we are using `esbuild` as our bundler and ts project references
(`--workspaces`) local libraries are not building are not resolved in
the build artifacts.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
When using ts project references with esbuild all types libraries
(buildable / non-buildable) should work out of the box.

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

Fixes #
2025-03-05 13:49:00 -07:00
Colum Ferry
9cbd476193
fix(esbuild): update peerDep range (#30167)
## Current Behavior
`esbuild` has a security advisory for versions up to 0.24. 
If users attempted to install a version greater than 0.19, they would
face peer dep issues with the `@nx/esbuild` package.


## Expected Behavior
Expand the peerDep range for `esbuild` on the `@nx/esbuild` package to
allow users to upgrade.
Keep the base version at a lower version to support older OS and VMs
which are unsupported by newer versions of `esbuild`.

Closes #30009
2025-02-25 13:54:36 +00:00
James Garbutt
c6e9565973
cleanup(core): move esbuild to use tinyglobby (#29453) 2025-01-14 19:06:11 +04:00
Leosvel Pérez Espinosa
0334dad23f
fix(js): ensure js libraries' build produce esm output in ts solution setup (#29546)
- Update js libraries for bundlers `esbuild`, `swc`, and `tsc` to
produce ESM output when using the TS solution setup.
- Fix `esbuild` and `swc` executors so they generate declaration files
even when skipping type-checking.
- Add `cjs` and `cts` to the `ignoredFiles` pattern for the rollup
config file in the eslint config.
- Ensure running an install after a js library is generated when using
the TS solution setup.

<!-- 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 #
2025-01-08 18:21:39 +01:00
Vojtech Mašek
22cec78331
docs(bundling): correct esbuild options nesting (#28748)
Fixes:

- [x] correct nesting of options in ESBuild docs

---------

Co-authored-by: Colum Ferry <cferry09@gmail.com>
2024-12-12 17:01:43 +00:00
Nicholas Cunningham
89ab8874b0
fix(core): Update bundlers to not typecheck if using new TS solution setup (#29227)
If we are using the new TS setup we should opt out of doing type
checking during build since we already have a typecheck target and it
may lead to doing type checking twice.
2024-12-09 10:40:43 -07: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
db47dc30a5
feat(js): support esbuild and swc bundlers with the new ts solution config setup (#28409)
<!-- 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-10-14 09:30:43 +02:00
Jason Jean
23bebd91e7
feat(devkit): bump compatibility to Nx 19 - 21.x (#28243)
BREAKING CHANGE

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

* `@nx/devkit` supports Nx 17 - 20.
* Node 18 - 22 is supported 
* `ExecutorContext.projectGraph`, `ExecutorContext.nxJsonConfiguration`,
and `ExecutorContext.projectsConfigurations` is marked as optional
because `ExecutorContext` in some versions of Nx did not have them.
* `ExecutorContext.workspace` is marked as optional because
`ExecutorContext` in some versions of Nx did not have the above
properties which contain the same information.
* `ProjectGraphNode` is deprecated.
* `NxPluginV1.processProjectGraph` was deprecated long ago and there has
been a warning since.
* `appRootPath` has been deprecated for a long time.
* `parseTargetString` had a variant that did not take either the project
graph or the executor context.
* `readNxJson` has a variant which does not take a tree. This was not
clearly deprecated.
* There are handlers to require from `@nx/` instead of `@nrwl`
* Nx tries to get a root install from `@nrwl/cli`


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

* `@nx/devkit` supports Nx 19 - 21.
* Node 20 - 22 is supported 
* `ExecutorContext.projectGraph`, `ExecutorContext.nxJsonConfiguration`,
and `ExecutorContext.projectsConfigurations` is marked as required
because `ExecutorContext` in Nx 19+ is guaranteed to have them.
* `ExecutorContext.workspace` is removed because the same information is
available in the above properties
* `ProjectGraphNode` is removed.
* `NxPluginV1` is no more. All plugins should be `NxPluginV2`.
* `workspaceRoot` is the replacement for `appRootPath`. `appRootPath` is
removed.
* `parseTargetString` no longer has a variant that did not take either
the project graph or the executor context.
* `readNxJson` still has a variant which does not take a tree but it's
clearly deprecated to be removed in Nx 21.
* `@nrwl` packages are no more so we don't have to redirect requires
anymore.
* `@nrwl/cli` is no more so Nx shouldn't try to get a root install there
* 

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

Fixes #
2024-10-03 17:35:47 -04:00
Jack Hsu
a637f9eef9
chore(repo): remove v16 migrations (#28220)
<!-- 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-02 10:18:41 -04:00
Leosvel Pérez Espinosa
ec801b4c16
feat(misc): enable new ts minimal setup by default and guard execution of generators with no support for it (#28199)
- Enable generating the new & minimal TS setup by default when
generating the `ts` preset with CNW.
The existing `NX_ADD_TS_PLUGIN` environment variable is kept with its
default value inverted and set to `true`. It can be used to opt out of
the new TS setup by running CNW with `NX_ADD_TS_PLUGIN=false`.
- Throw an error when running generators that don't yet support the new
TS setup.
- We'll add support for those generators incrementally in follow-up PRs.

<!-- 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
-->
<!-- Fixes NXC-1066 -->
<!-- Fixes NXC-1068 -->

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

Fixes #
2024-10-02 08:29:06 -04:00
Alonmizra
e802d2c872
cleanup(misc): remove redundant return in esbuild.impl.ts (#27632) 2024-10-01 16:04:43 +04:00
Jack Hsu
f221a41dbd
feat(misc): remove @nrwl/ scoped packages (#27858)
This PR removes the `@nrwl/*` packages. Also cleans up references to the
legacy packages.

NOTE: The rescope page is now under `/deprecated/rescope`. There is
still >1000K monthly traffic to it, which might be due to older Nx
users.

<!-- 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-09-27 17:19:01 -04:00
pralkarz
28c12b50bd
cleanup(bundling): replace fs-extra with node:fs (#28113) 2024-09-27 06:30:17 +04:00
James Garbutt
951baee460
cleanup(core): migrate esbuild to use picocolors (#28033) 2024-09-23 14:50:14 +04:00
Colum Ferry
c427717fc1
fix(esbuild): declaration:true should find the correct package root regardless of cwd #26261 (#27560)
<!-- 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 types that are generated for esbuild packages are not placed into
the correct folder structure in the built package and is very dependent
of the CWD.


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
The declaration files should be generated correctly to match the package
and not dependent on CWD

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

Fixes #26261 #26376
2024-08-21 17:08:13 +01:00
Isaac Mann
08536905a2
docs(core): update Nx tag line (#27481)
Update tag line everywhere
2024-08-19 21:14:34 -04:00
Kamenskih Dmitriy
4941be6197
fix(node): build-esbuild-options.ts browser user define envs by config (#27480)
## Current Behavior
When you use esbuild in 'browser' mode you have to provide all 'define'
attributes as environment variables and only with "NX_PUBLIC_" prefix

## Expected Behavior
Esbuild configuration has to work as it is described in docs. And prefix
feature has to work as an additional functionality

## Related Issue(s)
This issue will be fixed: https://github.com/nrwl/nx/issues/19106

Co-authored-by: Dmitrii Kamenskikh <dkamenskikh@devexperts.com>
2024-08-16 15:05:30 -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
a8dc251cce
fix(bundling): get workspace package prefix length correctly #20817 (#27092)
<!-- 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 -->
When there are workspace libraries with the following import paths:

```
@org/core
@org/core/db
@org/core/acme
```

They need to be sorted for the manifest such that matching finds the
most specific first.
The logic for this is currently based off whether an `*` exists, which
doesn't work when the paths are specific.


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Try to use `*` first and fallback to `/` to determine package prefix
length.


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

Fixes #20817
2024-07-24 10:26:39 -04:00
Colum Ferry
339d673b2b
fix(bundling): prevent exports overwrite with esbuild (#27047)
Co-authored-by: Colum Ferry <cferry09@gmail.com>
Co-authored-by: katsanva <1161259+katsanva@users.noreply.github.com>

<!-- 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 #20324 #20325

Co-authored-by: katsanva <1161259+katsanva@users.noreply.github.com>
2024-07-24 08:30:24 -04:00
Jack Hsu
86954ae96b
fix(misc): rename @nrwl/* to @nx/* in init generator descriptions (#26610)
We forgot to rename these in the init generator descriptions. This
affects tutorials since we've been including the terminal output with
the wrong scope.


## 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-06-20 13:08:39 -04:00
Leosvel Pérez Espinosa
2b820a274e
docs(misc): update /packages/ links to /nx-api/ (#26128)
- Update `/packages/` links to `/nx-api/`
- Convert some unneeded absolute links to relative
- Remove leftover examples doc for the already removed `cypress-project`
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` -->

## 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 #26126
2024-05-28 09:44:48 -04:00
Jason Jean
7705757c62
fix(misc): adjust npm keywords (#24743)
<!-- 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 -->

NPM Keywords do not include those which are shown under the categories
under the `Discover packages` section. https://www.npmjs.com/

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

NPM Keywords include those which are shown under the categories under
the `Discover packages` section when applicable. https://www.npmjs.com/


![image](https://github.com/nrwl/nx/assets/8104246/ebbd4317-0336-4834-b4eb-0c673a358601)


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

Fixes #
2024-05-22 22:30:10 -04:00
castleadmin
7f32d8643d
feat(bundling): added support for declarations (*.d.ts) (#21084)
<!-- 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
esbuild doesn't support the creation of declaration files (*.d.ts) and
probably never will (see https://github.com/evanw/esbuild/issues/95).
Since declaration files are essential for published libraries,
it would be great if @nx/esbuild:esbuild would provide an option to
output them.

## Expected Behavior

- Introduced a new boolean valued `declaration` option for the `esbuild`
executor
- If `declaration` or the tsconfig option
[declaration](https://www.typescriptlang.org/tsconfig#declaration) is
true,
then the TypeScript compiler is used before esbuild to generate the
declarations
- The output directory structure of the declarations can be influenced
by setting the TypeScript rootDir via the `declarationRootDir` option

## Related Issue(s)
https://github.com/nrwl/nx/issues/20688

### Additional Comment
Please note that the generated declaration files directory structure is
affected by the tsconfig `rootDir` property.

For a library that doesn't reference other libraries inside the
monorepo, the `rootDir` property can be changed freely.
If a library inside the monorepo is referenced the `rootDir` property
must be set to the workspace root.

The `tsc` executor has a sophisticated check that automatically sets the
`rootDir` to the workspace root if a library is referenced.

https://github.com/nrwl/nx/blob/master/packages/js/src/executors/tsc/tsc.impl.ts#L104

This check is quite complex and specific to the `tsc` executor options.
Therefore, it hasn't been included inside the esbuild implementation.

The current implementation leaves it to the user to solve the edge case
by removing the `declarationRootDir` option or by setting the
`declarationRootDir` to `.`.

In the future, it might make sense to generalize and use the `tsc`
executor check.
2024-05-16 17:16:43 +03:00
andriizavoiko
46336df3a4
fix(bundling): resolve index files from ts paths when running esbuild without bundling (#23098)
## Current Behavior
During build process a file `tmp/<path>/main-with-require-overrides.js`
is generated to handle `paths` resolutions from `tsconfig` when
`esbuild` is not running in `bundle` mode.

Having following `tsconfig.json` as example
```json
{
  ...
  "compilerOptions": {
    ...
    "paths": {
      "@lib/lib1": ["libs/lib1/src/index.ts"],
      "@app1/*": ["apps/app1/src/*"],
    }
  }
}
```

We can use `lib1` in code as follows and during runtime it will
automatically be resolved to `dist/apps/app1/libs/lib1/src/index.js`:
```js
// apps/app1/src/main.ts
import lib1 from '@lib/lib1';
```

Hovewer, when trying to use paths with wildcards, e.g.:
```js
// apps/app1/src/config/index.ts
const config = {};
export default config;

// apps/app1/src/main.ts
import config from '@app1/config';
```

It gets resolved to `dist/apps/app1/apps/app1/src/config.js` and
`isFile` condition fails as such module doesn't exist, thus path is not
replaced and runtime error is produced.

## Expected Behavior
During resolution of following code:
```js
import config from '@app1/config';
```

`_resolveFilename` should consider all possible combinations of module
path - `dist/apps/app1/apps/app1/src/config.js` and
`dist/apps/app1/apps/app1/src/config/index.js`
2024-05-08 13:17:10 +01:00
Jack Hsu
2e621f324c
feat(misc): v19 cleanup for Nx plugins (#23104)
This PR removes deprecated code that's been slated for removal in Nx 19
- mentioned as `TODO(v19)` comments.

## Breaking Changes

- **CNW:** `create-nx-workspace` no longer support `--preset=empty` and
`--preset=core`, use `--preset=apps` and `--preset=npm` respectively.
Deprecated in Nx 15.9.
- **Next.js:** `NX_` environment variables are no longer bundled into
Next.js apps, use `NEXT_PUBLIC` instead. Deprecated in Nx 16.8.
- **Webpack, Storybook, Esbuild:** `NX_` environment variables are no
longer bundled into browser bundles, use `NX_PUBLIC` instead. This
removes the possibility of intentional bundling of `NX_` variables.
Deprecated in Nx 18.
- **Cypress:** `cypressComponentConfiguration` generator removed from
`@nx/cypress`, use `configurationGenerator`instead. Deprecated in Nx
16.8.
- **Cypress:** `cypressProjectGenerator` generator removed from
`@nx/cypress`, use `configurationGenerator` instead. Deprecated in Nx
15.9.
- **Expo:** `withNxWebpack` removed from `@nx/expo`, use [metro
bundler](https://docs.expo.dev/guides/customizing-metro/)
(https://docs.expo.dev/guides/customizing-metro/) in app.json instead.
There is a migration to handle this in Nx 19. Deprecated in Nx 15.8.

## Deferred to v20

- **JS:** `classProperties.loose` option removed from `@nx/js/babel`
preset, use `loose` instead. Deprecated in Nx 17.0.
- **ESLint:** Low priority task to "deviations from
@typescript-eslint/recommended" for our lint rules. @JamesHenry will
look at this later before Nx 20, but it is unimportant.
- **React:** component testing does not work with Project Crystal, and
we need the executor + built-in webpack configs to run CT. Will do a
follow-up on this after Nx 19 release. Related issue:
https://github.com/nrwl/nx/issues/21546
- **Next.js:** `withStylus` removal from `@nx/next`, use SASS instead.
It hasn't worked, but we kept the file to throw an error when used.
Deprecated in Nx 17.0.
- **Next.js**: `@nx/next:component` and `@nx/next:page` generators to
not derive the `components` and `app`/`pages` directory. Use `nx g
@nx/next:component apps/myapp/components/button` instead. Deprecated in
Nx 17.0.
- **Webpack:** `isolatedConfig` option removal from
`@nx/webpack:webpack` executor. There is a migration to handle this in
Nx 19. Deprecated in in Nx 17.2.
- **Angular:** `executeWebpackDevServerBuilder` removal from
`@nx/angular/executors`, use `executeDevServerBuilder` instead.
Deprecated in Nx 17.0.
2024-05-02 13:37:12 -04:00
Jason Jean
a64a7e2db9
feat(core): cleanup for v19 (#22993) 2024-05-01 12:12:32 -04:00
Jack Hsu
f3a20bb6d3
chore(repo): remove unnecessary .eslintignore files and use ignorePatterns instead (#22976) 2024-04-24 12:02:44 -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
Kyle Cannon
e549ea2b58
fix(bundling): handle circular dependencies in @nx/esbuild getExtraDependencies (#22644) 2024-04-17 21:39:59 -04:00
Jack Hsu
b7ffb257a2
fix(bundling): prevent sensitive keys from being bundled (#22413) 2024-03-20 13:01:43 -04:00
beeman
a9974d3f25
docs(misc): change http:// to https:// (#19534) 2024-01-30 11:33:13 -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
Leosvel Pérez Espinosa
047dc22aed
cleanup(misc): clean up init generators (#21088) 2024-01-16 15:29:44 +01:00
Benjamin Cabanes
db77ddef8a
chore(repo): update packages readme banner (#20695) 2023-12-11 11:32:42 -05:00
Benjamin Cabanes
5a305d41de
feat(nx-dev): add homepage updates (#20592)
Co-authored-by: Juri <juri.strumpflohner@gmail.com>
2023-12-08 14:40:42 -05:00
Craigory Coppola
30d94f76ee
cleanup(core): remove async flag from signature of buildProjectsConfigurationsFromProjectPathsAndPlugins (#20228) 2023-11-17 15:31:03 -05:00
Emily Xiong
e4d1ef3cf3
chore(misc): remove dependenciesFieldType from esbuild (#19883) 2023-10-27 11:56:48 -04:00
Jack Hsu
75062ef4e8
fix(bundling): fix regression with --thirdParty option for esbuild (#19835) 2023-10-25 08:18:30 -04:00
Colum Ferry
80fde79374
feat(misc): remove deprecated Angular CLI usage of schematics and builders (#19557) 2023-10-13 17:14:16 +01:00
Jack Hsu
76a7506074
feat(js): remove options to update package.json dependencies and peerDependencies (#19543) 2023-10-12 12:06:45 -04:00
Jason Jean
5cc87bfdc2
fix(misc): properly add extra dependencies to packages (#19334) 2023-09-26 00:09:29 -04:00