Skip to content

Commit

Permalink
Merge branch 'master' into fix/jest-start-verdaccio
Browse files Browse the repository at this point in the history
  • Loading branch information
tinesoft authored Nov 28, 2024
2 parents 19338bc + 182b46c commit ba68fa5
Show file tree
Hide file tree
Showing 68 changed files with 1,216 additions and 627 deletions.
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ jobs:
pnpm nx-cloud record -- nx format:check --base=$NX_BASE --head=$NX_HEAD &
pids+=($!)
pnpm nx-cloud record -- nx sync:check
pids+=($!)
pnpm nx-cloud record -- nx-cloud conformance:check
pids+=($!)
pnpm nx run-many -t check-imports check-commit check-lock-files check-codeowners documentation --parallel=1 --no-dte &
pids+=($!)
Expand Down
2 changes: 1 addition & 1 deletion docs/blog/2024-10-25-sports-retailer-success.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Improve your architecture and CI pipeline times with Nx projects
slug: improve-architecture-and-ci-times-with-projects
authors: [Philip Fulcher]
tags: [nx, enterprise]
tags: [nx, 'customer story']
cover_image: '/blog/images/2024-10-25/header.avif'
pinned: true
---
Expand Down
2 changes: 1 addition & 1 deletion docs/courses/pnpm-nx-next/lessons/04-task-pipelines.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 'Automate Task Pipelines to Build Before next start'
title: 'Create a Task Pipeline to Build Your Next app Before Serving it'
videoUrl: 'https://youtu.be/_U4hu6SuBaY'
duration: '3:07'
---
Expand Down
2 changes: 1 addition & 1 deletion docs/courses/pnpm-nx-next/lessons/08-remote-caching.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 'Configure CI to Access Remote Caching'
title: 'Enable Read/Write Access to your Nx Remote Cache from CI'
videoUrl: 'https://youtu.be/vBokLJ_F8qs'
duration: '1:45'
---
Expand Down
2 changes: 1 addition & 1 deletion docs/courses/pnpm-nx-next/lessons/11-nx-agents.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 'Run Tasks in Parallel on Different Machines on CI'
title: 'Speed Up CI by Running Tasks in Parallel on Different Machines'
videoUrl: 'https://youtu.be/lO_p4tA6IZI'
duration: '2:08'
---
Expand Down
2 changes: 1 addition & 1 deletion docs/courses/pnpm-nx-next/lessons/12-playwright-split.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 'Split Playwright e2e Tests for a Faster CI'
title: 'Run Playwright E2E Tests Faster by Parallelizing Them on CI'
videoUrl: 'https://youtu.be/42XnmzxEXM8'
duration: '5:47'
---
Expand Down
2 changes: 1 addition & 1 deletion docs/generated/packages/nest/generators/guard.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
}
},
"additionalProperties": false,
"required": ["name"],
"required": ["path"],
"presets": []
},
"description": "Run the `guard` NestJS generator with Nx project support.",
Expand Down
2 changes: 1 addition & 1 deletion docs/generated/packages/nest/generators/interceptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
}
},
"additionalProperties": false,
"required": ["name"],
"required": ["path"],
"presets": []
},
"description": "Run the `interceptor` NestJS generator with Nx project support.",
Expand Down
2 changes: 1 addition & 1 deletion docs/generated/packages/next/executors/server.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
}
},
"required": ["buildTarget"],
"examplesFile": "---\ntitle: Next.js server executor examples\ndescription: This page contains examples for the @nx/next:serve executor.\n---\n\n`project.json`:\n\n```json\n//...\n{\n \"name\": \"acme\",\n \"$schema\": \"node_modules/nx/schemas/project-schema.json\",\n \"sourceRoot\": \".\",\n \"projectType\": \"application\",\n \"targets\": {\n //...\n \"serve\": {\n \"executor\": \"@nx/next:server\",\n \"defaultConfiguration\": \"production\",\n \"options\": {\n \"buildTarget\": \"acme:build\",\n \"dev\": true\n }\n }\n //...\n }\n}\n```\n\n```bash\nnx run acme:serve\n```\n\n## Examples\n\n### For Next.js Standalone projects\n\n{% tabs %}\n{% tab label=\"Default configuration\" %}\n\nThis is the default configuration for Next.js standalone projects. Our `@nx/next:server` executor is integrated to use Next.js' CLI. You can read more about the serve options at [Next.js CLI Options](https://nextjs.org/docs/app/api-reference/next-cli)\n\n```json\n \"serve\": {\n \"executor\": \"@nx/next:server\",\n \"defaultConfiguration\": \"development\",\n \"options\": {\n \"buildTarget\": \"acme:build\",\n \"dev\": true\n },\n \"configurations\": {\n \"development\": {\n \"buildTarget\": \"acme:build:development\",\n \"dev\": true\n },\n \"production\": {\n \"buildTarget\": \"acme:build:production\",\n \"dev\": false\n }\n }\n },\n```\n\n{% /tab %}\n{% tab label=\"Enable turbo\" %}\n\nTurbopack (beta) is a cutting-edge bundler designed for JavaScript and TypeScript. To read more about support features see [Next.js Turbopack Doucmentation](https://turbo.build/pack/docs/features)\n\nIn the context of Nx, you can utilize Turbopack within both the `pages` and `app` directories of Next.js to enhance local development speed. To activate Turbopack, simply:\n\nAppend the `--turbo` flag while executing the Nx development server.\n\n```shell\nnx run acme:serve --turbo\n```\n\nUpdating the build options to include `turbo`.\n\n```json\n \"serve\": {\n \"executor\": \"@nx/next:server\",\n \"defaultConfiguration\": \"development\",\n \"options\": {\n \"buildTarget\": \"acme:build\",\n \"dev\": true\n },\n \"configurations\": {\n \"development\": {\n \"buildTarget\": \"acme:build:development\",\n \"dev\": true,\n \"turbo\": true\n },\n //\n }\n }\n```\n\n```bash\nnx run acme:serve\n```\n\n{% /tab %}\n\n{% tab label=\"Adding keep alive timeout\" %}\n\nWhen using Nx with Next.js behind a downstream proxy, it's important to make sure that the `keep-alive timeouts` of Next.js' HTTP server are set to longer durations than the timeouts of the proxy. If you don't do this, Node.js will unexpectedly end TCP connections without notifying the proxy when the `keep-alive timeout` is reached. This can lead to a proxy error when the proxy tries to reuse a connection that Node.js has already terminated.\n\nTo configure timeout values (in milliseconds) you can:\n\nPass `--keepAliveTimeout`\n\n```shell\nnx run acme:serve --keepAliveTimeout 60000\n```\n\nUpdating the serve options to include `keepAliveTimeout`.\n\n```json\n \"serve\": {\n \"executor\": \"@nx/next:server\",\n \"defaultConfiguration\": \"development\",\n \"options\": {\n \"buildTarget\": \"acme:build\",\n \"dev\": true\n },\n \"configurations\": {\n \"development\": {\n \"buildTarget\": \"acme:build:development\",\n \"dev\": true,\n \"keepAliveTimeout\": 60000\n },\n //\n }\n }\n```\n\n```shell\nnx run acme:serve\n```\n\n{% /tab %}\n\n{% /tabs %}\n",
"examplesFile": "---\ntitle: Next.js server executor examples\ndescription: This page contains examples for the @nx/next:serve executor.\n---\n\n`project.json`:\n\n```json\n//...\n{\n \"name\": \"acme\",\n \"$schema\": \"node_modules/nx/schemas/project-schema.json\",\n \"sourceRoot\": \".\",\n \"projectType\": \"application\",\n \"targets\": {\n //...\n \"serve\": {\n \"executor\": \"@nx/next:server\",\n \"defaultConfiguration\": \"production\",\n \"options\": {\n \"buildTarget\": \"acme:build\",\n \"dev\": true\n }\n }\n //...\n }\n}\n```\n\n```bash\nnx run acme:serve\n```\n\n## Examples\n\n### For Next.js Standalone projects\n\n{% tabs %}\n{% tab label=\"Default configuration\" %}\n\nThis is the default configuration for Next.js standalone projects. Our `@nx/next:server` executor is integrated to use Next.js' CLI. You can read more about the serve options at [Next.js CLI Options](https://nextjs.org/docs/app/api-reference/next-cli)\n\n```json\n \"serve\": {\n \"executor\": \"@nx/next:server\",\n \"defaultConfiguration\": \"development\",\n \"options\": {\n \"buildTarget\": \"acme:build\",\n \"dev\": true\n },\n \"configurations\": {\n \"development\": {\n \"buildTarget\": \"acme:build:development\",\n \"dev\": true\n },\n \"production\": {\n \"buildTarget\": \"acme:build:production\",\n \"dev\": false\n }\n }\n },\n```\n\n{% /tab %}\n{% tab label=\"Enable turbo\" %}\n\nTurbopack (beta) is a cutting-edge bundler designed for JavaScript and TypeScript. To read more about support features see [Next.js Turbopack Documentation](https://turbo.build/pack/docs/features)\n\nIn the context of Nx, you can utilize Turbopack within both the `pages` and `app` directories of Next.js to enhance local development speed. To activate Turbopack, simply:\n\nAppend the `--turbo` flag while executing the Nx development server.\n\n```shell\nnx run acme:serve --turbo\n```\n\nUpdating the build options to include `turbo`.\n\n```json\n \"serve\": {\n \"executor\": \"@nx/next:server\",\n \"defaultConfiguration\": \"development\",\n \"options\": {\n \"buildTarget\": \"acme:build\",\n \"dev\": true\n },\n \"configurations\": {\n \"development\": {\n \"buildTarget\": \"acme:build:development\",\n \"dev\": true,\n \"turbo\": true\n },\n //\n }\n }\n```\n\n```bash\nnx run acme:serve\n```\n\n{% /tab %}\n\n{% tab label=\"Adding keep alive timeout\" %}\n\nWhen using Nx with Next.js behind a downstream proxy, it's important to make sure that the `keep-alive timeouts` of Next.js' HTTP server are set to longer durations than the timeouts of the proxy. If you don't do this, Node.js will unexpectedly end TCP connections without notifying the proxy when the `keep-alive timeout` is reached. This can lead to a proxy error when the proxy tries to reuse a connection that Node.js has already terminated.\n\nTo configure timeout values (in milliseconds) you can:\n\nPass `--keepAliveTimeout`\n\n```shell\nnx run acme:serve --keepAliveTimeout 60000\n```\n\nUpdating the serve options to include `keepAliveTimeout`.\n\n```json\n \"serve\": {\n \"executor\": \"@nx/next:server\",\n \"defaultConfiguration\": \"development\",\n \"options\": {\n \"buildTarget\": \"acme:build\",\n \"dev\": true\n },\n \"configurations\": {\n \"development\": {\n \"buildTarget\": \"acme:build:development\",\n \"dev\": true,\n \"keepAliveTimeout\": 60000\n },\n //\n }\n }\n```\n\n```shell\nnx run acme:serve\n```\n\n{% /tab %}\n\n{% /tabs %}\n",
"presets": []
},
"description": "Serve a Next.js application.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ To learn about how to create and publish custom rules to your Nx Cloud Organizat

Once you have one or more rules published to your Nx Cloud Organization, you can configure your Nx Cloud Organization to use them in the Nx Cloud UI by visiting:

https://nx.app/go/organization/conformance-rules
[https://cloud.nx.app/go/organization/conformance-rules](https://cloud.nx.app/go/organization/conformance-rules)

## Choose the Scope of Configured Rules

Expand All @@ -31,9 +31,9 @@ The rule options will be validated against the rule's JSON schema definition bef
Here you will choose whether or not the rule should be:

- **Enabled**
- The rule will be executed in the chosen workspace(s) when `nx-cloud conformance`/`nx-cloud conformance:check` is run and any violations will cause the process to fail (exit with a non-zero exit code).
- The rule will be executed in the chosen workspace(s) when `nx-cloud conformance` or `nx-cloud conformance:check` is run and any violations will cause the process to fail (exit with a non-zero exit code).
- **Evaluated**
- The rule will be executed in the chosen workspace(s) when `nx-cloud conformance`/`nx-cloud conformance:check` is run, but any violations will not cause the process to fail (i.e. the process will exit with a zero exit code).
- The rule will be executed in the chosen workspace(s) when `nx-cloud conformance` or `nx-cloud conformance:check` is run, but any violations will not cause the process to fail (i.e. the process will exit with a zero exit code).
- This status is useful for exposing violations to allow them to be addressed but without blocking the CI process in the meantime.
- You can combine this with the [Scheduled Status](#scheduled-status) feature to set a deadline for the chosen workspace(s) to become compliant with the rule.
- **Disabled**
Expand Down
2 changes: 2 additions & 0 deletions docs/nx-cloud/reference/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ Most workspaces will not be affected by this, but if you have these values confi
they will stop working with this release (see [this](https://github.com/nrwl/nx-cloud-helm/pull/141/files) for details on what was removed).
Please go to your workspace settings and you should be able to configure all the above values when you setup a VCS integration.

_Terminal outputs_ in the web app will now be fully served from storage bucket (either S3/Gcloud/Azure, or your internal file-server). This means your NxCloud cluster needs to have an open/healthy connection to the bucket. You can test this by ssh'ing into the `nx-cloud-frontend` pod and trying to `wget` one of your bucket artefacts. Any proxy or firewall constraints will need to be handled. Additionally, if your bucket is hosted at a self-signed https URL, any fetch calls from the frontend pod to your bucket will fail. If you think any of this applies to you, please contact your DPE to discuss options.

### 2406.29.1.patch1

- Fix an issue with specifying custom AWS credentials in Minio instances
Expand Down
9 changes: 6 additions & 3 deletions docs/shared/features/manage-releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,14 @@ import * as yargs from 'yargs';
verbose: options.verbose,
});

// The returned number value from releasePublish will be zero if all projects are published successfully, non-zero if not
const publishStatus = await releasePublish({
// publishResults contains a map of project names and their exit codes
const publishResults = await releasePublish({
dryRun: options.dryRun,
verbose: options.verbose,
});
process.exit(publishStatus);

process.exit(
Object.values(publishResults).every((result) => result.code === 0) ? 0 : 1
);
})();
```
39 changes: 33 additions & 6 deletions docs/shared/features/powerpack/conformance.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,29 +52,56 @@ Conformance rules are configured in the `conformance` property of the `nx.json`
}
```

## Enforce Rules with the `nx conformance` Command
## Enforce Rules with the `nx conformance` and `nx conformance:check` Commands

The `@nx/powerpack-conformance` plugin enables the `nx conformance` command which checks all the configured rules. This command should be added to the beginning of your CI process so that the conformance rules are enforced for every PR.
The `@nx/powerpack-conformance` plugin enables the `nx conformance` and `nx conformance:check` commands which check all the configured rules. The difference is that `nx conformance` will invoke any fix generators on a configured rule automatically, whereas `nx conformance:check` will only check the current workspace state and show any violations.

Therefore, `nx conformance` is intended to be run locally while working on a feature branch. `nx conformance:check` should be added to the beginning of your CI process so that the conformance rules are enforced for every PR.

{% tabs %}
{% tab label="Without Nx Cloud" %}

```yaml
- name: Enforce all conformance rules
run: npx nx conformance
run: npx nx conformance:check
```
{% /tab %}
{% tab label="Using Nx Cloud" %}
```yaml
- name: Enforce all conformance rules
run: npx nx-cloud record -- npx nx conformance
run: npx nx-cloud record -- npx nx conformance:check
```
Use `npx nx-cloud record --` to capture the logs for `nx conformance` in the Nx Cloud dashboard.
Use `npx nx-cloud record --` to capture the logs for `nx conformance:check` in the Nx Cloud dashboard.

{% /tab %}
{% tab label="Using Nx Cloud (Organizations on the Enterprise Plan)" %}

```yaml
- name: Enforce all conformance rules
run: npx nx-cloud record -- npx nx-cloud conformance:check
```

Here we are using the `nx-cloud` CLI to run the `conformance:check` command so that we can hook into the power of Conformance rules configured in your Nx Cloud Enterprise organization. Learn more about [conformance rules in Nx Cloud](/ci/recipes/enterprise/conformance/configure-conformance-rules-in-nx-cloud).

{% /tab %}
{% /tabs %}

If there is not a valid Powerpack license in the workspace, the `nx conformance` command will fail without checking any rules.
If a valid Powerpack license is not available to the workspace (either locally or via Nx Cloud), the `nx conformance` and `nx conformance:check` commands will fail without checking any rules.

## Taking things further with Nx Cloud Enterprise

Organizations on the Nx Cloud Enterprise plan can [publish custom conformance rules](/ci/recipes/enterprise/conformance/publish-conformance-rules-to-nx-cloud) to their Nx Cloud organization without the friction of a custom registry, and then [configure the rules](/ci/recipes/enterprise/conformance/configure-conformance-rules-in-nx-cloud) to apply to the workspaces in their organization automatically when `nx-cloud conformance` or `nx-cloud conformance:check` is run (note that the `nx-cloud` CLI is used in this case in order to handle the authentication with Nx Cloud).

The Powerpack license will be applied automatically via Nx Cloud in all contexts, and so there is zero setup required for the end developer.

Simply add an appropriate invocation of the `nx-cloud conformance:check` command to your CI process and all cloud configured rules will be applied and merged with any local rules:

```yaml
- name: Enforce all conformance rules
run: npx nx-cloud record -- npx nx-cloud conformance:check
```

Learn more about [publishing](/ci/recipes/enterprise/conformance/publish-conformance-rules-to-nx-cloud) and [configuring conformance rules in Nx Cloud](/ci/recipes/enterprise/conformance/configure-conformance-rules-in-nx-cloud).
4 changes: 3 additions & 1 deletion nx-dev/nx-dev/app/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Metadata, ResolvingMetadata } from 'next';
import { blogApi } from '../../../lib/blog.api';
import { BlogDetails } from '@nx/nx-dev/ui-blog';
import { DefaultLayout } from '@nx/nx-dev/ui-common';
import { tryNxCloudForFree } from '../../../lib/components/headerCtaConfigs';

interface BlogPostDetailProps {
params: { slug: string };
Expand Down Expand Up @@ -44,12 +45,13 @@ export async function generateStaticParams() {
export default async function BlogPostDetail({
params: { slug },
}: BlogPostDetailProps) {
const ctaHeaderConfig = [tryNxCloudForFree];
const blog = await blogApi.getBlogPostBySlug(slug);
return blog ? (
<>
{/* This empty div is necessary as app router does not automatically scroll on route changes */}
<div></div>
<DefaultLayout>
<DefaultLayout headerCTAConfig={ctaHeaderConfig}>
<BlogDetails post={blog} />
</DefaultLayout>
</>
Expand Down
8 changes: 7 additions & 1 deletion nx-dev/nx-dev/app/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { blogApi } from '../../lib/blog.api';
import { BlogContainer } from '@nx/nx-dev/ui-blog';
import { DefaultLayout } from '@nx/nx-dev/ui-common';
import { Suspense } from 'react';
import {
requestFreeTrial,
tryNxCloudForFree,
} from '../../lib/components/headerCtaConfigs';

export const metadata: Metadata = {
title: 'Nx Blog - Updates from the Nx & Nx Cloud team',
Expand Down Expand Up @@ -34,11 +38,13 @@ async function getBlogTags() {
}

export default async function BlogIndex() {
const ctaHeaderConfig = [tryNxCloudForFree];

const blogs = await getBlogs();
const tags = await getBlogTags();
return (
<Suspense>
<DefaultLayout>
<DefaultLayout headerCTAConfig={ctaHeaderConfig}>
<BlogContainer blogPosts={blogs} tags={tags} />
</DefaultLayout>
</Suspense>
Expand Down
18 changes: 16 additions & 2 deletions nx-dev/nx-dev/app/nx-cloud/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import {
Statistics,
} from '@nx/nx-dev/ui-cloud';

import { CallToAction, DefaultLayout } from '@nx/nx-dev/ui-common';
import {
ButtonLinkProps,
CallToAction,
DefaultLayout,
} from '@nx/nx-dev/ui-common';

import type { Metadata } from 'next';

Expand Down Expand Up @@ -37,8 +41,18 @@ export const metadata: Metadata = {
};

export default function NxCloudPage(): JSX.Element {
const headerCTAConfig: ButtonLinkProps[] = [
{
href: '/pricing',
variant: 'primary',
size: 'small',
title: 'Get started for free',
children: 'Get started for free',
},
];

return (
<DefaultLayout>
<DefaultLayout headerCTAConfig={headerCTAConfig}>
<Hero />
<TrustedBy />

Expand Down
Loading

0 comments on commit ba68fa5

Please sign in to comment.