Skip to content
This repository was archived by the owner on May 3, 2026. It is now read-only.

Commit 5cb41af

Browse files
committed
feat: created nx plugin and added integration with nx
1 parent 0c243b2 commit 5cb41af

4 files changed

Lines changed: 61 additions & 5 deletions

File tree

README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,43 @@ tsparticles-cli build
5050

5151
### Build in an Nx workspace
5252

53-
The CLI can now cooperate with Nx instead of always running its internal build pipeline.
53+
The `build` command can delegate to Nx targets when it detects an Nx workspace.
5454

5555
```bash
5656
tsparticles-cli build --nx
5757
tsparticles-cli build --nx --clean --lint --tsc
58+
tsparticles-cli build --legacy
5859
pnpm nx run @tsparticles/cli-command-build:tsc
5960
```
6061

61-
Inside this repository, the local plugin `@tsparticles/cli-nx-plugin` augments package-based projects with canonical tsParticles targets like `clean`, `prettify`, `prettify:ci`, and `tsc`, while preserving the existing npm script names.
62+
- `--nx`: forces Nx-target execution when required targets exist
63+
- `--legacy`: disables Nx-aware mode and runs the original in-process pipeline
64+
- default behavior in this workspace: with no granular flags, `build`/`build:ci` Nx aggregate targets are preferred when available
65+
66+
Inside this repository, the local plugin `@tsparticles/cli-nx-plugin` augments package projects under `commands/*` and `packages/*` with canonical aliases like `clean`, `prettify`, `prettify:ci`, `tsc`, `bundle`, and `distfiles`.
67+
68+
## Workspace commands (development)
69+
70+
From the `cli` root:
71+
72+
```bash
73+
pnpm run show:projects
74+
pnpm run build
75+
pnpm run build:affected
76+
pnpm run build:ci
77+
pnpm run lint
78+
pnpm run lint:ci
79+
pnpm run test
80+
pnpm run test:ci
81+
```
82+
83+
### Focused Nx commands
84+
85+
```bash
86+
pnpm nx show project @tsparticles/cli-command-build --json
87+
pnpm nx run @tsparticles/cli-command-build:build
88+
pnpm nx run @tsparticles/cli-nx-plugin:build
89+
```
6290

6391
### Create
6492

commands/build/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,17 @@ The CLI now looks for these canonical build-step targets first and falls back to
8282

8383
The workspace-local Nx plugin `@tsparticles/cli-nx-plugin` infers the canonical aliases automatically for packages in this repository, so packages can keep their current npm scripts while exposing friendlier Nx targets.
8484

85+
### Verify in this workspace
86+
87+
From the `cli` root, these commands validate the Nx integration end-to-end:
88+
89+
```bash
90+
pnpm nx show project @tsparticles/cli-command-build --json
91+
pnpm nx run @tsparticles/cli-command-build:tsc
92+
pnpm nx run @tsparticles/cli-command-build:test
93+
pnpm run build
94+
```
95+
8596
### Create
8697

8798
#### Preset

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@
33
"version": "0.0.0",
44
"private": true,
55
"scripts": {
6-
"build": "nx run-many -t build",
7-
"build:ci": "nx run-many -t build:ci",
8-
"test": "nx run-many -t test"
6+
"build": "pnpm nx run-many -t build",
7+
"build:affected": "pnpm nx affected -t build",
8+
"build:ci": "pnpm nx run-many -t build:ci",
9+
"lint": "pnpm nx run-many -t lint",
10+
"lint:ci": "pnpm nx run-many -t lint:ci",
11+
"show:projects": "pnpm nx show projects",
12+
"test": "pnpm nx run-many -t test",
13+
"test:ci": "pnpm nx run-many -t test:ci"
914
},
1015
"devDependencies": {
1116
"@nx/devkit": "^22.7.1",

packages/nx-plugin/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Internal Nx plugin used by the `tsParticles CLI` workspace.
88

99
The plugin augments package-based Nx projects under `commands/*` and `packages/*` with canonical tsParticles build-step aliases.
1010

11+
It is enabled in the workspace `nx.json` via the `@tsparticles/cli-nx-plugin` entry in `plugins`.
12+
1113
### Canonical aliases inferred by the plugin
1214

1315
| Canonical target | Script fallback |
@@ -27,3 +29,13 @@ pnpm nx run @tsparticles/cli-command-build:clean
2729
```
2830

2931
without forcing every package to rename its existing npm scripts.
32+
33+
## Verify plugin behavior
34+
35+
From the `cli` root:
36+
37+
```bash
38+
pnpm nx show project @tsparticles/cli-command-build --json
39+
pnpm nx show projects --withTarget tsc
40+
pnpm nx run @tsparticles/cli-nx-plugin:test
41+
```

0 commit comments

Comments
 (0)