Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@ jobs:
working-directory: docs
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled
- name: Setup pnpm
uses: pnpm/action-setup@v4
uses: pnpm/action-setup@v6
with:
run_install: false
- name: Setup Node
uses: actions/setup-node@v4
uses: actions/setup-node@v5
with:
node-version: 20
node-version: 'lts/*'
check-latest: true
cache: pnpm
- name: Setup Pages
uses: actions/configure-pages@v4
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@ jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
name: Checkout [${{ github.ref_name }}]
with:
fetch-depth: 0
- uses: nrwl/nx-set-shas@v4
- uses: nrwl/nx-set-shas@v5
name: Derive appropriate SHAs for base and head for `nx affected` commands
- uses: pnpm/action-setup@v4
- uses: pnpm/action-setup@v6
with:
run_install: false
- uses: actions/setup-node@v4
- uses: actions/setup-node@v5
with:
node-version: 'lts/*'
check-latest: true
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm nx affected --target=build --parallel=2
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,24 @@ jobs:
pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
fetch-depth: 0
- uses: nrwl/nx-set-shas@v4
- uses: nrwl/nx-set-shas@v5
name: Derive appropriate SHAs for base and head for `nx affected` commands
- uses: pnpm/action-setup@v4
- uses: pnpm/action-setup@v6
with:
run_install: false
- uses: actions/setup-node@v4
- uses: actions/setup-node@v5
with:
node-version: 'lts/-1'
node-version: 'lts/*'
check-latest: true
cache: pnpm
- name: 'Create E2E env file'
run: |
echo FORGE_EMAIL=${{ secrets.FORGE_EMAIL }} >> e2e/nx-forge-e2e/.env
echo FORGE_EMAIL=${{ vars.FORGE_EMAIL }} >> e2e/nx-forge-e2e/.env
echo FORGE_API_TOKEN=${{ secrets.FORGE_API_TOKEN }} >> e2e/nx-forge-e2e/.env
echo ATLASSIAN_PRODUCT=${{ vars.ATLASSIAN_PRODUCT }} >> e2e/nx-forge-e2e/.env
echo ATLASSIAN_SITE_URL=${{ vars.ATLASSIAN_SITE_URL }} >> e2e/nx-forge-e2e/.env
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@ jobs:
working-directory: docs
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled
- name: Setup pnpm
uses: pnpm/action-setup@v4
uses: pnpm/action-setup@v6
with:
run_install: false
- name: Setup Node
uses: actions/setup-node@v4
uses: actions/setup-node@v5
with:
node-version: 20
node-version: 'lts/*'
check-latest: true
cache: pnpm
- name: Setup Pages
uses: actions/configure-pages@v4
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,22 @@ jobs:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
name: Checkout [main]
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: pnpm/action-setup@v6
with:
run_install: false
- uses: actions/setup-node@v4
- uses: actions/setup-node@v5
name: Setup Node.js
with:
node-version: 'lts/-1'
node-version: 'lts/*'
check-latest: true
cache: pnpm
- name: 'Create E2E env file'
run: |
echo FORGE_EMAIL=${{ secrets.FORGE_EMAIL }} >> e2e/nx-forge-e2e/.env
echo FORGE_EMAIL=${{ vars.FORGE_EMAIL }} >> e2e/nx-forge-e2e/.env
echo FORGE_API_TOKEN=${{ secrets.FORGE_API_TOKEN }} >> e2e/nx-forge-e2e/.env
echo ATLASSIAN_PRODUCT=${{ vars.ATLASSIAN_PRODUCT }} >> e2e/nx-forge-e2e/.env
echo ATLASSIAN_SITE_URL=${{ vars.ATLASSIAN_SITE_URL }} >> e2e/nx-forge-e2e/.env
Expand All @@ -46,8 +47,7 @@ jobs:
rm -rf dist
pnpm nx run nx-forge:build
pnpm nx run nx-forge:test
- run:
pnpm nx run nx-forge-e2e:e2e
- run: pnpm nx run nx-forge-e2e:e2e
env:
NODE_OPTIONS: '--no-deprecation'
- name: Release
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,8 @@ Thumbs.db
.claude/worktrees
.claude/settings.local.json
.nx/polygraph

.nx/self-healing
.nx/migrate-runs

.pnpm-store
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
/coverage

/.nx/cache
/.nx/workspace-data
/.nx/workspace-data
.nx/self-healing
4 changes: 4 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ export default defineConfig({
text: 'Migrating to a newer plugin version',
link: 'migrating-plugin-version',
},
{
text: 'Overriding plugin dependencies',
link: 'overriding-plugin-dependencies',
},
{
text: 'Migrating to the package executor',
link: 'migrating-to-package-executor',
Expand Down
2 changes: 1 addition & 1 deletion docs/concepts/plugin-concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This page summarizes the main Nx Forge plugin concepts and ideas.

## Building Forge apps

When using [the app generator](../guides/generating-a-forge-app.md) to scaffold a Forge app, you will get an Nx project with a build target and a collection of inferred targets provided by the Nx Forge plugin.
When using [the app generator](../guides/generating-a-forge-app.md) to scaffold a Forge app, you will get an Nx project with a `build` target provided by the selected bundler plugin and a collection of inferred Forge lifecycle targets provided by the Nx Forge plugin.

The most important thing to know is that to deploy a Forge app, you need to run the following targets to get an artifact that can be deployed to the Forge platform:

Expand Down
8 changes: 1 addition & 7 deletions docs/guides/adding-a-custom-ui-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@

If you have not installed [`@nx/react`](https://nx.dev/nx-api/react/documents/overview) in your workspace, you can install it by running the following command:

:::code-group
```shell[Nx 18+]
```shell
nx add @nx/react
```

```shell[Nx <18]
npm i -D @nx/react
```
:::

## Generating a React application

With the React plugin installed, we can use the [React application generator](https://nx.dev/nx-api/react/generators/application) to scaffold a React application for our Custom UI. Replace `<custom-ui-app-name>` with the name of the Custom UI project you want to create. The example below will generate the project under the `apps` folder in your workspace. If you prefer a different directory, you can change that as you like. You can add the `--dry-run` flag to preview what will be generated.
Expand Down
12 changes: 1 addition & 11 deletions docs/guides/adding-a-ui-kit-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,14 @@ npm i @forge/react

If you have not installed [`@nx/react`](https://nx.dev/nx-api/react/documents/overview) in your workspace, you can install it by running the following command:

:::code-group
```shell[Nx 18+]
```shell
nx add @nx/react
```

```shell[Nx <18]
npm i -D @nx/react
```
:::

## Generating a React application

With the React plugin installed, we can use the [React application generator](https://nx.dev/nx-api/react/generators/application) to scaffold a React application for our UI Kit. Replace `<ui-kit-app-name>` with the name of the UI Kit project you want to create. You can add the `--dry-run` flag to preview the generated files.

::: tip
If you are asked about the project name and where the project should be generated, select "as provided" (this will become the default in Nx 20).
:::

```shell
nx g @nx/react:app <ui-kit-app-name> --directory=apps/<ui-kit-app-name> --style=css
```
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sidebar_position: 10
---

<script setup>
const nxVersion = 22
const nxVersion = 23
</script>

# Getting started
Expand Down
4 changes: 3 additions & 1 deletion docs/guides/migrating-to-package-executor.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ For all the details and motivation of this change, refer to [the discussion on G
2. [Generate a new Forge app](./generating-a-forge-app.md) with the updated app generator. Make sure to set the `bundler` option to [choose if the `build` task should be run by Webpack or esbuild](../reference/generators.md#application). You do not need to run the `build`, `package`, or `register` tasks. Generating this Forge app will ensure you have the correct dependencies installed and your workspace is configured to work with Webpack or esbuild.
3. a) If you chose the Webpack bundler option (default):

Copy the `webpack.config.js` to your app's project directory and update the `output.path` to match your project layout. Delete the existing `build` target configuration.
Copy the generated `webpack.config.js` to your app's project directory and update the `outputPath`, `main`, `tsConfig`, and `assets` values to match your project layout. The generated app uses the `@nx/webpack/plugin` entry in `nx.json` to infer the `build` target, so you can delete the existing `build` target configuration from your app's `project.json`.

If your workspace has inferred plugins disabled, keep an explicit `build` target instead. In that case, copy the generated app's `build` target configuration from `project.json` and adjust the paths to match your project layout.

b) If you chose the esbuild bundler option:

Expand Down
26 changes: 26 additions & 0 deletions docs/guides/overriding-plugin-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Overriding plugin dependencies

The Nx Forge plugin has a dependency on `@forge/manifest` that allows the plugin to read and validate Forge app manifest files. Since the Forge platform evolves fairly quickly and new features are being added to the manifest, you may see the Nx Forge plugin fail to parse your Forge app's manifest file. This is often because the manifest parser used by the plugin is outdated and does not understand the manifest structure required by the new features.

To fix this, you can instruct your package manager to override the dependency version with a different one. Refer to the example below on how you can add overrides based on the package manager you are using.

::: code-group

```json [npm: package.json]
{
"overrides": {
"@forge/manifest": "13.0.0"
}
}
```

```yaml [pnpm: pnpm-workspace.yaml]
overrides:
"@forge/manifest": "13.0.0"
```

:::

## References
- [npm package.json overrides](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#overrides)
- [pnpm overrides](https://pnpm.io/settings#overrides)
2 changes: 1 addition & 1 deletion e2e/nx-forge-e2e/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ module.exports = {
setupFiles: ['dotenv/config'],
globalSetup: '../../tools/scripts/start-local-registry.ts',
globalTeardown: '../../tools/scripts/stop-local-registry.ts',
testTimeout: 240000, // set the default test timeout to 2min for all e2e tests
testTimeout: 240000, // set the default test timeout to 4min for all e2e tests
};
27 changes: 21 additions & 6 deletions e2e/nx-forge-e2e/src/application.generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from 'node:fs';
import { join } from 'node:path';
import { generateForgeApp } from './utils/generate-forge-app';
import { runNxCommandAsync } from './utils/async-commands';
import { formatCommandResult, runNxCommandAsync } from './utils/async-commands';
import {
cleanupTestWorkspace,
createTestWorkspace,
Expand Down Expand Up @@ -41,7 +41,8 @@ const expectWebpackBuildOutput = async (
workspaceDirectory: string,
appName: string
) => {
const { stdout } = await runNxCommandAsync(`run ${appName}:build`, {
const buildCommand = `run ${appName}:build`;
const buildResult = await runNxCommandAsync(buildCommand, {
cwd: workspaceDirectory,
});
const outputDir = join(workspaceDirectory, 'dist', 'apps', appName);
Expand All @@ -51,19 +52,33 @@ const expectWebpackBuildOutput = async (
throw new Error(
[
`Expected generated build output at ${indexJsPath}.`,
`Build stdout:\n${stdout}`,
formatCommandResult(`nx ${buildCommand}`, buildResult),
`Output tree for ${outputDir}:\n${describeDirectoryTree(outputDir)}`,
].join('\n\n')
);
}

expect(existsSync(join(outputDir, 'src', 'main.js'))).toBe(false);

await runNxCommandAsync(`run ${appName}:package`, {
const packageCommand = `run ${appName}:package`;
const packageResult = await runNxCommandAsync(packageCommand, {
cwd: workspaceDirectory,
});
expect(existsSync(join(outputDir, 'manifest.yml'))).toBe(true);
expect(existsSync(join(outputDir, 'package.json'))).toBe(true);
const missingPackageFiles = ['manifest.yml', 'package.json'].filter(
(file) => !existsSync(join(outputDir, file))
);

if (missingPackageFiles.length > 0) {
throw new Error(
[
`Expected package output to include: ${missingPackageFiles.join(
', '
)}.`,
formatCommandResult(`nx ${packageCommand}`, packageResult),
`Output tree for ${outputDir}:\n${describeDirectoryTree(outputDir)}`,
].join('\n\n')
);
}
};

const configureWebpackTaskInference = (
Expand Down
Loading
Loading