@nanoforge-dev/schematics 2.1.2 → 2.1.4-beta.131e794

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +3 -0
  2. package/dist/index.cjs +15 -46
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +3 -1
  5. package/dist/index.d.cts.map +1 -0
  6. package/dist/index.d.ts +3 -1
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +10 -15
  9. package/dist/index.js.map +1 -1
  10. package/dist/libs/application/application.factory.d.ts +10 -13
  11. package/dist/libs/application/application.factory.d.ts.map +1 -0
  12. package/dist/libs/application/application.factory.js +52 -68
  13. package/dist/libs/application/application.factory.js.map +1 -1
  14. package/dist/libs/application/files/js/README.md +165 -0
  15. package/dist/libs/application/files/js/__dot__env +6 -0
  16. package/dist/libs/application/files/js/__dot__gitignore +134 -0
  17. package/dist/libs/application/files/ts/README.md +165 -0
  18. package/dist/libs/application/files/ts/__dot__env +6 -0
  19. package/dist/libs/application/files/ts/__dot__gitignore +134 -0
  20. package/dist/libs/application/schema.json +5 -0
  21. package/dist/libs/component/component.factory.d.ts +6 -6
  22. package/dist/libs/component/component.factory.d.ts.map +1 -0
  23. package/dist/libs/component/component.factory.js +32 -47
  24. package/dist/libs/component/component.factory.js.map +1 -1
  25. package/dist/libs/component/files/js/__fileName__.component.js +21 -27
  26. package/dist/libs/component/files/ts/__fileName__.component.ts +21 -27
  27. package/dist/libs/configuration/configuration.factory.d.ts +6 -7
  28. package/dist/libs/configuration/configuration.factory.d.ts.map +1 -0
  29. package/dist/libs/configuration/configuration.factory.js +91 -133
  30. package/dist/libs/configuration/configuration.factory.js.map +1 -1
  31. package/dist/libs/docker/docker.factory.d.ts +6 -4
  32. package/dist/libs/docker/docker.factory.d.ts.map +1 -0
  33. package/dist/libs/docker/docker.factory.js +17 -36
  34. package/dist/libs/docker/docker.factory.js.map +1 -1
  35. package/dist/libs/part-base/files/js/__nanoforgeFolder__/client.save.json +2 -2
  36. package/dist/libs/part-base/files/js/__nanoforgeFolder__/server.save.json +2 -2
  37. package/dist/libs/part-base/files/js/__part__/components/example.component.js +21 -27
  38. package/dist/libs/part-base/files/ts/__nanoforgeFolder__/client.save.json +2 -2
  39. package/dist/libs/part-base/files/ts/__nanoforgeFolder__/server.save.json +2 -2
  40. package/dist/libs/part-base/files/ts/__part__/components/example.component.ts +21 -27
  41. package/dist/libs/part-base/part-base.factory.d.ts +6 -7
  42. package/dist/libs/part-base/part-base.factory.d.ts.map +1 -0
  43. package/dist/libs/part-base/part-base.factory.js +30 -41
  44. package/dist/libs/part-base/part-base.factory.js.map +1 -1
  45. package/dist/libs/part-main/part-main.factory.d.ts +6 -9
  46. package/dist/libs/part-main/part-main.factory.d.ts.map +1 -0
  47. package/dist/libs/part-main/part-main.factory.js +228 -260
  48. package/dist/libs/part-main/part-main.factory.js.map +1 -1
  49. package/dist/libs/system/system.factory.d.ts +6 -6
  50. package/dist/libs/system/system.factory.d.ts.map +1 -0
  51. package/dist/libs/system/system.factory.js +32 -50
  52. package/dist/libs/system/system.factory.js.map +1 -1
  53. package/package.json +18 -18
package/README.md CHANGED
@@ -42,6 +42,9 @@ This repository provide multiples schematics, usable with Angular Devkit schemat
42
42
  - `configuration` : Template of `nanoforge.config.json` with premade fields
43
43
  - `part-base` : Base of Nanoforge client or server
44
44
  - `part-main` : Client or server `main.ts` from a config
45
+ - `component` : ECS component class for a client or server part
46
+ - `system` : ECS system function for a client or server part
47
+ - `docker` : Dockerfile and `.dockerignore` tailored to your package manager
45
48
 
46
49
  ## Contributing
47
50
 
package/dist/index.cjs CHANGED
@@ -1,48 +1,17 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/defaults.ts
3
+ const DEFAULT_APP_NAME = "nanoforge-app";
4
+ const DEFAULT_VERSION = "0.0.0";
5
+ const DEFAULT_AUTHOR = "";
6
+ const DEFAULT_DESCRIPTION = "";
7
+ const DEFAULT_LANGUAGE = "ts";
8
+ const DEFAULT_PACKAGE_MANAGER = "npm";
9
+ //#endregion
10
+ exports.DEFAULT_APP_NAME = DEFAULT_APP_NAME;
11
+ exports.DEFAULT_AUTHOR = DEFAULT_AUTHOR;
12
+ exports.DEFAULT_DESCRIPTION = DEFAULT_DESCRIPTION;
13
+ exports.DEFAULT_LANGUAGE = DEFAULT_LANGUAGE;
14
+ exports.DEFAULT_PACKAGE_MANAGER = DEFAULT_PACKAGE_MANAGER;
15
+ exports.DEFAULT_VERSION = DEFAULT_VERSION;
19
16
 
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- DEFAULT_APP_NAME: () => DEFAULT_APP_NAME,
24
- DEFAULT_AUTHOR: () => DEFAULT_AUTHOR,
25
- DEFAULT_DESCRIPTION: () => DEFAULT_DESCRIPTION,
26
- DEFAULT_LANGUAGE: () => DEFAULT_LANGUAGE,
27
- DEFAULT_PACKAGE_MANAGER: () => DEFAULT_PACKAGE_MANAGER,
28
- DEFAULT_VERSION: () => DEFAULT_VERSION
29
- });
30
- module.exports = __toCommonJS(index_exports);
31
-
32
- // src/defaults.ts
33
- var DEFAULT_APP_NAME = "nanoforge-app";
34
- var DEFAULT_VERSION = "0.0.0";
35
- var DEFAULT_AUTHOR = "";
36
- var DEFAULT_DESCRIPTION = "";
37
- var DEFAULT_LANGUAGE = "ts";
38
- var DEFAULT_PACKAGE_MANAGER = "npm";
39
- // Annotate the CommonJS export names for ESM import in node:
40
- 0 && (module.exports = {
41
- DEFAULT_APP_NAME,
42
- DEFAULT_AUTHOR,
43
- DEFAULT_DESCRIPTION,
44
- DEFAULT_LANGUAGE,
45
- DEFAULT_PACKAGE_MANAGER,
46
- DEFAULT_VERSION
47
- });
48
17
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/defaults.ts"],"sourcesContent":["export * from \"./defaults\";\n","export const DEFAULT_APP_NAME = \"nanoforge-app\";\nexport const DEFAULT_VERSION = \"0.0.0\";\nexport const DEFAULT_AUTHOR = \"\";\nexport const DEFAULT_DESCRIPTION = \"\";\nexport const DEFAULT_LANGUAGE = \"ts\";\nexport const DEFAULT_PACKAGE_MANAGER = \"npm\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,mBAAmB;AACzB,IAAM,kBAAkB;AACxB,IAAM,iBAAiB;AACvB,IAAM,sBAAsB;AAC5B,IAAM,mBAAmB;AACzB,IAAM,0BAA0B;","names":[]}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/defaults.ts"],"sourcesContent":["export const DEFAULT_APP_NAME = \"nanoforge-app\";\nexport const DEFAULT_VERSION = \"0.0.0\";\nexport const DEFAULT_AUTHOR = \"\";\nexport const DEFAULT_DESCRIPTION = \"\";\nexport const DEFAULT_LANGUAGE = \"ts\";\nexport const DEFAULT_PACKAGE_MANAGER = \"npm\";\n"],"mappings":";;AAAA,MAAa,mBAAmB;AAChC,MAAa,kBAAkB;AAC/B,MAAa,iBAAiB;AAC9B,MAAa,sBAAsB;AACnC,MAAa,mBAAmB;AAChC,MAAa,0BAA0B"}
package/dist/index.d.cts CHANGED
@@ -1,8 +1,10 @@
1
+ //#region src/defaults.d.ts
1
2
  declare const DEFAULT_APP_NAME = "nanoforge-app";
2
3
  declare const DEFAULT_VERSION = "0.0.0";
3
4
  declare const DEFAULT_AUTHOR = "";
4
5
  declare const DEFAULT_DESCRIPTION = "";
5
6
  declare const DEFAULT_LANGUAGE = "ts";
6
7
  declare const DEFAULT_PACKAGE_MANAGER = "npm";
7
-
8
+ //#endregion
8
9
  export { DEFAULT_APP_NAME, DEFAULT_AUTHOR, DEFAULT_DESCRIPTION, DEFAULT_LANGUAGE, DEFAULT_PACKAGE_MANAGER, DEFAULT_VERSION };
10
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/defaults.ts"],"mappings":";cAAa,gBAAA;AAAA,cACA,eAAA;AAAA,cACA,cAAA;AAAA,cACA,mBAAA;AAAA,cACA,gBAAA;AAAA,cACA,uBAAA"}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,10 @@
1
+ //#region src/defaults.d.ts
1
2
  declare const DEFAULT_APP_NAME = "nanoforge-app";
2
3
  declare const DEFAULT_VERSION = "0.0.0";
3
4
  declare const DEFAULT_AUTHOR = "";
4
5
  declare const DEFAULT_DESCRIPTION = "";
5
6
  declare const DEFAULT_LANGUAGE = "ts";
6
7
  declare const DEFAULT_PACKAGE_MANAGER = "npm";
7
-
8
+ //#endregion
8
9
  export { DEFAULT_APP_NAME, DEFAULT_AUTHOR, DEFAULT_DESCRIPTION, DEFAULT_LANGUAGE, DEFAULT_PACKAGE_MANAGER, DEFAULT_VERSION };
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/defaults.ts"],"mappings":";cAAa,gBAAA;AAAA,cACA,eAAA;AAAA,cACA,cAAA;AAAA,cACA,mBAAA;AAAA,cACA,gBAAA;AAAA,cACA,uBAAA"}
package/dist/index.js CHANGED
@@ -1,16 +1,11 @@
1
- // src/defaults.ts
2
- var DEFAULT_APP_NAME = "nanoforge-app";
3
- var DEFAULT_VERSION = "0.0.0";
4
- var DEFAULT_AUTHOR = "";
5
- var DEFAULT_DESCRIPTION = "";
6
- var DEFAULT_LANGUAGE = "ts";
7
- var DEFAULT_PACKAGE_MANAGER = "npm";
8
- export {
9
- DEFAULT_APP_NAME,
10
- DEFAULT_AUTHOR,
11
- DEFAULT_DESCRIPTION,
12
- DEFAULT_LANGUAGE,
13
- DEFAULT_PACKAGE_MANAGER,
14
- DEFAULT_VERSION
15
- };
1
+ //#region src/defaults.ts
2
+ const DEFAULT_APP_NAME = "nanoforge-app";
3
+ const DEFAULT_VERSION = "0.0.0";
4
+ const DEFAULT_AUTHOR = "";
5
+ const DEFAULT_DESCRIPTION = "";
6
+ const DEFAULT_LANGUAGE = "ts";
7
+ const DEFAULT_PACKAGE_MANAGER = "npm";
8
+ //#endregion
9
+ export { DEFAULT_APP_NAME, DEFAULT_AUTHOR, DEFAULT_DESCRIPTION, DEFAULT_LANGUAGE, DEFAULT_PACKAGE_MANAGER, DEFAULT_VERSION };
10
+
16
11
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/defaults.ts"],"sourcesContent":["export const DEFAULT_APP_NAME = \"nanoforge-app\";\nexport const DEFAULT_VERSION = \"0.0.0\";\nexport const DEFAULT_AUTHOR = \"\";\nexport const DEFAULT_DESCRIPTION = \"\";\nexport const DEFAULT_LANGUAGE = \"ts\";\nexport const DEFAULT_PACKAGE_MANAGER = \"npm\";\n"],"mappings":";AAAO,IAAM,mBAAmB;AACzB,IAAM,kBAAkB;AACxB,IAAM,iBAAiB;AACvB,IAAM,sBAAsB;AAC5B,IAAM,mBAAmB;AACzB,IAAM,0BAA0B;","names":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/defaults.ts"],"sourcesContent":["export const DEFAULT_APP_NAME = \"nanoforge-app\";\nexport const DEFAULT_VERSION = \"0.0.0\";\nexport const DEFAULT_AUTHOR = \"\";\nexport const DEFAULT_DESCRIPTION = \"\";\nexport const DEFAULT_LANGUAGE = \"ts\";\nexport const DEFAULT_PACKAGE_MANAGER = \"npm\";\n"],"mappings":";AAAA,MAAa,mBAAmB;AAChC,MAAa,kBAAkB;AAC/B,MAAa,iBAAiB;AAC9B,MAAa,sBAAsB;AACnC,MAAa,mBAAmB;AAChC,MAAa,0BAA0B"}
@@ -1,62 +1,59 @@
1
- import { Rule } from '@angular-devkit/schematics';
1
+ import { Rule } from "@angular-devkit/schematics";
2
2
 
3
+ //#region src/libs/application/application.schema.d.ts
3
4
  interface ApplicationSchema {
4
5
  /**
5
6
  * NanoForge application name
6
7
  */
7
8
  name: string;
8
-
9
9
  /**
10
10
  * NanoForge application version
11
11
  */
12
12
  version?: string;
13
-
14
13
  /**
15
14
  * NanoForge application author
16
15
  */
17
16
  author?: string;
18
-
19
17
  /**
20
18
  * NanoForge application description
21
19
  */
22
20
  description?: string;
23
-
24
21
  /**
25
22
  * NanoForge application destination directory
26
23
  */
27
24
  directory?: string;
28
-
29
25
  /**
30
26
  * NanoForge Application language
31
27
  */
32
28
  language?: "js" | "ts";
33
-
34
29
  /**
35
30
  * With strict mode (TypeScript or JavaScript but only on compatible editor)
36
31
  */
37
32
  strict?: boolean;
38
-
39
33
  /**
40
34
  * Generate lint files
41
35
  */
42
36
  lint?: boolean;
43
-
44
37
  /**
45
38
  * The used package manager
46
39
  */
47
40
  packageManager?: "npm" | "yarn" | "pnpm" | "bun";
48
-
49
41
  /**
50
42
  * Configure a server for the application
51
43
  */
52
44
  server?: boolean;
53
-
54
45
  /**
55
46
  * Add editor dependencies
56
47
  */
57
48
  editor: boolean;
49
+ /**
50
+ * Add init functions to the application
51
+ */
52
+ initFunctions: boolean;
58
53
  }
59
-
54
+ //#endregion
55
+ //#region src/libs/application/application.factory.d.ts
60
56
  declare const main: (schema: ApplicationSchema) => Rule;
61
-
57
+ //#endregion
62
58
  export { main };
59
+ //# sourceMappingURL=application.factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.factory.d.ts","names":["name","version","author","description","directory","language","strict","lint","packageManager","server","editor","initFunctions"],"sources":["../../../src/libs/application/application.schema.d.ts","../../../src/libs/application/application.factory.ts"],"mappings":";;;UAAiB,iBAAA;;;AAAjB;EAIEA,IAAAA;EAJgC;;;EAShCC,OAAAA;EAeAG;;;EAVAF,MAAAA;EAmCAO;;;EA9BAN,WAAAA;;;;EAKAC,SAAAA;;;;EAKAC,QAAAA;ECqDD;AAAA;;EDhDCC,MAAAA;;;;EAKAC,IAAAA;;;;EAKAC,cAAAA;;;;EAKAC,MAAAA;;;;EAKAC,MAAAA;;;;EAKAC,aAAAA;AAAAA;;;cCJW,IAAA,GAAQ,MAAA,EAAQ,iBAAA,KAAoB,IA2BhD"}
@@ -1,72 +1,56 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // src/libs/application/application.factory.ts
5
1
  import { join, normalize, strings } from "@angular-devkit/core";
6
- import {
7
- apply,
8
- mergeWith,
9
- move,
10
- renameTemplateFiles,
11
- template,
12
- url
13
- } from "@angular-devkit/schematics";
2
+ import { apply, mergeWith, move, renameTemplateFiles, template, url } from "@angular-devkit/schematics";
14
3
  import { firstValueFrom } from "rxjs";
15
-
16
- // src/defaults.ts
17
- var DEFAULT_APP_NAME = "nanoforge-app";
18
- var DEFAULT_VERSION = "0.0.0";
19
- var DEFAULT_AUTHOR = "";
20
- var DEFAULT_DESCRIPTION = "";
21
- var DEFAULT_LANGUAGE = "ts";
22
- var DEFAULT_PACKAGE_MANAGER = "npm";
23
-
24
- // src/libs/application/application.factory.ts
25
- var transform = /* @__PURE__ */ __name((schema) => {
26
- return {
27
- name: schema.name ?? DEFAULT_APP_NAME,
28
- version: schema.version ?? DEFAULT_VERSION,
29
- author: schema.author ?? DEFAULT_AUTHOR,
30
- description: schema.description ?? DEFAULT_DESCRIPTION,
31
- language: schema.language ?? DEFAULT_LANGUAGE,
32
- strict: schema.strict ?? true,
33
- lint: schema.lint ?? true,
34
- packageManager: schema.packageManager ?? DEFAULT_PACKAGE_MANAGER,
35
- server: schema.server ?? false,
36
- editor: schema.editor ?? false
37
- };
38
- }, "transform");
39
- var generate = /* @__PURE__ */ __name((options, path) => {
40
- return apply(url(join("./files", options.language)), [
41
- template({
42
- ...strings,
43
- ...options
44
- }),
45
- renameTemplateFiles(),
46
- move(normalize(path))
47
- ]);
48
- }, "generate");
49
- var main = /* @__PURE__ */ __name((schema) => {
50
- const options = transform(schema);
51
- const path = schema.directory ?? options.name;
52
- return async (baseTree, context) => {
53
- let tree = await mergeWith(generate(options, path))(baseTree, context);
54
- if (!tree) return tree;
55
- if (!("delete" in tree)) {
56
- if (typeof tree === "function") return tree;
57
- tree = await firstValueFrom(tree);
58
- }
59
- if (!options.lint) {
60
- const basePath = join("/", path);
61
- tree.delete(join(basePath, "eslint.config.js"));
62
- tree.delete(join(basePath, "prettier.config.js"));
63
- tree.delete(join(basePath, ".prettierignore"));
64
- if (options.language === "js") tree.delete(join(basePath, "jsconfig.json"));
65
- }
66
- return tree;
67
- };
68
- }, "main");
69
- export {
70
- main
4
+ //#endregion
5
+ //#region src/libs/application/application.factory.ts
6
+ const transform = (schema) => {
7
+ return {
8
+ name: schema.name ?? "nanoforge-app",
9
+ version: schema.version ?? "0.0.0",
10
+ author: schema.author ?? "",
11
+ description: schema.description ?? "",
12
+ language: schema.language ?? "ts",
13
+ strict: schema.strict ?? true,
14
+ lint: schema.lint ?? true,
15
+ packageManager: schema.packageManager ?? "npm",
16
+ server: schema.server ?? false,
17
+ editor: schema.editor ?? false,
18
+ initFunctions: schema.initFunctions ?? false
19
+ };
71
20
  };
21
+ const generate = (options, path) => {
22
+ return apply(url(join("./files", options.language)), [
23
+ template({
24
+ dot: ".",
25
+ ...strings,
26
+ ...options
27
+ }),
28
+ renameTemplateFiles(),
29
+ move(normalize(path))
30
+ ]);
31
+ };
32
+ const main = (schema) => {
33
+ const options = transform(schema);
34
+ const path = schema.directory ?? options.name;
35
+ return async (baseTree, context) => {
36
+ let tree = await mergeWith(generate(options, path))(baseTree, context);
37
+ if (!tree) return tree;
38
+ if (!("delete" in tree)) {
39
+ if (typeof tree === "function") return tree;
40
+ tree = await firstValueFrom(tree);
41
+ }
42
+ const basePath = join("/", path);
43
+ if (!options.lint) {
44
+ tree.delete(join(basePath, "eslint.config.js"));
45
+ tree.delete(join(basePath, "prettier.config.js"));
46
+ tree.delete(join(basePath, ".prettierignore"));
47
+ if (options.language === "js") tree.delete(join(basePath, "jsconfig.json"));
48
+ }
49
+ if (!options.server) tree.delete(join(basePath, ".env"));
50
+ return tree;
51
+ };
52
+ };
53
+ //#endregion
54
+ export { main };
55
+
72
56
  //# sourceMappingURL=application.factory.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/libs/application/application.factory.ts","../../../src/defaults.ts"],"sourcesContent":["import { type Path, join, normalize, strings } from \"@angular-devkit/core\";\nimport {\n type Rule,\n type SchematicContext,\n type Source,\n type Tree,\n apply,\n mergeWith,\n move,\n renameTemplateFiles,\n template,\n url,\n} from \"@angular-devkit/schematics\";\nimport { firstValueFrom } from \"rxjs\";\n\nimport {\n DEFAULT_APP_NAME,\n DEFAULT_AUTHOR,\n DEFAULT_DESCRIPTION,\n DEFAULT_LANGUAGE,\n DEFAULT_PACKAGE_MANAGER,\n DEFAULT_VERSION,\n} from \"~/defaults\";\n\nimport { type ApplicationOptions } from \"./application.options\";\nimport { type ApplicationSchema } from \"./application.schema\";\n\nconst transform = (schema: ApplicationSchema): ApplicationOptions => {\n return {\n name: schema.name ?? DEFAULT_APP_NAME,\n version: schema.version ?? DEFAULT_VERSION,\n author: schema.author ?? DEFAULT_AUTHOR,\n description: schema.description ?? DEFAULT_DESCRIPTION,\n language: schema.language ?? DEFAULT_LANGUAGE,\n strict: schema.strict ?? true,\n lint: schema.lint ?? true,\n packageManager: schema.packageManager ?? DEFAULT_PACKAGE_MANAGER,\n server: schema.server ?? false,\n editor: schema.editor ?? false,\n };\n};\n\nconst generate = (options: ApplicationOptions, path: string): Source => {\n return apply(url(join(\"./files\" as Path, options.language)), [\n template({\n ...strings,\n ...options,\n }),\n renameTemplateFiles(),\n move(normalize(path)),\n ]);\n};\n\nexport const main = (schema: ApplicationSchema): Rule => {\n const options = transform(schema);\n const path = schema.directory ?? options.name;\n\n return async (baseTree: Tree, context: SchematicContext) => {\n let tree = await mergeWith(generate(options, path))(baseTree, context);\n if (!tree) return tree;\n if (!(\"delete\" in tree)) {\n if (typeof tree === \"function\") return tree;\n tree = await firstValueFrom(tree);\n }\n\n if (!options.lint) {\n const basePath = join(\"/\" as Path, path);\n tree.delete(join(basePath, \"eslint.config.js\"));\n tree.delete(join(basePath, \"prettier.config.js\"));\n tree.delete(join(basePath, \".prettierignore\"));\n if (options.language === \"js\") tree.delete(join(basePath, \"jsconfig.json\"));\n }\n\n return tree;\n };\n};\n","export const DEFAULT_APP_NAME = \"nanoforge-app\";\nexport const DEFAULT_VERSION = \"0.0.0\";\nexport const DEFAULT_AUTHOR = \"\";\nexport const DEFAULT_DESCRIPTION = \"\";\nexport const DEFAULT_LANGUAGE = \"ts\";\nexport const DEFAULT_PACKAGE_MANAGER = \"npm\";\n"],"mappings":";;;;AAAA,SAAoB,MAAM,WAAW,eAAe;AACpD;AAAA,EAKE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;;;ACbxB,IAAM,mBAAmB;AACzB,IAAM,kBAAkB;AACxB,IAAM,iBAAiB;AACvB,IAAM,sBAAsB;AAC5B,IAAM,mBAAmB;AACzB,IAAM,0BAA0B;;;ADsBvC,IAAM,YAAY,wBAAC,WAAkD;AACnE,SAAO;AAAA,IACL,MAAM,OAAO,QAAQ;AAAA,IACrB,SAAS,OAAO,WAAW;AAAA,IAC3B,QAAQ,OAAO,UAAU;AAAA,IACzB,aAAa,OAAO,eAAe;AAAA,IACnC,UAAU,OAAO,YAAY;AAAA,IAC7B,QAAQ,OAAO,UAAU;AAAA,IACzB,MAAM,OAAO,QAAQ;AAAA,IACrB,gBAAgB,OAAO,kBAAkB;AAAA,IACzC,QAAQ,OAAO,UAAU;AAAA,IACzB,QAAQ,OAAO,UAAU;AAAA,EAC3B;AACF,GAbkB;AAelB,IAAM,WAAW,wBAAC,SAA6B,SAAyB;AACtE,SAAO,MAAM,IAAI,KAAK,WAAmB,QAAQ,QAAQ,CAAC,GAAG;AAAA,IAC3D,SAAS;AAAA,MACP,GAAG;AAAA,MACH,GAAG;AAAA,IACL,CAAC;AAAA,IACD,oBAAoB;AAAA,IACpB,KAAK,UAAU,IAAI,CAAC;AAAA,EACtB,CAAC;AACH,GATiB;AAWV,IAAM,OAAO,wBAAC,WAAoC;AACvD,QAAM,UAAU,UAAU,MAAM;AAChC,QAAM,OAAO,OAAO,aAAa,QAAQ;AAEzC,SAAO,OAAO,UAAgB,YAA8B;AAC1D,QAAI,OAAO,MAAM,UAAU,SAAS,SAAS,IAAI,CAAC,EAAE,UAAU,OAAO;AACrE,QAAI,CAAC,KAAM,QAAO;AAClB,QAAI,EAAE,YAAY,OAAO;AACvB,UAAI,OAAO,SAAS,WAAY,QAAO;AACvC,aAAO,MAAM,eAAe,IAAI;AAAA,IAClC;AAEA,QAAI,CAAC,QAAQ,MAAM;AACjB,YAAM,WAAW,KAAK,KAAa,IAAI;AACvC,WAAK,OAAO,KAAK,UAAU,kBAAkB,CAAC;AAC9C,WAAK,OAAO,KAAK,UAAU,oBAAoB,CAAC;AAChD,WAAK,OAAO,KAAK,UAAU,iBAAiB,CAAC;AAC7C,UAAI,QAAQ,aAAa,KAAM,MAAK,OAAO,KAAK,UAAU,eAAe,CAAC;AAAA,IAC5E;AAEA,WAAO;AAAA,EACT;AACF,GAtBoB;","names":[]}
1
+ {"version":3,"file":"application.factory.js","names":[],"sources":["../../../src/defaults.ts","../../../src/libs/application/application.factory.ts"],"sourcesContent":["export const DEFAULT_APP_NAME = \"nanoforge-app\";\nexport const DEFAULT_VERSION = \"0.0.0\";\nexport const DEFAULT_AUTHOR = \"\";\nexport const DEFAULT_DESCRIPTION = \"\";\nexport const DEFAULT_LANGUAGE = \"ts\";\nexport const DEFAULT_PACKAGE_MANAGER = \"npm\";\n","import { type Path, join, normalize, strings } from \"@angular-devkit/core\";\nimport {\n type Rule,\n type SchematicContext,\n type Source,\n type Tree,\n apply,\n mergeWith,\n move,\n renameTemplateFiles,\n template,\n url,\n} from \"@angular-devkit/schematics\";\nimport { firstValueFrom } from \"rxjs\";\n\nimport {\n DEFAULT_APP_NAME,\n DEFAULT_AUTHOR,\n DEFAULT_DESCRIPTION,\n DEFAULT_LANGUAGE,\n DEFAULT_PACKAGE_MANAGER,\n DEFAULT_VERSION,\n} from \"~/defaults\";\n\nimport { type ApplicationOptions } from \"./application.options\";\nimport { type ApplicationSchema } from \"./application.schema\";\n\nconst transform = (schema: ApplicationSchema): ApplicationOptions => {\n return {\n name: schema.name ?? DEFAULT_APP_NAME,\n version: schema.version ?? DEFAULT_VERSION,\n author: schema.author ?? DEFAULT_AUTHOR,\n description: schema.description ?? DEFAULT_DESCRIPTION,\n language: schema.language ?? DEFAULT_LANGUAGE,\n strict: schema.strict ?? true,\n lint: schema.lint ?? true,\n packageManager: schema.packageManager ?? DEFAULT_PACKAGE_MANAGER,\n server: schema.server ?? false,\n editor: schema.editor ?? false,\n initFunctions: schema.initFunctions ?? false,\n };\n};\n\nconst generate = (options: ApplicationOptions, path: string): Source => {\n return apply(url(join(\"./files\" as Path, options.language)), [\n template({\n dot: \".\",\n ...strings,\n ...options,\n }),\n renameTemplateFiles(),\n move(normalize(path)),\n ]);\n};\n\nexport const main = (schema: ApplicationSchema): Rule => {\n const options = transform(schema);\n const path = schema.directory ?? options.name;\n\n return async (baseTree: Tree, context: SchematicContext) => {\n let tree = await mergeWith(generate(options, path))(baseTree, context);\n if (!tree) return tree;\n if (!(\"delete\" in tree)) {\n if (typeof tree === \"function\") return tree;\n tree = await firstValueFrom(tree);\n }\n\n const basePath = join(\"/\" as Path, path);\n\n if (!options.lint) {\n tree.delete(join(basePath, \"eslint.config.js\"));\n tree.delete(join(basePath, \"prettier.config.js\"));\n tree.delete(join(basePath, \".prettierignore\"));\n if (options.language === \"js\") tree.delete(join(basePath, \"jsconfig.json\"));\n }\n\n if (!options.server) {\n tree.delete(join(basePath, \".env\"));\n }\n\n return tree;\n };\n};\n"],"mappings":";;;;;AC2BA,MAAM,aAAa,WAAkD;CACnE,OAAO;EACL,MAAM,OAAO,QAAA;EACb,SAAS,OAAO,WAAA;EAChB,QAAQ,OAAO,UAAA;EACf,aAAa,OAAO,eAAA;EACpB,UAAU,OAAO,YAAA;EACjB,QAAQ,OAAO,UAAU;EACzB,MAAM,OAAO,QAAQ;EACrB,gBAAgB,OAAO,kBAAA;EACvB,QAAQ,OAAO,UAAU;EACzB,QAAQ,OAAO,UAAU;EACzB,eAAe,OAAO,iBAAiB;CACzC;AACF;AAEA,MAAM,YAAY,SAA6B,SAAyB;CACtE,OAAO,MAAM,IAAI,KAAK,WAAmB,QAAQ,QAAQ,CAAC,GAAG;EAC3D,SAAS;GACP,KAAK;GACL,GAAG;GACH,GAAG;EACL,CAAC;EACD,oBAAoB;EACpB,KAAK,UAAU,IAAI,CAAC;CACtB,CAAC;AACH;AAEA,MAAa,QAAQ,WAAoC;CACvD,MAAM,UAAU,UAAU,MAAM;CAChC,MAAM,OAAO,OAAO,aAAa,QAAQ;CAEzC,OAAO,OAAO,UAAgB,YAA8B;EAC1D,IAAI,OAAO,MAAM,UAAU,SAAS,SAAS,IAAI,CAAC,EAAE,UAAU,OAAO;EACrE,IAAI,CAAC,MAAM,OAAO;EAClB,IAAI,EAAE,YAAY,OAAO;GACvB,IAAI,OAAO,SAAS,YAAY,OAAO;GACvC,OAAO,MAAM,eAAe,IAAI;EAClC;EAEA,MAAM,WAAW,KAAK,KAAa,IAAI;EAEvC,IAAI,CAAC,QAAQ,MAAM;GACjB,KAAK,OAAO,KAAK,UAAU,kBAAkB,CAAC;GAC9C,KAAK,OAAO,KAAK,UAAU,oBAAoB,CAAC;GAChD,KAAK,OAAO,KAAK,UAAU,iBAAiB,CAAC;GAC7C,IAAI,QAAQ,aAAa,MAAM,KAAK,OAAO,KAAK,UAAU,eAAe,CAAC;EAC5E;EAEA,IAAI,CAAC,QAAQ,QACX,KAAK,OAAO,KAAK,UAAU,MAAM,CAAC;EAGpC,OAAO;CACT;AACF"}
@@ -1 +1,166 @@
1
1
  # <%= name %>
2
+
3
+ ---
4
+
5
+ ## Prerequisites
6
+
7
+ - [Node.js](https://nodejs.org/) 18+
8
+ - Package manager: **<%= packageManager %>**
9
+ - [NanoForge CLI](https://www.npmjs.com/package/@nanoforge-dev/cli): `<%= packageManager %> install -g @nanoforge-dev/cli`
10
+
11
+ ---
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ <%= packageManager %> install
17
+ ```
18
+
19
+ ---
20
+
21
+ ## Development
22
+
23
+ Start the game in watch mode with hot reload:
24
+
25
+ ```bash
26
+ nf dev
27
+ ```
28
+
29
+ <% if (editor) { %>Open the visual editor (optional — lets you edit entities, components and systems without touching code):
30
+ ```bash
31
+ nf editor
32
+ ```
33
+
34
+ <% } %>---
35
+
36
+ ## Project structure
37
+
38
+ ```
39
+ <%= name %>/
40
+ ├── .nanoforge/ # NanoForge internal save files (do not edit manually)
41
+ ├── client/ # Client-side code (runs in the browser)
42
+ │ ├── static/ # Static assets
43
+ │ ├── components/ # ECS components
44
+ │ ├── systems/ # ECS systems<% if (initFunctions) { %>
45
+ │ └── init/ # Lifecycle hooks (before-init, after-run, …)<% } %><% if (server) { %>
46
+ ├── server/ # Server-side code
47
+ │ ├── static/
48
+ │ ├── components/
49
+ │ ├── systems/<% if (initFunctions) { %>
50
+ │ └── init/<% } %><% } %>
51
+ ├── package.json
52
+ ├── jsconfig.json
53
+ └── nanoforge.config.json # Game configuration
54
+ ```
55
+
56
+ ---
57
+
58
+ ## Modifying the game
59
+
60
+ ### Add a component
61
+
62
+ ```bash
63
+ nf generate component <name> --part client
64
+ ```
65
+
66
+ A component is a plain class that holds data for an entity. Edit the generated file in `client/components/`:
67
+
68
+ ```js
69
+ export class MyComponent {
70
+ constructor(speed) {
71
+ this.speed = speed;
72
+ }
73
+ }
74
+
75
+ export default MyComponent.name;
76
+ ```
77
+
78
+ ### Add a system
79
+
80
+ ```bash
81
+ nf generate system <name> --part client
82
+ ```
83
+
84
+ A system is a function that runs every tick and operates on entities that have specific components. Edit the generated file in `client/systems/`:
85
+
86
+ ```js
87
+ import { MyComponent } from "../components/my.component.js";
88
+
89
+ export const mySystem = (registry, ctx) => {
90
+ const entities = registry.getZipper([MyComponent]);
91
+
92
+ entities.forEach((entity) => {
93
+ entity.MyComponent.speed += 1;
94
+ });
95
+ };
96
+
97
+ export default mySystem.name;
98
+ ```
99
+
100
+ <% if (server) { %>
101
+ ### Server-side code
102
+
103
+ Server components and systems live in `server/` and are imported from `@nanoforge-dev/ecs-server`. They follow the same pattern as the client side.
104
+
105
+ Configure the server connection in `.env`:
106
+
107
+ | Variable | Default | Description |
108
+ |---------------------------------------|-------------|---------------------------------|
109
+ | `NANOFORGE_CLIENT_SERVER_ADDRESS` | `127.0.0.1` | Server address (client-side) |
110
+ | `NANOFORGE_CLIENT_SERVER_TCP_PORT` | `4444` | TCP port the client connects to |
111
+ | `NANOFORGE_CLIENT_SERVER_UDP_PORT` | `4445` | UDP port the client connects to |
112
+ | `NANOFORGE_SERVER_LISTENING_TCP_PORT` | `4444` | TCP port the server listens on |
113
+ | `NANOFORGE_SERVER_LISTENING_UDP_PORT` | `4445` | UDP port the server listens on |
114
+
115
+ <% } %>---
116
+
117
+ ## Build
118
+
119
+ Compile the game for production:
120
+
121
+ ```bash
122
+ <%= packageManager %> run build
123
+ # or
124
+ nf build
125
+ ```
126
+
127
+ Output is written to the `.nanoforge/` directory.
128
+
129
+ ---
130
+
131
+ ## Run
132
+
133
+ Start the game server and open it in a browser:
134
+
135
+ ```bash
136
+ <%= packageManager %> run start
137
+ # or
138
+ nf start
139
+ ```
140
+
141
+ <% if (lint) { %>---
142
+
143
+ ## Code quality
144
+
145
+ ```bash
146
+ # Check formatting and linting
147
+ <%= packageManager %> run lint
148
+
149
+ # Auto-fix formatting and linting
150
+ <%= packageManager %> run format
151
+ ```
152
+
153
+ <% } %>---
154
+
155
+ ## CLI reference
156
+
157
+ | Command | Description |
158
+ |--------------------------------|-------------------------------------------|
159
+ | `nf dev` | Start in development mode with hot reload |
160
+ | `nf build` | Build for production |
161
+ | `nf start` | Run the built game |
162
+ | `nf generate component <name>` | Scaffold a new component |
163
+ | `nf generate system <name>` | Scaffold a new system |<% if (editor) { %>
164
+ | `nf editor` | Open the visual editor |<% } %>
165
+
166
+ Full CLI documentation: <https://docs.nanoforge.eu>
@@ -0,0 +1,6 @@
1
+ NANOFORGE_CLIENT_SERVER_TCP_PORT=4444
2
+ NANOFORGE_CLIENT_SERVER_UDP_PORT=4445
3
+ NANOFORGE_CLIENT_SERVER_ADDRESS=127.0.0.1
4
+
5
+ NANOFORGE_SERVER_LISTENING_TCP_PORT=4444
6
+ NANOFORGE_SERVER_LISTENING_UDP_PORT=4445