Skip to content

Commit

Permalink
Merge branch 'master' into esbuild-fdir
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHenry authored Oct 1, 2024
2 parents 20a560a + e802d2c commit 0354179
Show file tree
Hide file tree
Showing 174 changed files with 689 additions and 516 deletions.
3 changes: 1 addition & 2 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#!/bin/sh
changedFiles="$(git diff-tree -r --name-only --no-commit-id $1 $2)"
node ./scripts/notify-lockfile-changes.js $changedFiles
node ./scripts/notify-lockfile-changes.js $changedFiles
3 changes: 1 addition & 2 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#!/bin/sh
changedFiles="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
node ./scripts/notify-lockfile-changes.js $changedFiles
node ./scripts/notify-lockfile-changes.js $changedFiles
8 changes: 3 additions & 5 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env sh

pnpm check-lock-files &&
pnpm check-commit &&
pnpm documentation &&
pnpm check-lock-files
pnpm check-commit
pnpm documentation
pnpm pretty-quick --check
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ Including the issue number that the PR relates to also helps with tracking.
```plain
feat(angular): add an option to generate lazy-loadable modules
`nx generate lib mylib --lazy` provisions the mylib project in .eslintrc.json
`nx generate lib libs/mylib --lazy` provisions the mylib project in .eslintrc.json
Closes #157
```
Expand Down
2 changes: 1 addition & 1 deletion docs/blog/2023-06-29-nx-console-gets-lit.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ If you want to dive deeper, there are many more resources on the architecture of

To rebuild our UI, we first needed a new Lit app to work on. While there’s no native Nx plugin for Lit, generating the code we need was still very straightforward:

`nx generate @nx/web:app --name generate-ui-v2`
`nx generate @nx/web:app apps/generate-ui-v2`

This generates an entire project for us, with a `tsconfig.json`, `index.html`, `main.ts`, and a `project.json`, where our Nx-specific config lives.

Expand Down
10 changes: 2 additions & 8 deletions docs/blog/2023-10-20-nx-17-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The `@nx/react` and `@nx/angular` now include a `federate-module` generator. Thi
To run this generator, use the command:

```shell
> nx g federate-module <module name> --path=<path to module to be exposed> --remote=<name of remote exposing module>
> nx g federate-module <path to module to be exposed> --name=<module name> --remote=<name of remote exposing module>
```

This will add a new module to the `exposes` map in the specified `remote` application, such that it can be consumed by a `host` application.
Expand Down Expand Up @@ -126,17 +126,11 @@ When set to `derived`, the generator will try to determine where to create your
In addition, component generators now follow any given casing for component files. For example, let’s say we have an integrated monorepo with a react application called “my-app” and want to add a “Home” component. With Nx 17, you can run the command:

```shell
> nx g component Home --directory=apps/my-app/src/app
> nx g component apps/my-app/src/app/Home
```

And a `Home.tsx` file will be added in the `apps/my-app/src/app` directory.

You can now also build your directory path right into the generator command. For example, the same “Home” component would be created via:

```shell
> nx g component apps/my-app/src/app/Home
```

Finally, generators will now factory in your current working directory, so you can also create this “Home” component via:

```shell
Expand Down
18 changes: 9 additions & 9 deletions docs/blog/2023-11-08-state-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ Now let’s add our first query. In this example, it will be added under `lib/qu

```shell
# expo workspace
npx nx generate @nx/expo:lib use-cat-fact --directory=queries
npx nx generate @nx/expo:lib libs/queries/use-cat-fact

# react-native workspace
npx nx generate @nx/react-native:lib use-cat-fact --directory=queries
npx nx generate @nx/react-native:lib libs/queries/use-cat-fact
```

Or use [Nx Console](/recipes/nx-console):
Expand Down Expand Up @@ -191,20 +191,20 @@ In order to test out `useQuery` hook, you need to wrap it inside a mock `QueryCl

```shell
# expo library
npx nx generate @nx/expo:library test-wrapper --directory=queries
npx nx generate @nx/expo:library libs/queries/test-wrapper

# react native library
npx nx generate @nx/react-native:library test-wrapper --directory=queries
npx nx generate @nx/react-native:library libs/queries/test-wrapper
```

Then a component inside this library:

```shell
# expo library
npx nx generate @nx/expo:component test-wrapper --project=queries-test-wrapper
npx nx generate @nx/expo:component libs/queries/test-wrapper/src/lib/test-wrapper/test-wrapper

# react native library
npx nx generate @nx/react-native:component test-wrapper --project=queries-test-wrapper
npx nx generate @nx/react-native:component libs/queries/test-wrapper/src/lib/test-wrapper/test-wrapper
```

Add the mock `QueryClientProvider` in `libs/queries/test-wrapper/src/lib/test-wrapper/test-wrapper.tsx`:
Expand Down Expand Up @@ -416,10 +416,10 @@ First, you need to create a library for redux:

```shell
# expo library
npx nx generate @nx/expo:lib cat --directory=states
npx nx generate @nx/expo:lib libs/states/cat

# react native library
npx nx generate @nx/react-native:lib cat --directory=states
npx nx generate @nx/react-native:lib libs/states/cat
```

This should create a folder under libs:
Expand All @@ -439,7 +439,7 @@ You can use the [Nx Console](/recipes/nx-console) to create a redux slice:
Or run this command:

```shell
npx nx generate @nx/react:redux likes --project=states-cat --directory=likes
npx nx generate @nx/react:redux libs/states/cat/src/lib/likes/likes
```

Then update the redux slice at `libs/states/cat/src/lib/likes/likes.slice.ts`:
Expand Down
2 changes: 1 addition & 1 deletion docs/blog/2023-12-20-nx-17-2-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ In addition to performance improvements, we’ve brought the concept of dynamic
You can generate your react module federation workspace now to use dyanmic federation via the `--dynamic` flag:

```shell
nx generate @nx/react:host acme --remotes=nx --dynamic
nx generate @nx/react:host apps/acme --remotes=nx --dynamic
```

Or you can use the utility itself by importing from `@nx/react/mf`:
Expand Down
2 changes: 1 addition & 1 deletion docs/blog/2024-02-06-nuxt-js-support-in-nx.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ This modular structure allows teams to work on different aspects of the applicat
For instance, if you want to create a new Vue UI library, you can use the following command:
```shell
nx generate @nx/vue:lib my-shared-ui
nx generate @nx/vue:lib libs/my-shared-ui
```
This command creates a my-shared-ui library within your workspace, which can then be used across your Nuxt app and potentially other applications within the same workspace.
Expand Down
2 changes: 1 addition & 1 deletion docs/blog/2024-05-08-nx-19-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ If you are interested in trying Nx Cloud, go to [https://nx.app](https://nx.app)

## More Miscellaneous updates!

We've been updating our docs site. We've tweeked the search to make it more helpful, updated navigation, and as you can tell since you're reading it, we've moved our blog to [nx.dev/blog](blog) as well.
We've been updating our docs site. We've tweeked the search to make it more helpful, updated navigation, and as you can tell since you're reading it, we've moved our blog to [nx.dev/blog](/blog) as well.

We've also added a page for [Nx Enterprise](/enterprise):

Expand Down
2 changes: 1 addition & 1 deletion docs/blog/2024-09-10-personal-access-tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ platform so that they're no longer committed to your repo.
[Personal access tokens](/ci/recipes/security/personal-access-tokens) are a new type of access token that is scoped to
an individual user, rather than the workspace. This token authenticates the user with Nx Cloud when running tasks, so that we can validate their access to the distributed cache for a workspace. As soon as a user loses access to an Nx Cloud organization, they will no longer be able to access the cache for any of the organization's workspaces. The user's token belongs to them and will still allow access to their remaining organizations.

This gets even more powerful when combined with the GitHub VCS integration. When a user's GitHub access is removed from
This gets even more powerful when combined with the [GitHub integration](/ci/features/github-integration). When a user's GitHub access is removed from
a GitHub-connected organization, their access to your Nx Cloud organization is removed, and their access to the cache for any of the organization's workspaces is removed.
This means that Nx Cloud can fit into existing user de-provisioning processes you already have.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ If you'd like a more indepth recipe for scaffolding `host` and `remote` generato
our [Module Federation Recipes](/recipes/module-federation).
{% /callout %}

```{% command="npx nx g @nx/react:host shell --remotes=remote1 --bundler=rspack" path="~/myorg" %}
```{% command="npx nx g @nx/react:host apps/shell --remotes=remote1 --bundler=rspack" path="~/myorg" %}
NX Generating @nx/react:host
✔ Which stylesheet format would you like to use? · css
Expand Down
2 changes: 1 addition & 1 deletion docs/blog/2024-09-25-evolving-nx.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ There’s a Steve Jobs quote that I think rings true with all of us at Nx:
As Nx has grown, we’ve hired more people to make the product better. Naturally, those people want to do good work and be paid. We all show up for work to build things we’re passionate about, and solve real pain points for the millions of developers using Nx every day. Money is what enables us to keep doing what we love. So as much as Victor Savkin and I want to just build things and give them away for free, we need to balance our personal passion with what’s the best long-term decisions for Nx — the project, the community, and the company.

Like many open source projects, one of the bigger challenges to sustainability in recent years has been larger cloud products who wait for projects to become successful, and then try to capitalize on that success at the expense of the maintainers. I call these companies “parasite vendors” since they benefit from the host, but give no value back. To battle this, many open source projects have decided to make their open source licensing more restrictive, or introduce dual licenses, forcing those parasite vendors to work with the maintainers on a fair arrangement. We think we’ve come up with a better solution for the community by introducing a new package, Powerpack, with a new commercial license, with only new functionality. **Nx itself still has one license: the MIT license.**
Like many open source projects, one of the bigger challenges to sustainability in recent years has been larger cloud products who wait for projects to become successful, and then try to capitalize on that success at the expense of the maintainers. To battle this, many open source projects have decided to make their open source licensing more restrictive, or introduce dual licenses, forcing those vendors to work with the maintainers on a fair arrangement. We think we’ve come up with a better solution for the community by introducing a new package, Powerpack, with a new commercial license, with only new functionality. **Nx itself still has one license: the MIT license.**

![Nx products and their licenses](/blog/images/evolving-nx/nx-products-licenses.avif)

Expand Down
14 changes: 7 additions & 7 deletions docs/generated/cli/generate.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,43 +24,43 @@ Install `nx` globally to invoke the command directly using `nx`, or use `npx nx`
Generate a new Angular application:

```shell
nx generate @nx/angular:app myapp
nx generate @nx/angular:app apps/myapp
```

Generate a new React application:

```shell
nx generate @nx/react:app myapp
nx generate @nx/react:app apps/myapp
```

Generate a new web component application:

```shell
nx generate @nx/web:app myapp
nx generate @nx/web:app apps/myapp
```

Generate a new Node application:

```shell
nx generate @nx/node:app myapp
nx generate @nx/node:app apps/myapp
```

Generate a new Angular library application:

```shell
nx generate @nx/angular:library mylibrary
nx generate @nx/angular:library libs/mylibrary
```

Generate a new React library application:

```shell
nx generate @nx/react:library mylibrary
nx generate @nx/react:library libs/mylibrary
```

Generate a new Node library application:

```shell
nx generate @nx/node:library mylibrary
nx generate @nx/node:library libs/mylibrary
```

## Options
Expand Down
22 changes: 22 additions & 0 deletions docs/generated/manifests/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,17 @@
"isExternal": false,
"path": "/ci/features/explain-with-ai",
"tags": []
},
{
"id": "github-integration",
"name": "GitHub Integration",
"description": "",
"mediaImage": "",
"file": "nx-cloud/features/github-integration",
"itemList": [],
"isExternal": false,
"path": "/ci/features/github-integration",
"tags": []
}
],
"isExternal": false,
Expand Down Expand Up @@ -333,6 +344,17 @@
"path": "/ci/features/explain-with-ai",
"tags": []
},
"/ci/features/github-integration": {
"id": "github-integration",
"name": "GitHub Integration",
"description": "",
"mediaImage": "",
"file": "nx-cloud/features/github-integration",
"itemList": [],
"isExternal": false,
"path": "/ci/features/github-integration",
"tags": []
},
"/ci/concepts": {
"id": "concepts",
"name": "Concepts",
Expand Down
16 changes: 16 additions & 0 deletions docs/generated/manifests/menus.json
Original file line number Diff line number Diff line change
Expand Up @@ -5627,6 +5627,14 @@
"isExternal": false,
"children": [],
"disableCollapsible": false
},
{
"name": "GitHub Integration",
"path": "/ci/features/github-integration",
"id": "github-integration",
"isExternal": false,
"children": [],
"disableCollapsible": false
}
],
"disableCollapsible": false
Expand Down Expand Up @@ -5687,6 +5695,14 @@
"children": [],
"disableCollapsible": false
},
{
"name": "GitHub Integration",
"path": "/ci/features/github-integration",
"id": "github-integration",
"isExternal": false,
"children": [],
"disableCollapsible": false
},
{
"name": "Concepts",
"path": "/ci/concepts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Nx comes with slightly different terminology than the Angular CLI for some featu
**Angular Schematics** are called [Generators](/features/generate-code) in Nx. You can invoke them in the same way as you would with the Angular CLI, but you use the `nx` command instead of `ng`:

```shell
npx nx g @nx/angular:component my-component
npx nx g @nx/angular:component apps/my-app/src/lib/my-component/my-component
```

You can also run Angular Schematics through the Nx CLI. So something like this works as well:
Expand Down
6 changes: 3 additions & 3 deletions docs/generated/packages/angular/documents/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ For a full tutorial experience, follow the [Angular Standalone Tutorial](/gettin
It's straightforward to generate an Angular application:

```shell
nx g @nx/angular:app appName
nx g @nx/angular:app apps/appName
```

By default, the application will be generated with:
Expand All @@ -94,7 +94,7 @@ nx e2e appName
Generating an Angular library is very similar to generating an application:

```shell
nx g @nx/angular:lib libName
nx g @nx/angular:lib libs/libName
```

By default, the library will be generated with:
Expand Down Expand Up @@ -122,7 +122,7 @@ to `@schematics/angular`. So, even though there is no `@nx/angular:service` gene
successfully create a service:

```shell
nx g @nx/angular:service my-service
nx g @nx/angular:service apps/appName/src/lib/my-service/my-service
```

## More Documentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
},
"additionalProperties": false,
"required": ["name"],
"examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Application\" %}\n\nCreate an application named `my-app`:\n\n```bash\nnx g @nx/angular:application my-app\n```\n\n{% /tab %}\n\n{% tab label=\"Specify directory and style extension\" %}\n\nCreate an application named `my-app` in the `my-dir` directory and use `scss` for styles:\n\n{% callout type=\"note\" title=\"Directory Flag Behavior Changes\" %}\nThe command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=my-dir`. See the [as-provided vs. derived documentation](/deprecated/as-provided-vs-derived) for more details.\n{% /callout %}\n\n```bash\nnx g @nx/angular:app my-app --directory=my-dir/my-app --style=scss\n```\n\n{% /tab %}\n\n{% tab label=\"Single File Components application\" %}\n\nCreate an application with Single File Components (inline styles and inline templates):\n\n```bash\nnx g @nx/angular:app my-app --inlineStyle --inlineTemplate\n```\n\n{% /tab %}\n\n{% tab label=\"Set custom prefix and tags\" %}\n\nSet the prefix to apply to generated selectors and add tags to the application (used for linting).\n\n```bash\nnx g @nx/angular:app my-app --prefix=admin --tags=scope:admin,type:ui\n```\n\n{% /tab %}\n{% /tabs %}\n",
"examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Application\" %}\n\nCreate an application named `my-app`:\n\n```bash\nnx g @nx/angular:application apps/my-app\n```\n\n{% /tab %}\n\n{% tab label=\"Specify directory and style extension\" %}\n\nCreate an application named `my-app` in the `my-dir` directory and use `scss` for styles:\n\n{% callout type=\"note\" title=\"Directory Flag Behavior Changes\" %}\nThe command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=my-dir`. See the [as-provided vs. derived documentation](/deprecated/as-provided-vs-derived) for more details.\n{% /callout %}\n\n```bash\nnx g @nx/angular:app my-dir/my-app --style=scss\n```\n\n{% /tab %}\n\n{% tab label=\"Single File Components application\" %}\n\nCreate an application with Single File Components (inline styles and inline templates):\n\n```bash\nnx g @nx/angular:app apps/my-app --inlineStyle --inlineTemplate\n```\n\n{% /tab %}\n\n{% tab label=\"Set custom prefix and tags\" %}\n\nSet the prefix to apply to generated selectors and add tags to the application (used for linting).\n\n```bash\nnx g @nx/angular:app apps/my-app --prefix=admin --tags=scope:admin,type:ui\n```\n\n{% /tab %}\n{% /tabs %}\n",
"presets": []
},
"aliases": ["app"],
Expand Down
2 changes: 1 addition & 1 deletion docs/generated/packages/angular/generators/component.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
}
},
"required": ["name"],
"examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Component\" %}\n\nCreate a component named `my-component`:\n\n```bash\nnx g @nx/angular:component my-component\n```\n\n{% /tab %}\n\n{% tab label=\"Single File Component\" %}\n\nCreate a component named `my-component` with inline styles and inline template:\n\n```bash\nnx g @nx/angular:component my-component --inlineStyle --inlineTemplate\n```\n\n{% /tab %}\n\n{% tab label=\"Component with OnPush Change Detection Strategy\" %}\n\nCreate a component named `my-component` with OnPush Change Detection Strategy:\n\n```bash\nnx g @nx/angular:component my-component --changeDetection=OnPush\n```\n\n{% /tab %}\n",
"examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Component\" %}\n\nCreate a component named `my-component`:\n\n```bash\nnx g @nx/angular:component apps/my-app/src/lib/my-component/my-component\n```\n\n{% /tab %}\n\n{% tab label=\"Single File Component\" %}\n\nCreate a component named `my-component` with inline styles and inline template:\n\n```bash\nnx g @nx/angular:component apps/my-app/src/lib/my-component/my-component --inlineStyle --inlineTemplate\n```\n\n{% /tab %}\n\n{% tab label=\"Component with OnPush Change Detection Strategy\" %}\n\nCreate a component named `my-component` with OnPush Change Detection Strategy:\n\n```bash\nnx g @nx/angular:component apps/my-app/src/lib/my-component/my-component --changeDetection=OnPush\n```\n\n{% /tab %}\n",
"presets": []
},
"aliases": ["c"],
Expand Down
Loading

0 comments on commit 0354179

Please sign in to comment.