Skip to content

Commit 036c9a4

Browse files
committed
chore: fix after nx v21 update
1 parent 906cb72 commit 036c9a4

File tree

99 files changed

+654
-451
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+654
-451
lines changed

.devcontainer/postCreateCommand.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,9 @@ export PATH="$BUN_INSTALL/bin:$PATH"
1111

1212
# Install NPM dependencies
1313
echo "⚙️ Installing NPM dependencies..."
14-
bun install --frozen-lockfile
14+
bun install --frozen-lockfile
15+
16+
# Clean system cache
17+
echo "🧹 Cleaning cache..."
18+
sudo apt-get autoclean
19+
sudo apt-get clean

.github/copilot-instructions.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Copilot Instructions for nxrocks
2+
3+
## Big Picture
4+
5+
- **Monorepo managed by Nx (v21+) and Bun.**
6+
Nx plugins extend support for JVM (Spring Boot, Quarkus, Micronaut, Ktor), Flutter/Dart (Flutter, Melos), and cross-language monorepos.
7+
- **Plugin Architecture:**
8+
Each plugin (`packages/nx-*`) has its own generators, executors, and utilities. Shared code lives in `packages/common` and `packages/common-jvm`.
9+
- **E2E Testing:**
10+
Each plugin has a matching e2e project in `e2e/`. Smoke tests (`e2e/smoke`) validate workspace creation and plugin compatibility with new Nx versions.
11+
- **Custom CLIs:**
12+
`create-nx-*` CLIs (see `packages/create-nx-*`) bootstrap Nx workspaces with pre-installed plugins and required runtime dependencies.
13+
14+
## Developer Workflows
15+
16+
- **Build:**
17+
`bun nx build <project>` or `nx build <project>`
18+
- **Test:**
19+
`bun nx test <project>` or `nx test <project>`
20+
- **Lint:**
21+
`bun nx lint <project>`
22+
- **Format:**
23+
Use `nx run <project>:format` or `nx apply-format <project>` (not `nx format <project>`, which is reserved by Nx CLI)
24+
- **Generate:**
25+
`nx generate @nxrocks/<plugin>:new ...` for new projects
26+
- **Dependency Graph:**
27+
`nx graph` or `nx dep-graph` visualizes cross-language dependencies
28+
- **CI:**
29+
Nx Cloud is used for distributed caching and CI. Wrapper scripts for Maven/Gradle/Flutter are preferred.
30+
31+
## Project-Specific Conventions
32+
33+
- **Executors:**
34+
Plugins map Nx targets to native build tools (e.g., `build``mvnw package` or `gradlew build`).
35+
Always use project-local wrappers (`./mvnw`, `./gradlew`) unless `--ignoreWrapper` is specified.
36+
- **Task Dependencies:**
37+
Build/test tasks auto-install dependent libraries via the `install` target.
38+
- **Formatting:**
39+
JVM projects use [Spotless](https://github.com/diffplug/spotless).
40+
- **Multi-module Support:**
41+
Plugins support multi-module projects for Maven/Gradle.
42+
- **Proxy Support:**
43+
Plugins respect `http_proxy`/`https_proxy` environment variables for API calls to project generators.
44+
- **Melos Integration:**
45+
For Dart/Flutter monorepos, root-level NPM scripts (e.g., `melos-bootstrap`, `melos-clean`) run Melos commands via Nx.
46+
47+
## Integration Points
48+
49+
- **Spring Initializr, Quarkus, Micronaut, Ktor:**
50+
Generators fetch starter projects from official APIs.
51+
- **Flutter, Melos:**
52+
See `nx-flutter`, `nx-melos` and root `package.json` scripts for Dart/Flutter workflows.
53+
- **Nx Cloud:**
54+
Used for caching and CI. See `nx.json` for configuration.
55+
56+
## Examples
57+
58+
- Generate a Spring Boot app:
59+
`nx generate @nxrocks/nx-spring-boot:new my-app --projectType application`
60+
- Build a Quarkus app:
61+
`nx build my-quarkus-app`
62+
- Format a Micronaut app:
63+
`nx run my-micronaut-app:format`
64+
- Run Melos bootstrap:
65+
`npx nx melos-bootstrap --since=main`
66+
67+
## References
68+
69+
- See each plugin's `README.md` for detailed options and usage.
70+
- E2E test specs in `e2e/<plugin>-e2e/tests/` show real workflows and edge cases.
71+
- For advanced Nx usage, see `nx.json`, `project.json`, and `tools/`.
72+
73+
---
74+
75+
**Feedback requested:**
76+
Are any sections unclear, missing, or too generic? Let me know what needs refinement or if you want deeper coverage of any workflow, plugin, or integration.

.github/workflows/ci.yml

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,37 @@ name: CI
33
on:
44
push:
55
branches:
6-
- develop
6+
- main
77
pull_request:
88

9-
# Needed for nx-set-shas when run on the main branch
109
permissions:
1110
actions: read
1211
contents: read
1312

1413
jobs:
15-
ci:
14+
main:
1615
runs-on: ubuntu-latest
17-
env:
18-
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
19-
ANDROID_SDK_VERSION: 34
20-
FLUTTER_VERSION: 3.19.3
21-
JDK_VERSION: 17.0.11
22-
JDK_DISTRO: ms
23-
JAVA_OPTIONS: '-Xmx3g'
24-
timeout-minutes: 120
2516
steps:
26-
- name: Checkout Repo
27-
uses: actions/checkout@v4
17+
- uses: actions/checkout@v4
2818
with:
29-
# We need to fetch all branches and commits so that Nx affected has a base to compare against.
19+
filter: tree:0
3020
fetch-depth: 0
3121

32-
- name: Install node, bun, and dependencies
33-
uses: ./.github/actions/install-dependencies
34-
35-
# Validating Launch Templates
36-
- run: bunx nx-cloud validate --workflow-file="./.nx/workflows/agents.yaml"
37-
38-
# Connect your workspace on nx.app and uncomment this to enable task distribution.
39-
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e" targets have been requested
40-
- run: bunx nx-cloud start-ci-run --distribute-on=".nx/workflows/distribution-config.yaml" --stop-agents-after="e2e-ci" --with-env-vars="ANDROID_SDK_VERSION,FLUTTER_VERSION,JDK_VERSION,JDK_DISTRO,JAVA_OPTIONS"
41-
42-
# This line is needed for nx affected to work when CI is running on a PR
43-
- run: git branch --track develop origin/develop || exit 0
44-
45-
- name: Derive appropriate SHAs for base and head for `nx affected` commands
46-
uses: nrwl/nx-set-shas@v4
22+
- uses: oven-sh/setup-bun@v1
4723
with:
48-
main-branch-name: 'develop'
49-
50-
- run: bunx nx-cloud record -- nx format:check
51-
- run: bunx nx affected -t lint test-ci build e2e-ci --parallel=5 --exclude=smoke
24+
bun-version: latest
25+
26+
# This enables task distribution via Nx Cloud
27+
# Run this command as early as possible, before dependencies are installed
28+
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
29+
# Uncomment this line to enable task distribution
30+
# - run: bunx nx start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="build"
31+
32+
- run: bun install --no-cache
33+
34+
# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
35+
# - run: bun nx-cloud record -- echo Hello World
36+
- run: bun nx run-many -t lint test build
37+
# Nx Cloud recommends fixes for failures to help you get CI green faster. Learn more: https://nx.dev/ci/features/self-healing-ci
38+
- run: bun nx fix-ci
39+
if: always()

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ v8-compile-cache-0
4040
Thumbs.db
4141

4242
# Nx files
43-
/migrations.json
4443
.nx/cache
4544
.nx/workspace-data
4645
.cursor/rules/nx-rules.mdc

.kiro/settings/mcp.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"mcpServers": {}
3+
}

.kiro/steering/product.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# NxRocks Product Overview
2+
3+
NxRocks is a collection of Nx plugins that enhance Nx workspaces with support for various frameworks and technologies beyond the typical JavaScript/TypeScript ecosystem.
4+
5+
## Core Plugins
6+
7+
- **nx-spring-boot**: Spring Boot project support with generators and executors
8+
- **nx-flutter**: Flutter development with first-class Nx integration
9+
- **nx-quarkus**: Quarkus framework support for Java microservices
10+
- **nx-micronaut**: Micronaut framework integration
11+
- **nx-melos**: Melos support for Flutter monorepos
12+
- **nx-ktor**: Ktor framework support for Kotlin server development
13+
14+
## Custom CLIs
15+
16+
Each plugin has a corresponding `create-nx-*` CLI tool for bootstrapping new workspaces with the respective technology pre-configured.
17+
18+
## Target Audience
19+
20+
Developers who want to use Nx's powerful monorepo capabilities with JVM-based frameworks (Spring Boot, Quarkus, Micronaut, Ktor) and Flutter applications.

.kiro/steering/structure.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Project Structure & Organization
2+
3+
## Monorepo Layout
4+
5+
```
6+
nxrocks/
7+
├── packages/ # Library packages (libsDir)
8+
├── e2e/ # E2E test applications (appsDir)
9+
├── tools/ # Build and development scripts
10+
└── images/ # Documentation assets
11+
```
12+
13+
## Package Categories
14+
15+
### Core Libraries
16+
17+
- **common**: Shared utilities across all plugins
18+
- **common-cli**: CLI-specific shared functionality
19+
- **common-jvm**: JVM-specific shared utilities
20+
21+
### Nx Plugins
22+
23+
- **nx-spring-boot**: Spring Boot integration
24+
- **nx-flutter**: Flutter development support
25+
- **nx-quarkus**: Quarkus framework support
26+
- **nx-micronaut**: Micronaut framework support
27+
- **nx-melos**: Melos monorepo tool integration
28+
- **nx-ktor**: Ktor framework support
29+
30+
### CLI Tools
31+
32+
- **create-nx-spring-boot**: Bootstrap Spring Boot workspaces
33+
- **create-nx-flutter**: Bootstrap Flutter workspaces
34+
- **create-nx-quarkus**: Bootstrap Quarkus workspaces
35+
- **create-nx-micronaut**: Bootstrap Micronaut workspaces
36+
- **create-nx-ktor**: Bootstrap Ktor workspaces
37+
38+
## Standard Package Structure
39+
40+
```
41+
packages/[package-name]/
42+
├── src/
43+
│ ├── executors/ # Nx executors (build, test, run, etc.)
44+
│ ├── generators/ # Code generators and schematics
45+
│ ├── migrations/ # Migration scripts
46+
│ ├── utils/ # Package-specific utilities
47+
│ ├── core/ # Core functionality
48+
│ ├── graph/ # Dependency graph plugins
49+
│ └── index.ts # Main export
50+
├── testing/ # Test utilities (if applicable)
51+
├── recipes/ # Recipe configurations (JVM plugins)
52+
├── generators.json # Generator definitions
53+
├── executors.json # Executor definitions
54+
├── migrations.json # Migration definitions
55+
├── package.json
56+
├── project.json # Nx project configuration
57+
├── tsconfig.lib.json # TypeScript config for library
58+
├── tsconfig.spec.json # TypeScript config for tests
59+
└── jest.config.ts # Jest configuration
60+
```
61+
62+
## E2E Test Structure
63+
64+
```
65+
e2e/[plugin-name]-e2e/
66+
├── tests/ # Test specifications
67+
├── jest.config.ts # Jest configuration
68+
├── project.json # Nx project configuration
69+
└── tsconfig.spec.json # TypeScript config
70+
```
71+
72+
## Naming Conventions
73+
74+
- **Packages**: `@nxrocks/[name]` (scoped)
75+
- **Executors**: Kebab-case (e.g., `build-image`, `check-format`)
76+
- **Generators**: Kebab-case (e.g., `project`, `link`)
77+
- **Files**: Kebab-case for configs, camelCase for TypeScript
78+
- **Directories**: Kebab-case
79+
80+
## Configuration Files
81+
82+
- **generators.json**: Defines available generators with schemas
83+
- **executors.json**: Defines available executors with implementations
84+
- **migrations.json**: Defines migration scripts for version updates
85+
- **project.json**: Nx-specific project configuration
86+
- **package.json**: Standard npm package configuration with workspace dependencies

.kiro/steering/tech.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Technology Stack & Build System
2+
3+
## Build System
4+
5+
- **Primary**: Nx monorepo with Bun as package manager
6+
- **TypeScript**: ES2022 target with Node.js Next module resolution
7+
- **Bundler**: SWC for fast TypeScript compilation
8+
- **Testing**: Jest with parallel execution
9+
- **Linting**: ESLint with Nx flat config
10+
- **Formatting**: Prettier
11+
- **CI/CD**: Semantic release with independent package versioning
12+
13+
## Key Dependencies
14+
15+
- **@nx/devkit**: Core Nx development toolkit
16+
- **@swc/core**: Fast TypeScript/JavaScript compiler
17+
- **enquirer**: Interactive CLI prompts
18+
- **node-fetch**: HTTP client for API calls
19+
- **js-yaml**: YAML parsing for configuration
20+
- **xmlbuilder2**: XML generation for build files
21+
22+
## Common Commands
23+
24+
### Development
25+
26+
```bash
27+
# Build all packages
28+
bun build
29+
30+
# Run tests
31+
bun test
32+
33+
# Run linting
34+
bun lint
35+
36+
# Run e2e tests
37+
bun e2e
38+
39+
# Format code
40+
bun format
41+
```
42+
43+
### Nx-specific
44+
45+
```bash
46+
# Build affected packages
47+
bun affected:build
48+
49+
# Test affected packages
50+
bun affected:test
51+
52+
# View dependency graph
53+
bun graph
54+
55+
# Run specific target for all packages
56+
bunx nx run-many --target build --parallel 4
57+
```
58+
59+
### Local Development
60+
61+
```bash
62+
# Start local registry for testing
63+
bun start-local-registry
64+
65+
# Populate local registry with built packages
66+
bunx nx populate-local-registry
67+
68+
# Run smoke tests
69+
bun smoke
70+
```
71+
72+
## Package Structure
73+
74+
- All packages follow `@nxrocks/*` scoping
75+
- Independent versioning with semantic-release
76+
- Workspace protocol for internal dependencies (`workspace:*`)
77+
- ESM modules with TypeScript declaration maps

.vscode/settings.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
{
22
"eslint.validate": ["json"],
3-
"nxConsole.generateAiAgentRules": true
3+
"nxConsole.generateAiAgentRules": true,
4+
"nxConsole.nxWorkspacePath": "",
5+
"github.copilot.chat.agent.terminal.allowList": {
6+
"ls": true,
7+
"cd": true,
8+
"chmod": true,
9+
"echo": true,
10+
"npx": true,
11+
"bunx": true,
12+
"bun": true,
13+
"git": true
14+
}
415
}

.vscode/tasks.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "shell",
6+
"label": "Run Jest test for executor.spec.ts with debug logs",
7+
"command": "bun nx test nx-spring-boot --testFile=src/executors/test/executor.spec.ts",
8+
"group": "test"
9+
}
10+
]
11+
}

0 commit comments

Comments
 (0)