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
16 changes: 6 additions & 10 deletions e2e/cli-generate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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()");
Expand All @@ -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))',
Expand Down Expand Up @@ -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)");
});

Expand Down
38 changes: 31 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
9 changes: 7 additions & 2 deletions src/lib/schematics/abstract.collection.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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[] {
Expand Down
Loading