@nanoforge-dev/schematics 2.2.1 → 2.3.0

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 (138) hide show
  1. package/CHANGELOG.md +472 -0
  2. package/README.md +12 -15
  3. package/dist/collection.json +8 -23
  4. package/dist/index.cjs +21 -6
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +19 -7
  7. package/dist/index.d.cts.map +1 -1
  8. package/dist/index.d.ts +19 -7
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +17 -4
  11. package/dist/index.js.map +1 -1
  12. package/dist/libs/component/component.factory.d.ts +1 -3
  13. package/dist/libs/component/component.factory.d.ts.map +1 -1
  14. package/dist/libs/component/component.factory.js +2 -1
  15. package/dist/libs/component/component.factory.js.map +1 -1
  16. package/dist/libs/project/files/js/.dockerignore +5 -0
  17. package/dist/libs/project/files/js/Dockerfile +36 -0
  18. package/dist/libs/project/files/js/README.md +53 -0
  19. package/dist/libs/project/files/js/assets/__dot__gitkeep +0 -0
  20. package/dist/libs/project/files/js/jsconfig.json +36 -0
  21. package/dist/libs/project/files/js/nanoforge.config.js +10 -0
  22. package/dist/libs/project/files/js/package.json.template +24 -0
  23. package/dist/libs/project/files/js/pnpm-workspace.yaml.template +3 -0
  24. package/dist/libs/project/files/js/src/components/drawable-circle-2d.component.js +404 -0
  25. package/dist/libs/project/files/js/src/components/position-2d.component.js +42 -0
  26. package/dist/libs/project/files/js/src/main.js +43 -0
  27. package/dist/libs/project/files/js/src/systems/draw-2d.system.js +33 -0
  28. package/dist/libs/project/files/js/src/systems/move-2d.system.js +34 -0
  29. package/dist/libs/project/files/js/src/systems/position-sync.system.js +35 -0
  30. package/dist/libs/project/files/ts/.dockerignore +5 -0
  31. package/dist/libs/project/files/ts/Dockerfile +36 -0
  32. package/dist/libs/project/files/ts/README.md +53 -0
  33. package/dist/libs/project/files/ts/assets/__dot__gitkeep +0 -0
  34. package/dist/libs/project/files/ts/nanoforge.config.ts +5 -0
  35. package/dist/libs/project/files/ts/package.json.template +24 -0
  36. package/dist/libs/project/files/ts/pnpm-workspace.yaml.template +3 -0
  37. package/dist/libs/project/files/ts/src/components/drawable-circle-2d.component.ts +367 -0
  38. package/dist/libs/project/files/ts/src/components/position-2d.component.ts +35 -0
  39. package/dist/libs/project/files/ts/src/main.ts +39 -0
  40. package/dist/libs/project/files/ts/src/systems/draw-2d.system.ts +25 -0
  41. package/dist/libs/project/files/ts/src/systems/move-2d.system.ts +26 -0
  42. package/dist/libs/project/files/ts/src/systems/position-sync.system.ts +27 -0
  43. package/dist/libs/project/files/ts/tsconfig.json +42 -0
  44. package/dist/libs/project/project.factory.d.ts +64 -0
  45. package/dist/libs/project/project.factory.d.ts.map +1 -0
  46. package/dist/libs/project/project.factory.js +122 -0
  47. package/dist/libs/project/project.factory.js.map +1 -0
  48. package/dist/libs/project/schema.json +83 -0
  49. package/dist/libs/system/system.factory.d.ts +1 -3
  50. package/dist/libs/system/system.factory.d.ts.map +1 -1
  51. package/dist/libs/system/system.factory.js +2 -1
  52. package/dist/libs/system/system.factory.js.map +1 -1
  53. package/dist/libs/workspace/files/js/.dockerignore +5 -0
  54. package/dist/libs/workspace/files/js/Dockerfile +36 -0
  55. package/dist/libs/workspace/files/js/README.md +51 -0
  56. package/dist/libs/workspace/files/js/__dot__gitignore +137 -0
  57. package/dist/libs/{application → workspace}/files/js/jsconfig.json +1 -2
  58. package/dist/libs/workspace/files/js/nanoforge.config.js +6 -0
  59. package/dist/libs/workspace/files/js/package.json.template +19 -0
  60. package/dist/libs/workspace/files/js/pnpm-workspace.yaml.template +6 -0
  61. package/dist/libs/workspace/files/ts/.dockerignore +5 -0
  62. package/dist/libs/workspace/files/ts/Dockerfile +36 -0
  63. package/dist/libs/workspace/files/ts/README.md +51 -0
  64. package/dist/libs/workspace/files/ts/__dot__gitignore +134 -0
  65. package/dist/libs/workspace/files/ts/nanoforge.config.ts +6 -0
  66. package/dist/libs/workspace/files/ts/package.json.template +20 -0
  67. package/dist/libs/workspace/files/ts/pnpm-workspace.yaml.template +6 -0
  68. package/dist/libs/{application → workspace}/files/ts/tsconfig.json +1 -2
  69. package/dist/libs/workspace/schema.json +45 -0
  70. package/dist/libs/workspace/workspace.factory.d.ts +42 -0
  71. package/dist/libs/workspace/workspace.factory.d.ts.map +1 -0
  72. package/dist/libs/workspace/workspace.factory.js +116 -0
  73. package/dist/libs/workspace/workspace.factory.js.map +1 -0
  74. package/package.json +23 -21
  75. package/dist/libs/application/application.factory.d.ts +0 -59
  76. package/dist/libs/application/application.factory.d.ts.map +0 -1
  77. package/dist/libs/application/application.factory.js +0 -57
  78. package/dist/libs/application/application.factory.js.map +0 -1
  79. package/dist/libs/application/files/js/.prettierignore +0 -8
  80. package/dist/libs/application/files/js/README.md +0 -166
  81. package/dist/libs/application/files/js/eslint.config.js +0 -11
  82. package/dist/libs/application/files/js/package.json.template +0 -48
  83. package/dist/libs/application/files/js/pnpm-workspace.yaml.template +0 -3
  84. package/dist/libs/application/files/js/prettier.config.js +0 -6
  85. package/dist/libs/application/files/ts/.prettierignore +0 -8
  86. package/dist/libs/application/files/ts/README.md +0 -166
  87. package/dist/libs/application/files/ts/eslint.config.js +0 -15
  88. package/dist/libs/application/files/ts/package.json.template +0 -52
  89. package/dist/libs/application/files/ts/pnpm-workspace.yaml.template +0 -3
  90. package/dist/libs/application/files/ts/prettier.config.js +0 -6
  91. package/dist/libs/application/schema.json +0 -70
  92. package/dist/libs/configuration/configuration.factory.d.ts +0 -31
  93. package/dist/libs/configuration/configuration.factory.d.ts.map +0 -1
  94. package/dist/libs/configuration/configuration.factory.js +0 -97
  95. package/dist/libs/configuration/configuration.factory.js.map +0 -1
  96. package/dist/libs/configuration/files/nanoforge.config.json +0 -1
  97. package/dist/libs/configuration/schema.json +0 -34
  98. package/dist/libs/docker/docker.factory.d.ts +0 -19
  99. package/dist/libs/docker/docker.factory.d.ts.map +0 -1
  100. package/dist/libs/docker/docker.factory.js +0 -20
  101. package/dist/libs/docker/docker.factory.js.map +0 -1
  102. package/dist/libs/docker/files/.dockerignore +0 -1
  103. package/dist/libs/docker/files/Dockerfile +0 -25
  104. package/dist/libs/docker/schema.json +0 -19
  105. package/dist/libs/part-base/files/js/__nanoforgeFolder__/client.save.json +0 -77
  106. package/dist/libs/part-base/files/js/__nanoforgeFolder__/server.save.json +0 -49
  107. package/dist/libs/part-base/files/js/__part__/components/example.component.js +0 -72
  108. package/dist/libs/part-base/files/js/__part__/init/after-init.js +0 -12
  109. package/dist/libs/part-base/files/js/__part__/init/after-registry-init.js +0 -14
  110. package/dist/libs/part-base/files/js/__part__/init/after-run.js +0 -12
  111. package/dist/libs/part-base/files/js/__part__/init/before-init.js +0 -13
  112. package/dist/libs/part-base/files/js/__part__/init/before-registry-init.js +0 -14
  113. package/dist/libs/part-base/files/js/__part__/init/before-run.js +0 -12
  114. package/dist/libs/part-base/files/js/__part__/systems/example.system.js +0 -44
  115. package/dist/libs/part-base/files/ts/__nanoforgeFolder__/client.save.json +0 -77
  116. package/dist/libs/part-base/files/ts/__nanoforgeFolder__/server.save.json +0 -49
  117. package/dist/libs/part-base/files/ts/__part__/components/example.component.ts +0 -55
  118. package/dist/libs/part-base/files/ts/__part__/init/after-init.ts +0 -5
  119. package/dist/libs/part-base/files/ts/__part__/init/after-registry-init.ts +0 -6
  120. package/dist/libs/part-base/files/ts/__part__/init/after-run.ts +0 -5
  121. package/dist/libs/part-base/files/ts/__part__/init/before-init.ts +0 -5
  122. package/dist/libs/part-base/files/ts/__part__/init/before-registry-init.ts +0 -6
  123. package/dist/libs/part-base/files/ts/__part__/init/before-run.ts +0 -5
  124. package/dist/libs/part-base/files/ts/__part__/systems/example.system.ts +0 -31
  125. package/dist/libs/part-base/part-base.factory.d.ts +0 -31
  126. package/dist/libs/part-base/part-base.factory.d.ts.map +0 -1
  127. package/dist/libs/part-base/part-base.factory.js +0 -33
  128. package/dist/libs/part-base/part-base.factory.js.map +0 -1
  129. package/dist/libs/part-base/schema.json +0 -35
  130. package/dist/libs/part-main/part-main.factory.d.ts +0 -39
  131. package/dist/libs/part-main/part-main.factory.d.ts.map +0 -1
  132. package/dist/libs/part-main/part-main.factory.js +0 -252
  133. package/dist/libs/part-main/part-main.factory.js.map +0 -1
  134. package/dist/libs/part-main/schema.json +0 -43
  135. /package/dist/libs/{application → project}/files/js/__dot__gitignore +0 -0
  136. /package/dist/libs/{application → project}/files/ts/__dot__gitignore +0 -0
  137. /package/dist/libs/{application → workspace}/files/js/__dot__env +0 -0
  138. /package/dist/libs/{application → workspace}/files/ts/__dot__env +0 -0
@@ -1,97 +0,0 @@
1
- import { join, normalize, strings } from "@angular-devkit/core";
2
- import { apply, branchAndMerge, chain, mergeWith, move, template, url } from "@angular-devkit/schematics";
3
- //#region src/utils/object.ts
4
- const isObject = (item) => {
5
- return item && typeof item === "object" && !Array.isArray(item);
6
- };
7
- const deepMerge = (target, ...sources) => {
8
- if (!sources.length) return target;
9
- const source = sources.shift();
10
- if (isObject(target) && isObject(source)) for (const key in source) if (isObject(source[key])) {
11
- if (!target[key]) Object.assign(target, { [key]: {} });
12
- deepMerge(target[key], source[key]);
13
- } else Object.assign(target, { [key]: source[key] });
14
- return deepMerge(target, ...sources);
15
- };
16
- //#endregion
17
- //#region src/utils/config/config.declarator.ts
18
- var ConfigDeclarator = class {
19
- declare(baseContent, options) {
20
- const content = JSON.parse(baseContent);
21
- return JSON.stringify(deepMerge(content, options), null, 2);
22
- }
23
- };
24
- //#endregion
25
- //#region src/utils/config/config.finder.ts
26
- var ConfigFinder = class {
27
- tree;
28
- constructor(tree) {
29
- this.tree = tree;
30
- }
31
- find(path) {
32
- const dir = this.tree.getDir(path);
33
- return this.findIn(dir);
34
- }
35
- /**
36
- * Recursively searches for the module file in the given directory.
37
- *
38
- * @param directory - The directory to search in.
39
- * @returns The path to the module file, or null if not found.
40
- */
41
- findIn(directory) {
42
- if (!directory) return null;
43
- const moduleFilename = directory.subfiles.find((filename) => /^nanoforge.config.json$/.test(filename));
44
- return moduleFilename !== void 0 ? join(directory.path, moduleFilename.valueOf()) : this.findIn(directory.parent);
45
- }
46
- };
47
- //#endregion
48
- //#region src/libs/configuration/configuration.factory.ts
49
- const transform = (schema) => {
50
- return {};
51
- };
52
- const generate = (options, path) => {
53
- return apply(url(join("./files")), [template({
54
- ...strings,
55
- ...options
56
- }), move(normalize(path))]);
57
- };
58
- const addConfiguration = (options, path) => {
59
- return (tree) => {
60
- const config = new ConfigFinder(tree).find(path);
61
- if (!config) return tree;
62
- const content = tree.read(config)?.toString();
63
- const declarator = new ConfigDeclarator();
64
- if (!content) return tree;
65
- tree.overwrite(config, declarator.declare(content, options));
66
- return tree;
67
- };
68
- };
69
- const getConfig = (schema) => {
70
- const res = {
71
- name: schema.name,
72
- language: schema.language,
73
- client: { enable: true },
74
- server: { enable: schema.server ?? false }
75
- };
76
- if (schema.initFunctions) res["initFunctions"] = true;
77
- if (schema.language === "js") {
78
- if ("client" in res && res.client) {
79
- res.client["build"] = { entry: "client/main.js" };
80
- res.client["editor"] = { entry: ".nanoforge/editor/client/main.js" };
81
- }
82
- if (schema.server && "server" in res && res.server) {
83
- res.server["build"] = { entry: "server/main.js" };
84
- res.server["editor"] = { entry: ".nanoforge/editor/client/main.js" };
85
- }
86
- }
87
- return res;
88
- };
89
- const main = (schema) => {
90
- const options = transform(schema);
91
- const directory = schema.directory;
92
- return branchAndMerge(chain([mergeWith(generate(options, directory)), addConfiguration(getConfig(schema), directory)]));
93
- };
94
- //#endregion
95
- export { main };
96
-
97
- //# sourceMappingURL=configuration.factory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"configuration.factory.js","names":[],"sources":["../../../src/utils/object.ts","../../../src/utils/config/config.declarator.ts","../../../src/utils/config/config.finder.ts","../../../src/libs/configuration/configuration.factory.ts"],"sourcesContent":["export const isObject = (item: any) => {\n return item && typeof item === \"object\" && !Array.isArray(item);\n};\n\nexport const deepMerge = (target: any, ...sources: [any, ...any[]]): any => {\n if (!sources.length) return target;\n const source = sources.shift();\n\n if (isObject(target) && isObject(source)) {\n for (const key in source) {\n if (isObject(source[key])) {\n if (!target[key]) Object.assign(target, { [key]: {} });\n deepMerge(target[key], source[key]);\n } else {\n Object.assign(target, { [key]: source[key] });\n }\n }\n }\n\n return deepMerge(target, ...sources);\n};\n","import { type Config } from \"@utils/config/config.type\";\nimport { deepMerge } from \"@utils/object\";\nimport { type DeepPartial } from \"@utils/types\";\n\nexport class ConfigDeclarator {\n public declare(baseContent: string, options: DeepPartial<Config>): string {\n const content = JSON.parse(baseContent);\n return JSON.stringify(deepMerge(content, options), null, 2);\n }\n}\n","import { type Path, join } from \"@angular-devkit/core\";\nimport { type DirEntry, type Tree } from \"@angular-devkit/schematics\";\n\nexport interface FindOptions {\n path: Path;\n}\n\nexport class ConfigFinder {\n constructor(private tree: Tree) {}\n\n public find(path: Path): Path | null {\n const dir = this.tree.getDir(path);\n return this.findIn(dir);\n }\n\n /**\n * Recursively searches for the module file in the given directory.\n *\n * @param directory - The directory to search in.\n * @returns The path to the module file, or null if not found.\n */\n private findIn(directory: DirEntry | null): Path | null {\n if (!directory) {\n return null;\n }\n const moduleFilename = directory.subfiles.find((filename) =>\n /^nanoforge.config.json$/.test(filename),\n );\n return moduleFilename !== undefined\n ? join(directory.path, moduleFilename.valueOf())\n : this.findIn(directory.parent);\n }\n}\n","import { type Path, join, normalize, strings } from \"@angular-devkit/core\";\nimport {\n type Rule,\n type Source,\n type Tree,\n apply,\n branchAndMerge,\n chain,\n mergeWith,\n move,\n template,\n url,\n} from \"@angular-devkit/schematics\";\n\nimport { ConfigDeclarator } from \"@utils/config/config.declarator\";\nimport { ConfigFinder } from \"@utils/config/config.finder\";\nimport { type Config } from \"@utils/config/config.type\";\nimport { type DeepPartial } from \"@utils/types\";\n\nimport { type ConfigurationOptions } from \"./configuration.options\";\nimport { type ConfigurationSchema } from \"./configuration.schema\";\n\nconst transform = (schema: ConfigurationSchema): ConfigurationOptions => {\n void schema;\n\n return {};\n};\n\nconst generate = (options: ConfigurationOptions, path: string): Source => {\n return apply(url(join(\"./files\" as Path)), [\n template({\n ...strings,\n ...options,\n }),\n move(normalize(path)),\n ]);\n};\n\nconst addConfiguration = (options: DeepPartial<Config>, path: Path) => {\n return (tree: Tree) => {\n const config = new ConfigFinder(tree).find(path);\n if (!config) return tree;\n\n const content = tree.read(config)?.toString();\n const declarator = new ConfigDeclarator();\n\n if (!content) return tree;\n\n tree.overwrite(config, declarator.declare(content, options));\n return tree;\n };\n};\n\nconst getConfig = (schema: ConfigurationSchema): DeepPartial<Config> => {\n const res: DeepPartial<Config> = {\n name: schema.name,\n language: schema.language,\n client: {\n enable: true,\n },\n server: {\n enable: schema.server ?? false,\n },\n };\n\n if (schema.initFunctions) {\n res[\"initFunctions\"] = true;\n }\n\n if (schema.language === \"js\") {\n if (\"client\" in res && res.client) {\n res.client[\"build\"] = { entry: \"client/main.js\" };\n res.client[\"editor\"] = { entry: \".nanoforge/editor/client/main.js\" };\n }\n if (schema.server && \"server\" in res && res.server) {\n res.server[\"build\"] = { entry: \"server/main.js\" };\n res.server[\"editor\"] = { entry: \".nanoforge/editor/client/main.js\" };\n }\n }\n\n return res;\n};\n\nexport const main = (schema: ConfigurationSchema): Rule => {\n const options = transform(schema);\n const directory = schema.directory;\n\n return branchAndMerge(\n chain([\n mergeWith(generate(options, directory)),\n addConfiguration(getConfig(schema), directory as Path),\n ]),\n );\n};\n"],"mappings":"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"}
@@ -1,34 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema",
3
- "$id": "SchematicsNanoForgeConfiguration",
4
- "title": "NanoForge Base Application Options Schema",
5
- "type": "object",
6
- "properties": {
7
- "name": {
8
- "type": "string",
9
- "description": "The name of the application",
10
- "default": "nanoforge-app"
11
- },
12
- "directory": {
13
- "type": "string",
14
- "description": "NanoForge application destination directory",
15
- "default": "."
16
- },
17
- "server": {
18
- "type": "boolean",
19
- "description": "Server configuration",
20
- "default": false
21
- },
22
- "language": {
23
- "type": "string",
24
- "enum": ["ts", "js"],
25
- "description": "NanoForge application language",
26
- "default": "ts"
27
- },
28
- "initFunctions": {
29
- "type": "boolean",
30
- "description": "Add init functions to the main application",
31
- "default": false
32
- }
33
- }
34
- }
@@ -1,19 +0,0 @@
1
- import { Rule } from "@angular-devkit/schematics";
2
-
3
- //#region src/libs/docker/docker.schema.d.ts
4
- interface DockerSchema {
5
- /**
6
- * Target directory for generated Docker files
7
- */
8
- directory: string;
9
- /**
10
- * NanoForge application package manager
11
- */
12
- packageManager: "npm" | "yarn" | "pnpm" | "bun";
13
- }
14
- //#endregion
15
- //#region src/libs/docker/docker.factory.d.ts
16
- declare const main: (schema: DockerSchema) => Rule;
17
- //#endregion
18
- export { main };
19
- //# sourceMappingURL=docker.factory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docker.factory.d.ts","names":["directory","packageManager"],"sources":["../../../src/libs/docker/docker.schema.d.ts","../../../src/libs/docker/docker.factory.ts"],"mappings":";;;UAAiB,YAAA;;;AAAjB;EAIEA,SAAAA;EAAAA;AAKc;;EAAdC,cAAc;AAAA;;;cCuBH,IAAA,GAAQ,MAAA,EAAQ,YAAA,KAAe,IAG3C"}
@@ -1,20 +0,0 @@
1
- import { normalize, strings } from "@angular-devkit/core";
2
- import { apply, mergeWith, move, template, url } from "@angular-devkit/schematics";
3
- //#endregion
4
- //#region src/libs/docker/docker.factory.ts
5
- const transform = (schema) => {
6
- return { packageManager: schema.packageManager ?? "npm" };
7
- };
8
- const generate = (options, path) => {
9
- return apply(url("./files"), [template({
10
- ...strings,
11
- ...options
12
- }), move(normalize(path))]);
13
- };
14
- const main = (schema) => {
15
- return mergeWith(generate(transform(schema), schema.directory));
16
- };
17
- //#endregion
18
- export { main };
19
-
20
- //# sourceMappingURL=docker.factory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docker.factory.js","names":[],"sources":["../../../src/defaults.ts","../../../src/libs/docker/docker.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, normalize, strings } from \"@angular-devkit/core\";\nimport {\n type Rule,\n type Source,\n apply,\n mergeWith,\n move,\n template,\n url,\n} from \"@angular-devkit/schematics\";\n\nimport { DEFAULT_PACKAGE_MANAGER } from \"~/defaults\";\n\nimport { type DockerOptions } from \"./docker.options\";\nimport { type DockerSchema } from \"./docker.schema\";\n\nconst transform = (schema: DockerSchema): DockerOptions => {\n return {\n packageManager: schema.packageManager ?? DEFAULT_PACKAGE_MANAGER,\n };\n};\n\nconst generate = (options: DockerOptions, path: string): Source => {\n return apply(url(\"./files\" as Path), [\n template({\n ...strings,\n ...options,\n }),\n move(normalize(path)),\n ]);\n};\n\nexport const main = (schema: DockerSchema): Rule => {\n const options = transform(schema);\n return mergeWith(generate(options, schema.directory));\n};\n"],"mappings":";;;;ACgBA,MAAM,aAAa,WAAwC;CACzD,OAAO,EACL,gBAAgB,OAAO,kBAAA,MACzB;AACF;AAEA,MAAM,YAAY,SAAwB,SAAyB;CACjE,OAAO,MAAM,IAAI,SAAiB,GAAG,CACnC,SAAS;EACP,GAAG;EACH,GAAG;CACL,CAAC,GACD,KAAK,UAAU,IAAI,CAAC,CACtB,CAAC;AACH;AAEA,MAAa,QAAQ,WAA+B;CAElD,OAAO,UAAU,SADD,UAAU,MACA,GAAS,OAAO,SAAS,CAAC;AACtD"}
@@ -1 +0,0 @@
1
- node_modules/
@@ -1,25 +0,0 @@
1
- <% if (packageManager === 'bun') { %>FROM oven/bun:1.3<% } else { %>FROM node:25-slim<% } %>
2
- <% if (packageManager === 'pnpm') { %>
3
- ENV PNPM_HOME="/pnpm"
4
- ENV PATH="$PNPM_HOME:$PATH"
5
- RUN npm install -g pnpm
6
- <% } %><% if (packageManager === 'yarn') { %>
7
- RUN npm install -g yarn
8
- <% } %>
9
- WORKDIR /app
10
-
11
- COPY package.json ./
12
- <% if (packageManager === 'npm') { %>COPY package-lock.json ./
13
- <% } else if (packageManager === 'yarn') { %>COPY yarn.lock ./
14
- <% } else if (packageManager === 'pnpm') { %>COPY pnpm-lock.yaml ./
15
- <% } else if (packageManager === 'bun') { %>COPY bun.lock ./
16
- <% } %>
17
- <% if (packageManager === 'npm') { %>RUN npm install --no-lockfile
18
- <% } else if (packageManager === 'pnpm') { %>RUN pnpm install --frozen-lockfile --allow-build=bun
19
- <% } else { %>RUN <%= packageManager %> install --frozen-lockfile
20
- <% } %>
21
- COPY . .
22
-
23
- RUN <%= packageManager %> run build
24
-
25
- CMD ["<%= packageManager %>", "run", "start"]
@@ -1,19 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema",
3
- "$id": "SchematicsNanoForgeDocker",
4
- "title": "NanoForge Base Docker Options Schema",
5
- "type": "object",
6
- "properties": {
7
- "directory": {
8
- "type": "string",
9
- "description": "NanoForge application destination directory",
10
- "default": "."
11
- },
12
- "packageManager": {
13
- "type": "string",
14
- "enum": ["npm", "yarn", "pnpm", "bun"],
15
- "description": "NanoForge application package manager",
16
- "default": "npm"
17
- }
18
- }
19
- }
@@ -1,77 +0,0 @@
1
- {
2
- "libraries": [
3
- {
4
- "id": "assetManagerLibrary",
5
- "type": "asset-manager",
6
- "name": "AssetManagerLibrary",
7
- "path": "@nanoforge-dev/asset-manager",
8
- "params": []
9
- },
10
- {
11
- "id": "ecsLibrary",
12
- "type": "component-system",
13
- "name": "ECSClientLibrary",
14
- "path": "@nanoforge-dev/ecs-client",
15
- "params": []
16
- },
17
- {
18
- "id": "graphicsLibrary",
19
- "type": "graphics",
20
- "name": "Graphics2DLibrary",
21
- "path": "@nanoforge-dev/graphics-2d",
22
- "params": []
23
- },
24
- {
25
- "id": "inputLibrary",
26
- "type": "input",
27
- "name": "InputLibrary",
28
- "path": "@nanoforge-dev/input",
29
- "params": []
30
- },
31
- {
32
- "id": "musicLibrary",
33
- "type": "music",
34
- "name": "MusicLibrary",
35
- "path": "@nanoforge-dev/music",
36
- "params": []
37
- },<% if (server) { %>
38
- {
39
- "id": "networkLibrary",
40
- "type": "network",
41
- "name": "NetworkClientLibrary",
42
- "path": "@nanoforge-dev/network-client",
43
- "params": []
44
- },<% } %>
45
- {
46
- "id": "soundLibrary",
47
- "type": "sound",
48
- "name": "SoundLibrary",
49
- "path": "@nanoforge-dev/sound",
50
- "params": []
51
- }
52
- ],
53
- "components": [
54
- {
55
- "name": "ExampleComponent",
56
- "path": "./components/example.component.js",
57
- "paramsNames": ["paramA", "paramB", "paramC"]
58
- }
59
- ],
60
- "systems": [
61
- {
62
- "name": "exampleSystem",
63
- "path": "./systems/example.system.js"
64
- }
65
- ],
66
- "entities": [
67
- {
68
- "id": "exampleEntity",
69
- "components": {
70
- "ExampleComponent": {
71
- "paramA": "example",
72
- "paramB": 10
73
- }
74
- }
75
- }
76
- ]
77
- }
@@ -1,49 +0,0 @@
1
- {
2
- "libraries": [
3
- {
4
- "id": "assetManagerLibrary",
5
- "type": "asset-manager",
6
- "name": "AssetManagerLibrary",
7
- "path": "@nanoforge-dev/asset-manager",
8
- "params": []
9
- },
10
- {
11
- "id": "ecsLibrary",
12
- "type": "component-system",
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
- }<% } %>
24
- ],
25
- "components": [
26
- {
27
- "name": "ExampleComponent",
28
- "path": "./components/example.component.js",
29
- "paramsNames": ["paramA", "paramB", "paramC"]
30
- }
31
- ],
32
- "systems": [
33
- {
34
- "name": "exampleSystem",
35
- "path": "./systems/example.system.js"
36
- }
37
- ],
38
- "entities": [
39
- {
40
- "id": "exampleEntity",
41
- "components": {
42
- "ExampleComponent": {
43
- "paramA": "example",
44
- "paramB": 10
45
- }
46
- }
47
- }
48
- ]
49
- }
@@ -1,72 +0,0 @@
1
- /**
2
- * @typedef {import("@nanoforge-dev/ecs-<%= part %>").EditorComponentManifest} EditorComponentManifest
3
- */
4
-
5
- export class ExampleComponent {
6
- static name = "ExampleComponent";
7
- name = this.constructor.name;
8
-
9
- paramA;
10
- paramB;
11
- paramC;
12
-
13
- /**
14
- * Example component constructor
15
- * @param {string} paramA
16
- * @param {number} paramB
17
- * @param {boolean} [paramC = false]
18
- */
19
- constructor(paramA, paramB, paramC = false) {
20
- this.paramA = paramA;
21
- this.paramB = paramB;
22
- this.paramC = paramC;
23
- }
24
-
25
- get foo() {
26
- return "bar";
27
- }
28
-
29
- get paramAOrDefault() {
30
- return this.paramC ? this.paramA : "default";
31
- }
32
-
33
- addOne() {
34
- this.paramB += 1;
35
- }
36
- }
37
-
38
- // * Required to generate code
39
- export default ExampleComponent.name;
40
-
41
- /**
42
- * Editor component manifest
43
- * * Required for the editor to display the component and generate code
44
- * @type {EditorComponentManifest}
45
- */
46
- export const EDITOR_COMPONENT_MANIFEST = {
47
- name: "Example",
48
- description: "Example component description",
49
- params: [
50
- {
51
- type: "string",
52
- name: "paramA",
53
- description: "Param A description",
54
- example: "Example value",
55
- },
56
- {
57
- type: "number",
58
- name: "paramB",
59
- description: "Param B description",
60
- example: 3,
61
- },
62
- {
63
- type: "boolean",
64
- name: "paramC",
65
- description: "Param C description",
66
- example: true,
67
- default: false,
68
- // Not required because it has a default value
69
- optional: true,
70
- },
71
- ],
72
- };
@@ -1,12 +0,0 @@
1
- /**
2
- * @typedef {import("@nanoforge-dev/core").<%= appClass %>} <%= appClass %>
3
- */
4
-
5
- /**
6
- * Actions that are executed after the application initialization
7
- * @param {<%= appClass %>} app - Nanoforge <%= part %> instance
8
- * @returns {Promise<void>}
9
- */
10
- export async function afterInit(app) {
11
- // Actions after app initialization
12
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * @typedef {import("@nanoforge-dev/core").<%= appClass %>} <%= appClass %>
3
- * @typedef {import("@nanoforge-dev/ecs").Registry} Registry
4
- */
5
-
6
- /**
7
- * Actions that are executed after the registry components, entities and systems initialization
8
- * @param {<%= appClass %>} app - Nanoforge <%= part %> instance
9
- * @param {Registry} registry - ECS registry instance
10
- * @returns {Promise<void>}
11
- */
12
- export async function afterRegistryInit(app, registry) {
13
- // Actions after registry components, entities and systems initialization
14
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * @typedef {import("@nanoforge-dev/core").<%= appClass %>} <%= appClass %>
3
- */
4
-
5
- /**
6
- * Actions that are executed when the application ended
7
- * @param {<%= appClass %>} app - Nanoforge <%= part %> instance
8
- * @returns {Promise<void>}
9
- */
10
- export async function afterRun(app) {
11
- // Actions after app ended
12
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * @typedef {import("@nanoforge-dev/core").<%= appClass %>} <%= appClass %>
3
- */
4
-
5
- /**
6
- * Actions that are executed before the application initialization
7
- * But are executed after base libraries addition
8
- * @param {<%= appClass %>} app - Nanoforge <%= part %> instance
9
- * @returns {Promise<void>}
10
- */
11
- export async function beforeInit(app) {
12
- // Actions before app initialization
13
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * @typedef {import("@nanoforge-dev/core").<%= appClass %>} <%= appClass %>
3
- * @typedef {import("@nanoforge-dev/ecs").Registry} Registry
4
- */
5
-
6
- /**
7
- * Actions that are executed before the registry components, entities and systems initialization
8
- * @param {<%= appClass %>} app - Nanoforge <%= part %> instance
9
- * @param {Registry} registry - ECS registry instance
10
- * @returns {Promise<void>}
11
- */
12
- export async function beforeRegistryInit(app, registry) {
13
- // Actions before registry components, entities and systems initialization
14
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * @typedef {import("@nanoforge-dev/core").<%= appClass %>} <%= appClass %>
3
- */
4
-
5
- /**
6
- * Actions that are executed before the application started
7
- * @param {<%= appClass %>} app - Nanoforge <%= part %> instance
8
- * @returns {Promise<void>}
9
- */
10
- export async function beforeRun(app) {
11
- // Actions before app started
12
- }
@@ -1,44 +0,0 @@
1
- /**
2
- * @typedef {import("@nanoforge-dev/common").Context} Context
3
- * @typedef {import("@nanoforge-dev/ecs-<%= part %>").EditorSystemManifest} EditorSystemManifest
4
- * @typedef {import("@nanoforge-dev/ecs-<%= part %>").Registry} Registry
5
- */
6
-
7
- import { ExampleComponent } from "../components/example.component";
8
-
9
- /**
10
- * Example system
11
- * This system end the game when paramB reaches 0 for any entity with ExampleComponent
12
- * @param {Registry} registry - ECS registry instance
13
- * @param {Context} ctx - Nanoforge <%= part %> instance
14
- */
15
- export const exampleSystem = (registry, ctx) => {
16
- const entities = registry.getZipper([ExampleComponent]);
17
-
18
- entities.forEach((entity) => {
19
- if (entity.ExampleComponent.paramA === "end") {
20
- ctx.app.setIsRunning(false);
21
- return;
22
- }
23
-
24
- if (entity.ExampleComponent.paramB === 0) entity.ExampleComponent.paramA = "end";
25
-
26
- if (entity.ExampleComponent.paramB >= 0)
27
- entity.ExampleComponent.paramB = entity.ExampleComponent.paramB - 1;
28
- });
29
- };
30
-
31
- // * Required to generate code
32
- export default exampleSystem.name;
33
-
34
- /**
35
- * Editor component manifest
36
- * * Required for the editor to display the system and generate code
37
- * @type {EditorSystemManifest}
38
- */
39
- export const EDITOR_SYSTEM_MANIFEST = {
40
- name: "Example",
41
- description:
42
- "This system end the game when paramB reaches 0 for any entity with ExampleComponent",
43
- dependencies: ["ExampleComponent"],
44
- };
@@ -1,77 +0,0 @@
1
- {
2
- "libraries": [
3
- {
4
- "id": "assetManagerLibrary",
5
- "type": "asset-manager",
6
- "name": "AssetManagerLibrary",
7
- "path": "@nanoforge-dev/asset-manager",
8
- "params": []
9
- },
10
- {
11
- "id": "ecsLibrary",
12
- "type": "component-system",
13
- "name": "ECSClientLibrary",
14
- "path": "@nanoforge-dev/ecs-client",
15
- "params": []
16
- },
17
- {
18
- "id": "graphicsLibrary",
19
- "type": "graphics",
20
- "name": "Graphics2DLibrary",
21
- "path": "@nanoforge-dev/graphics-2d",
22
- "params": []
23
- },
24
- {
25
- "id": "inputLibrary",
26
- "type": "input",
27
- "name": "InputLibrary",
28
- "path": "@nanoforge-dev/input",
29
- "params": []
30
- },
31
- {
32
- "id": "musicLibrary",
33
- "type": "music",
34
- "name": "MusicLibrary",
35
- "path": "@nanoforge-dev/music",
36
- "params": []
37
- },<% if (server) { %>
38
- {
39
- "id": "networkLibrary",
40
- "type": "network",
41
- "name": "NetworkClientLibrary",
42
- "path": "@nanoforge-dev/network-client",
43
- "params": []
44
- },<% } %>
45
- {
46
- "id": "soundLibrary",
47
- "type": "sound",
48
- "name": "SoundLibrary",
49
- "path": "@nanoforge-dev/sound",
50
- "params": []
51
- }
52
- ],
53
- "components": [
54
- {
55
- "name": "ExampleComponent",
56
- "path": "./components/example.component.ts",
57
- "paramsNames": ["paramA", "paramB", "paramC"]
58
- }
59
- ],
60
- "systems": [
61
- {
62
- "name": "exampleSystem",
63
- "path": "./systems/example.system.ts"
64
- }
65
- ],
66
- "entities": [
67
- {
68
- "id": "exampleEntity",
69
- "components": {
70
- "ExampleComponent": {
71
- "paramA": "example",
72
- "paramB": 10
73
- }
74
- }
75
- }
76
- ]
77
- }