From b715ca8c507787db14120b77fef66fcbf7f6db8e Mon Sep 17 00:00:00 2001 From: MartinFILLON Date: Mon, 29 Jun 2026 16:25:27 +0200 Subject: [PATCH] fix(schematics): since pnpm v11 we need to resolve the path to schematics ourselves --- e2e/cli-generate.test.ts | 16 ++++------ pnpm-lock.yaml | 38 ++++++++++++++++++----- pnpm-workspace.yaml | 4 +-- src/lib/schematics/abstract.collection.ts | 9 ++++-- 4 files changed, 46 insertions(+), 21 deletions(-) diff --git a/e2e/cli-generate.test.ts b/e2e/cli-generate.test.ts index 3e5d0ac..05d74a9 100644 --- a/e2e/cli-generate.test.ts +++ b/e2e/cli-generate.test.ts @@ -142,10 +142,8 @@ describe("nf generate (TypeScript, no server)", () => { const content = readFileSync(resolve(appDir, "client/main.ts"), "utf-8"); // Component and system imports - expect(content).toContain( - 'import { ExampleComponent } from "./components/example.component.ts"', - ); - expect(content).toContain('import { exampleSystem } from "./systems/example.system.ts"'); + expect(content).toContain('import { ExampleComponent } from "./components/example.component"'); + expect(content).toContain('import { exampleSystem } from "./systems/example.system"'); // Registry access expect(content).toContain("const registry = ecsLibrary.registry"); @@ -189,7 +187,7 @@ describe("nf generate (TypeScript, no server)", () => { const content = readFileSync(resolve(appDir, "client/main.ts"), "utf-8"); - expect(content).toContain('import { HealthComponent } from "./components/health.component.ts"'); + expect(content).toContain('import { HealthComponent } from "./components/health.component"'); expect(content).toContain("new HealthComponent(100)"); expect(content).toContain("const exampleEntity2 = registry.spawnEntity()"); @@ -199,9 +197,7 @@ describe("nf generate (TypeScript, no server)", () => { // Original component should still be present - expect(content).toContain( - 'import { ExampleComponent } from "./components/example.component.ts"', - ); + expect(content).toContain('import { ExampleComponent } from "./components/example.component"'); expect(content).toContain("const exampleEntity = registry.spawnEntity()"); expect(content).toContain( 'registry.addComponent(exampleEntity, new ExampleComponent("example", 10, undefined))', @@ -324,10 +320,10 @@ describe("nf generate (TypeScript, with server)", () => { const content = readFileSync(resolve(appDir, "server/main.ts"), "utf-8"); - expect(content).toContain('import { movementSystem } from "./systems/movement.system.ts"'); + expect(content).toContain('import { movementSystem } from "./systems/movement.system"'); expect(content).toContain("registry.addSystem(movementSystem)"); // Original system should still be present - expect(content).toContain('import { exampleSystem } from "./systems/example.system.ts"'); + expect(content).toContain('import { exampleSystem } from "./systems/example.system"'); expect(content).toContain("registry.addSystem(exampleSystem)"); }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 58da776..776ebcb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -110,8 +110,8 @@ catalogs: specifier: ^21.2.13 version: 21.2.13 '@nanoforge-dev/schematics': - specifier: ^2.1.3 - version: 2.1.3 + specifier: ^2.1.4 + version: 2.1.4 tests: '@vitest/coverage-v8': specifier: ^4.1.8 @@ -141,7 +141,7 @@ importers: version: 1.2.0 '@nanoforge-dev/schematics': specifier: catalog:schematics - version: 2.1.3(chokidar@5.0.0) + version: 2.1.4(chokidar@5.0.0) ansis: specifier: catalog:cli version: 4.3.1 @@ -264,6 +264,15 @@ packages: chokidar: optional: true + '@angular-devkit/core@22.0.4': + resolution: {integrity: sha512-zA2UJSMAU3su5uJTOn5ul/gCLRcw6/uIQ6EC5v/Ju/ePjgDIw9R3y3MAvWQ4Ibi/fXiq0FVxpF8hE7RUclYmJA==} + engines: {node: ^22.22.3 || ^24.15.0 || >=26.0.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} + peerDependencies: + chokidar: ^5.0.0 + peerDependenciesMeta: + chokidar: + optional: true + '@angular-devkit/schematics-cli@21.2.13': resolution: {integrity: sha512-hrA2N8XobOeOoZStExhvgqOaDquHqUuOzexRbQ4dH6wiEYYUPCkEexNChYOWpzicX+lLskzMp5LCszK0xQwDjA==} engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} @@ -798,8 +807,8 @@ packages: resolution: {integrity: sha512-gKFEQFt1+RIQyRzpVyjuaXib4nBLa4g3LNfy9TEMPlXe21IZy346L3RO5PmlVslPAYJuy5chUXfBE+BmE9BedA==} engines: {node: '25'} - '@nanoforge-dev/schematics@2.1.3': - resolution: {integrity: sha512-5o4z+GTQF/dzvkk6UrwtoUrlrjFWQBevvtupCqc0coiLfetU2FUORryFPG1tZhrIP3GPuuYTM/8meTJDs7IMPA==} + '@nanoforge-dev/schematics@2.1.4': + resolution: {integrity: sha512-GYe3j8HTyk8oQ9Bv3N/yQrmj6hNWegosOa3s6V2C/WptKABAntdc7TtTOYXHi8aZylH7ZzPMlpsVe15Z99oTqA==} engines: {node: '25'} '@nanoforge-dev/utils-eslint-config@1.0.2': @@ -2810,6 +2819,17 @@ snapshots: optionalDependencies: chokidar: 5.0.0 + '@angular-devkit/core@22.0.4(chokidar@5.0.0)': + dependencies: + ajv: 8.20.0 + ajv-formats: 3.0.1(ajv@8.20.0) + jsonc-parser: 3.3.1 + picomatch: 4.0.4 + rxjs: 7.8.2 + source-map: 0.7.6 + optionalDependencies: + chokidar: 5.0.0 + '@angular-devkit/schematics-cli@21.2.13(@types/node@25.9.1)(chokidar@5.0.0)': dependencies: '@angular-devkit/core': 21.2.13(chokidar@5.0.0) @@ -3388,9 +3408,9 @@ snapshots: '@nanoforge-dev/loader-website@1.2.0': {} - '@nanoforge-dev/schematics@2.1.3(chokidar@5.0.0)': + '@nanoforge-dev/schematics@2.1.4(chokidar@5.0.0)': dependencies: - '@angular-devkit/core': 21.2.13(chokidar@5.0.0) + '@angular-devkit/core': 22.0.4(chokidar@5.0.0) '@angular-devkit/schematics': 21.2.13(chokidar@5.0.0) rxjs: 7.8.2 transitivePeerDependencies: @@ -3873,6 +3893,10 @@ snapshots: optionalDependencies: ajv: 8.18.0 + ajv-formats@3.0.1(ajv@8.20.0): + optionalDependencies: + ajv: 8.20.0 + ajv@6.15.0: dependencies: fast-deep-equal: 3.1.3 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index baf2e1f..b18f061 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -42,10 +42,10 @@ catalogs: schematics: '@angular-devkit/schematics': ^21.2.13 '@angular-devkit/schematics-cli': ^21.2.13 - '@nanoforge-dev/schematics': ^2.1.3 + '@nanoforge-dev/schematics': ^2.1.4 tests: '@vitest/coverage-v8': ^4.1.8 vitest: ^4.1.8 minimumReleaseAgeExclude: - - '@nanoforge-dev/actions@2.1.2' + - '@nanoforge-dev/schematics@2.1.4' diff --git a/src/lib/schematics/abstract.collection.ts b/src/lib/schematics/abstract.collection.ts index 95d6a2e..232c044 100644 --- a/src/lib/schematics/abstract.collection.ts +++ b/src/lib/schematics/abstract.collection.ts @@ -1,6 +1,7 @@ import { type Runner } from "@lib/runner/runner"; import { getCwd } from "@utils/path"; +import { getModulePath } from "@utils/path"; import { type Schematic } from "./nanoforge.collection"; import { type SchematicOption } from "./schematic.option"; @@ -31,9 +32,13 @@ export abstract class AbstractCollection { private buildCommandLine( name: string, options: SchematicOption[], - flags: string[] = [], + flags: string[] = ["--no-dry-run", "--allow-private", "--no-debug"], ): string[] { - return [`${this.collection}:${name}`, ...flags, ...this.serializeOptions(options)]; + return [ + ...flags, + `'${getModulePath(this.collection + "/collection.json")}:${name}'`, + ...this.serializeOptions(options), + ]; } private serializeOptions(options: SchematicOption[]): string[] {