Skip to content

Commit 9d98d1a

Browse files
authored
fix: use of directory variable and js issues (#84)
1 parent 356c805 commit 9d98d1a

16 files changed

Lines changed: 1091 additions & 784 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"rxjs": "catalog:schematics"
7070
},
7171
"devDependencies": {
72+
"@angular-devkit/schematics-cli": "^21.2.2",
7273
"@commitlint/cli": "catalog:ci",
7374
"@commitlint/config-conventional": "catalog:ci",
7475
"@favware/cliff-jumper": "catalog:ci",

pnpm-lock.yaml

Lines changed: 1008 additions & 743 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@ catalogs:
44
tsup: ^8.5.1
55
typescript: ^5.9.3
66
ci:
7-
'@commitlint/cli': ^20.4.2
8-
'@commitlint/config-conventional': ^20.4.2
7+
'@commitlint/cli': ^20.4.4
8+
'@commitlint/config-conventional': ^20.4.4
99
'@favware/cliff-jumper': ^6.0.0
10-
'@nanoforge-dev/actions': ^1.1.0
10+
'@nanoforge-dev/actions': ^1.2.3
1111
husky: ^9.1.7
12-
lint-staged: ^16.2.7
12+
lint-staged: ^16.4.0
1313
core:
14-
'@types/node': ^25.3.2
14+
'@types/node': ^25.5.0
1515
lint:
1616
'@nanoforge-dev/utils-eslint-config': ^1.0.2
1717
'@nanoforge-dev/utils-prettier-config': ^1.0.2
1818
'@trivago/prettier-plugin-sort-imports': ^6.0.2
19-
eslint: ^10.0.2
19+
eslint: ^10.0.3
2020
prettier: ^3.8.1
2121
schematics:
22-
'@angular-devkit/core': ^21.2.0
23-
'@angular-devkit/schematics': ^21.2.0
22+
'@angular-devkit/core': ^21.2.2
23+
'@angular-devkit/schematics': ^21.2.2
2424
rxjs: ^7.8.2
2525
tests:
26-
'@vitest/coverage-v8': ^4.0.18
27-
vitest: ^4.0.18
26+
'@vitest/coverage-v8': ^4.1.0
27+
vitest: ^4.1.0
2828

2929
onlyBuiltDependencies:
3030
- esbuild

src/libs/application/application.factory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type Path, join, strings } from "@angular-devkit/core";
1+
import { type Path, join, normalize, strings } from "@angular-devkit/core";
22
import {
33
type Rule,
44
type SchematicContext,
@@ -49,7 +49,7 @@ const generate = (options: ApplicationOptions, path: string): Source => {
4949
...strings,
5050
...options,
5151
}),
52-
move(path),
52+
move(normalize(path)),
5353
]);
5454
};
5555

src/libs/configuration/configuration.factory.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type Path, join, strings } from "@angular-devkit/core";
1+
import { type Path, join, normalize, strings } from "@angular-devkit/core";
22
import {
33
type Rule,
44
type Source,
@@ -14,20 +14,24 @@ import {
1414

1515
import { ConfigDeclarator } from "@utils/config/config.declarator";
1616
import { ConfigFinder } from "@utils/config/config.finder";
17-
import { toKebabCase } from "@utils/formatting";
18-
import { resolvePackageName } from "@utils/name";
19-
20-
import { DEFAULT_APP_NAME } from "~/defaults";
2117

2218
import { type ConfigurationOptions } from "./configuration.options";
2319
import { type ConfigurationSchema } from "./configuration.schema";
2420

2521
const transform = (schema: ConfigurationSchema): ConfigurationOptions => {
26-
return {
22+
const res: ConfigurationOptions = {
2723
server: {
2824
enable: schema.server ?? false,
2925
},
3026
};
27+
28+
if (schema.language === "js") {
29+
res["client"] = { build: { entryFile: "client/main.js" } };
30+
if (schema.server && "server" in res && res.server)
31+
res.server["build"] = { entryFile: "server/main.js" };
32+
}
33+
34+
return res;
3135
};
3236

3337
const generate = (options: ConfigurationOptions, path: string): Source => {
@@ -36,7 +40,7 @@ const generate = (options: ConfigurationOptions, path: string): Source => {
3640
...strings,
3741
...options,
3842
}),
39-
move(path),
43+
move(normalize(path)),
4044
]);
4145
};
4246

@@ -57,9 +61,7 @@ const addConfiguration = (options: ConfigurationOptions, path: Path) => {
5761

5862
export const main = (schema: ConfigurationSchema): Rule => {
5963
const options = transform(schema);
60-
const directory =
61-
schema.directory ??
62-
resolvePackageName(toKebabCase(schema.name?.toString() ?? DEFAULT_APP_NAME));
64+
const directory = schema.directory ?? schema.name;
6365

6466
return branchAndMerge(
6567
chain([mergeWith(generate(options, directory)), addConfiguration(options, directory as Path)]),

src/libs/configuration/configuration.schema.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,9 @@ export interface ConfigurationSchema {
1313
* Configure a server for the application
1414
*/
1515
server?: boolean;
16+
17+
/**
18+
* NanoForge Application language
19+
*/
20+
language?: "js" | "ts";
1621
}

src/libs/configuration/schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
"type": "boolean",
2222
"description": "Server configuration",
2323
"default": false
24+
},
25+
"language": {
26+
"type": "string",
27+
"enum": ["ts", "js"],
28+
"description": "NanoForge application language",
29+
"default": "ts"
2430
}
2531
},
2632
"required": ["name"]

src/libs/docker/docker.factory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type Path, strings } from "@angular-devkit/core";
1+
import { type Path, normalize, strings } from "@angular-devkit/core";
22
import {
33
type Rule,
44
type Source,
@@ -33,7 +33,7 @@ const generate = (options: DockerOptions, path: string): Source => {
3333
...strings,
3434
...options,
3535
}),
36-
move(path),
36+
move(normalize(path)),
3737
]);
3838
};
3939

src/libs/part-base/files/js/__nanoforgeFolder__/client.save.json

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
{
1111
"id": "ecsLibrary",
1212
"type": "component-system",
13-
"name": "ECSLibrary",
14-
"path": "@nanoforge-dev/ecs",
15-
"params": ["\"client\""]
13+
"name": "ECSClientLibrary",
14+
"path": "@nanoforge-dev/ecs-client",
15+
"params": []
1616
},
1717
{
1818
"id": "graphicsLibrary",
@@ -34,7 +34,14 @@
3434
"name": "MusicLibrary",
3535
"path": "@nanoforge-dev/music",
3636
"params": []
37-
},<%= !server ? "" : "\n {\n \"id\": \"networkLibrary\",\n \"type\": \"network\",\n \"name\": \"NetworkClientLibrary\",\n \"path\": \"@nanoforge-dev/network-client\",\n \"params\": []\n }," %>
37+
},<% if (server) { %>
38+
{
39+
"id": "networkLibrary",
40+
"type": "network",
41+
"name": "NetworkClientLibrary",
42+
"path": "@nanoforge-dev/network-client",
43+
"params": []
44+
},<% } %>
3845
{
3946
"id": "soundLibrary",
4047
"type": "sound",

src/libs/part-base/files/js/__nanoforgeFolder__/server.save.json

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,17 @@
1010
{
1111
"id": "ecsLibrary",
1212
"type": "component-system",
13-
"name": "ECSLibrary",
14-
"path": "@nanoforge-dev/ecs",
15-
"params": ["\"server\""]
16-
}<%= !server ? "" : ",\n {\n \"id\": \"networkLibrary\",\n \"type\": \"network\",\n \"name\": \"NetworkServerLibrary\",\n \"path\": \"@nanoforge-dev/network-server\",\n \"params\": []\n }" %>
13+
"name": "ECSServerLibrary",
14+
"path": "@nanoforge-dev/ecs-server",
15+
"params": []
16+
}<% if (server) { %>,
17+
{
18+
"id": "networkLibrary",
19+
"type": "network",
20+
"name": "NetworkServerLibrary",
21+
"path": "@nanoforge-dev/network-server",
22+
"params": []
23+
}<% } %>
1724
],
1825
"components": [
1926
{

0 commit comments

Comments
 (0)