82 Commits

Author SHA1 Message Date
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
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
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
Jack Hsu
226dfaf7a4
feat(js): carry-over known build options (main, tsConfig, etc.) when running setup-build generator (#18742) 2023-08-28 10:36:18 -04:00
Emily Xiong
9d5a3830be
feat(misc): remove dotenv from executors (#18719) 2023-08-22 20:00:37 -04:00
Remy
14fab26056
fix(esbuild): don't overwrite plugins in esbuildOptions (#18461) 2023-08-04 13:47:51 +03:00
Igor Loskutov
a5d6a293aa
fix(core): esbuild generateLockfile according to docs (#18413) 2023-08-01 16:29:38 +03:00
Leosvel Pérez Espinosa
95a2256a34
feat(misc): deprecate executor options to generate package.json for libraries (#17923) 2023-07-11 15:28:03 +00:00
Jack Hsu
24e45d494f
feat(bundling): rename esbuild-project, rollup-project, and webpack-project generators to "configuration" generators for consistency in naming (#18003) 2023-07-07 13:59:41 -04:00
Jack Hsu
ec48f61142
fix(bundling): update esbuild project generator to support standalone… (#17558) 2023-06-12 13:39:17 -04:00
Jack Hsu
edf0b1ce20
feat(js): add setup-build generator for JS packages (#17523) 2023-06-12 12:38:26 -04:00
Nicholas Cunningham
8f771e023b
fix(node): When serving using js:node executor NODE_ENV should not be undefined (#17375) 2023-06-02 13:56:40 -04:00
Nicholas Cunningham
923e6d8b42
fix(js): set node_env when building with esbuild (#17251) 2023-05-29 10:25:15 -06:00
Victor Savkin
0848031dd9 feat(core): move task hashing into daemon 2023-05-17 11:37:57 -04:00
Jason Jean
6b928bc250
feat(js): refactor usages of npmScope (#16947) 2023-05-15 16:06:24 -04:00
hi2u
55d40c0105
fix(node): build-esbuild-options.ts code-generated "exactMatch" prope… (#16655) 2023-05-12 15:16:41 +00:00
Jack Hsu
1e7aa39a9f
fix(bundling): handle projects without targets in esbuild thirdParty migration (#16712) 2023-05-03 08:35:20 -06:00
MaxKless
341c916304
feat(bundling): add esbuild migration to correctly set thirdParty option (#16640) 2023-04-28 16:48:17 +02:00
Jack Hsu
bef152d94e
feat(bundling): remove esbuild 0.16.0 support (#16435) 2023-04-20 08:14:52 -06: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
Jack Hsu
807884c91d
feat(bundling): add support for esbuild.config.js file (#16092) 2023-04-04 19:16:32 +00:00
Nicholas Cunningham
c02ec9f1f7
fix(js): remove thirdParty default so that package.json will be generated by default (#16015) 2023-04-04 10:53:22 -04:00
Schmale97
36367569f6
fix(esbuild): don't set outfile or outdir if already defined (#14636) 2023-04-04 10:43:38 -04:00
Colum Ferry
ed6524cbe5
cleanup(js): move assets to js package (#15955) 2023-04-03 10:24:14 -04:00
Leosvel Pérez Espinosa
4eb7cc7bf1
fix(misc): skip formatting files in nested generator calls (#15961) 2023-03-31 11:22:18 -04:00
Jack Hsu
47c671cc4c
fix(bundling): pass tsConfig from project when --bundle=false so the correct file is applied (#16006) 2023-03-31 11:12:38 -04:00
Juri Strumpflohner
ae69ec9dc8
fix(bundling): sourcemaps setting (#15981) 2023-03-30 11:23:46 -04:00
Jack Hsu
7ebca5107e
feat(bundling): add for esbuild to enable/disable package.json generation (#15777) 2023-03-21 08:48:16 -04:00
Jack Hsu
7d9352eb1a
fix(bundling): respect --sourcemap option for esbuild (#15778) 2023-03-20 16:46:58 -04:00
Colum Ferry
361ddb1b0f
feat(js): move buildable libs to js (#15558) 2023-03-09 16:36:50 -05:00
Binyamin Yawitz
a7738caa70
fix(node) executor bug on Windows (#15368) 2023-03-02 20:05:36 -06:00
Jack Hsu
17e6bdedc7
fix(bundling): allow transitive external packages to be specified tha… (#15289) 2023-02-27 09:52:06 -07:00
Jack Hsu
a45d52e9e6
fix(node): support custom import paths based on tsconfig when building node apps (#15154) 2023-02-21 12:49:49 -05:00
Jack Hsu
40007a1d53
feat(node): add support for workspace libs when not bundling (#15069) 2023-02-17 17:56:55 +00:00
Leosvel Pérez Espinosa
3a98c6d3ab
feat(misc): support ts 4.9 (#14899) 2023-02-17 17:23:05 +00:00