@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
@@ -30,32 +30,26 @@ export const EDITOR_COMPONENT_MANIFEST: EditorComponentManifest = {
30
30
  name: "<%= className %>",
31
31
  description: "<%= className %> component description",
32
32
  params: [
33
- [
34
- {
35
- type: "string",
36
- name: "paramA",
37
- description: "Param A description",
38
- example: "Example value",
39
- },
40
- ],
41
- [
42
- {
43
- type: "number",
44
- name: "paramB",
45
- description: "Param B description",
46
- example: 3,
47
- },
48
- ],
49
- [
50
- {
51
- type: "boolean",
52
- name: "paramC",
53
- description: "Param C description",
54
- example: true,
55
- default: false,
56
- // Not required because it has a default value
57
- optional: true,
58
- },
59
- ],
33
+ {
34
+ type: "string",
35
+ name: "paramA",
36
+ description: "Param A description",
37
+ example: "Example value",
38
+ },
39
+ {
40
+ type: "number",
41
+ name: "paramB",
42
+ description: "Param B description",
43
+ example: 3,
44
+ },
45
+ {
46
+ type: "boolean",
47
+ name: "paramC",
48
+ description: "Param C description",
49
+ example: true,
50
+ default: false,
51
+ // Not required because it has a default value
52
+ optional: true,
53
+ },
60
54
  ],
61
55
  };
@@ -1,32 +1,31 @@
1
- import { Rule } from '@angular-devkit/schematics';
1
+ import { Rule } from "@angular-devkit/schematics";
2
2
 
3
+ //#region src/libs/configuration/configuration.schema.d.ts
3
4
  interface ConfigurationSchema {
4
5
  /**
5
6
  * The name of the application
6
7
  */
7
8
  name: string;
8
-
9
9
  /**
10
10
  * NanoForge application destination directory
11
11
  */
12
12
  directory: string;
13
-
14
13
  /**
15
14
  * Configure a server for the application
16
15
  */
17
16
  server: boolean;
18
-
19
17
  /**
20
18
  * NanoForge Application language
21
19
  */
22
20
  language: "js" | "ts";
23
-
24
21
  /**
25
22
  * Add init functions to the application
26
23
  */
27
24
  initFunctions: boolean;
28
25
  }
29
-
26
+ //#endregion
27
+ //#region src/libs/configuration/configuration.factory.d.ts
30
28
  declare const main: (schema: ConfigurationSchema) => Rule;
31
-
29
+ //#endregion
32
30
  export { main };
31
+ //# sourceMappingURL=configuration.factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configuration.factory.d.ts","names":["name","directory","server","language","initFunctions"],"sources":["../../../src/libs/configuration/configuration.schema.d.ts","../../../src/libs/configuration/configuration.factory.ts"],"mappings":";;;UAAiB,mBAAA;;;AAAjB;EAIEA,IAAAA;EAJkC;;;EASlCC,SAAAA;EAeAG;;AAAa;EAVbF,MAAAA;;ACqEF;;EDhEEC,QAAAA;ECgE2B;;;ED3D3BC,aAAAA;AAAAA;;;cC2DW,IAAA,GAAQ,MAAA,EAAQ,mBAAA,KAAsB,IAUlD"}
@@ -1,139 +1,97 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // src/libs/configuration/configuration.factory.ts
5
- import { join as join2, normalize, strings } from "@angular-devkit/core";
6
- import {
7
- apply,
8
- branchAndMerge,
9
- chain,
10
- mergeWith,
11
- move,
12
- template,
13
- url
14
- } from "@angular-devkit/schematics";
15
-
16
- // src/utils/object.ts
17
- var isObject = /* @__PURE__ */ __name((item) => {
18
- return item && typeof item === "object" && !Array.isArray(item);
19
- }, "isObject");
20
- var deepMerge = /* @__PURE__ */ __name((target, ...sources) => {
21
- if (!sources.length) return target;
22
- const source = sources.shift();
23
- if (isObject(target) && isObject(source)) {
24
- for (const key in source) {
25
- if (isObject(source[key])) {
26
- if (!target[key]) Object.assign(target, { [key]: {} });
27
- deepMerge(target[key], source[key]);
28
- } else {
29
- Object.assign(target, { [key]: source[key] });
30
- }
31
- }
32
- }
33
- return deepMerge(target, ...sources);
34
- }, "deepMerge");
35
-
36
- // src/utils/config/config.declarator.ts
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
37
18
  var ConfigDeclarator = class {
38
- static {
39
- __name(this, "ConfigDeclarator");
40
- }
41
- declare(baseContent, options) {
42
- const content = JSON.parse(baseContent);
43
- return JSON.stringify(deepMerge(content, options), null, 2);
44
- }
19
+ declare(baseContent, options) {
20
+ const content = JSON.parse(baseContent);
21
+ return JSON.stringify(deepMerge(content, options), null, 2);
22
+ }
45
23
  };
46
-
47
- // src/utils/config/config.finder.ts
48
- import { join } from "@angular-devkit/core";
24
+ //#endregion
25
+ //#region src/utils/config/config.finder.ts
49
26
  var ConfigFinder = class {
50
- constructor(tree) {
51
- this.tree = tree;
52
- }
53
- static {
54
- __name(this, "ConfigFinder");
55
- }
56
- find(path) {
57
- const dir = this.tree.getDir(path);
58
- return this.findIn(dir);
59
- }
60
- /**
61
- * Recursively searches for the module file in the given directory.
62
- *
63
- * @param directory - The directory to search in.
64
- * @returns The path to the module file, or null if not found.
65
- */
66
- findIn(directory) {
67
- if (!directory) {
68
- return null;
69
- }
70
- const moduleFilename = directory.subfiles.find(
71
- (filename) => /^nanoforge.config.json$/.test(filename)
72
- );
73
- return moduleFilename !== void 0 ? join(directory.path, moduleFilename.valueOf()) : this.findIn(directory.parent);
74
- }
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
+ }
75
46
  };
76
-
77
- // src/libs/configuration/configuration.factory.ts
78
- var transform = /* @__PURE__ */ __name((schema) => {
79
- void schema;
80
- return {};
81
- }, "transform");
82
- var generate = /* @__PURE__ */ __name((options, path) => {
83
- return apply(url(join2("./files")), [
84
- template({
85
- ...strings,
86
- ...options
87
- }),
88
- move(normalize(path))
89
- ]);
90
- }, "generate");
91
- var addConfiguration = /* @__PURE__ */ __name((options, path) => {
92
- return (tree) => {
93
- const config = new ConfigFinder(tree).find(path);
94
- if (!config) return tree;
95
- const content = tree.read(config)?.toString();
96
- const declarator = new ConfigDeclarator();
97
- if (!content) return tree;
98
- tree.overwrite(config, declarator.declare(content, options));
99
- return tree;
100
- };
101
- }, "addConfiguration");
102
- var getConfig = /* @__PURE__ */ __name((schema) => {
103
- const res = {
104
- name: schema.name,
105
- language: schema.language,
106
- initFunctions: schema.initFunctions,
107
- client: {
108
- enable: true
109
- },
110
- server: {
111
- enable: schema.server ?? false
112
- }
113
- };
114
- if (schema.language === "js") {
115
- if ("client" in res && res.client) {
116
- res.client["build"] = { entry: "client/main.js" };
117
- res.client["editor"] = { entry: ".nanoforge/editor/client/main.js" };
118
- }
119
- if (schema.server && "server" in res && res.server) {
120
- res.server["build"] = { entry: "server/main.js" };
121
- res.server["editor"] = { entry: ".nanoforge/editor/client/main.js" };
122
- }
123
- }
124
- return res;
125
- }, "getConfig");
126
- var main = /* @__PURE__ */ __name((schema) => {
127
- const options = transform(schema);
128
- const directory = schema.directory;
129
- return branchAndMerge(
130
- chain([
131
- mergeWith(generate(options, directory)),
132
- addConfiguration(getConfig(schema), directory)
133
- ])
134
- );
135
- }, "main");
136
- export {
137
- main
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
+ };
138
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
+
139
97
  //# sourceMappingURL=configuration.factory.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/libs/configuration/configuration.factory.ts","../../../src/utils/object.ts","../../../src/utils/config/config.declarator.ts","../../../src/utils/config/config.finder.ts"],"sourcesContent":["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 initFunctions: schema.initFunctions,\n client: {\n enable: true,\n },\n server: {\n enable: schema.server ?? false,\n },\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","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"],"mappings":";;;;AAAA,SAAoB,QAAAA,OAAM,WAAW,eAAe;AACpD;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACZA,IAAM,WAAW,wBAAC,SAAc;AACrC,SAAO,QAAQ,OAAO,SAAS,YAAY,CAAC,MAAM,QAAQ,IAAI;AAChE,GAFwB;AAIjB,IAAM,YAAY,wBAAC,WAAgB,YAAkC;AAC1E,MAAI,CAAC,QAAQ,OAAQ,QAAO;AAC5B,QAAM,SAAS,QAAQ,MAAM;AAE7B,MAAI,SAAS,MAAM,KAAK,SAAS,MAAM,GAAG;AACxC,eAAW,OAAO,QAAQ;AACxB,UAAI,SAAS,OAAO,GAAG,CAAC,GAAG;AACzB,YAAI,CAAC,OAAO,GAAG,EAAG,QAAO,OAAO,QAAQ,EAAE,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC;AACrD,kBAAU,OAAO,GAAG,GAAG,OAAO,GAAG,CAAC;AAAA,MACpC,OAAO;AACL,eAAO,OAAO,QAAQ,EAAE,CAAC,GAAG,GAAG,OAAO,GAAG,EAAE,CAAC;AAAA,MAC9C;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,QAAQ,GAAG,OAAO;AACrC,GAhByB;;;ACAlB,IAAM,mBAAN,MAAuB;AAAA,EAJ9B,OAI8B;AAAA;AAAA;AAAA,EACrB,QAAQ,aAAqB,SAAsC;AACxE,UAAM,UAAU,KAAK,MAAM,WAAW;AACtC,WAAO,KAAK,UAAU,UAAU,SAAS,OAAO,GAAG,MAAM,CAAC;AAAA,EAC5D;AACF;;;ACTA,SAAoB,YAAY;AAOzB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,IAC/B,MAAM,OAAO;AAAA,IACb,UAAU,OAAO;AAAA,IACjB,eAAe,OAAO;AAAA,IACtB,QAAQ;AAAA,MACN,QAAQ;AAAA,IACV;AAAA,IACA,QAAQ;AAAA,MACN,QAAQ,OAAO,UAAU;AAAA,IAC3B;AAAA,EACF;AAEA,MAAI,OAAO,aAAa,MAAM;AAC5B,QAAI,YAAY,OAAO,IAAI,QAAQ;AACjC,UAAI,OAAO,OAAO,IAAI,EAAE,OAAO,iBAAiB;AAChD,UAAI,OAAO,QAAQ,IAAI,EAAE,OAAO,mCAAmC;AAAA,IACrE;AACA,QAAI,OAAO,UAAU,YAAY,OAAO,IAAI,QAAQ;AAClD,UAAI,OAAO,OAAO,IAAI,EAAE,OAAO,iBAAiB;AAChD,UAAI,OAAO,QAAQ,IAAI,EAAE,OAAO,mCAAmC;AAAA,IACrE;AAAA,EACF;AAEA,SAAO;AACT,GAzBkB;AA2BX,IAAM,OAAO,wBAAC,WAAsC;AACzD,QAAM,UAAU,UAAU,MAAM;AAChC,QAAM,YAAY,OAAO;AAEzB,SAAO;AAAA,IACL,MAAM;AAAA,MACJ,UAAU,SAAS,SAAS,SAAS,CAAC;AAAA,MACtC,iBAAiB,UAAU,MAAM,GAAG,SAAiB;AAAA,IACvD,CAAC;AAAA,EACH;AACF,GAVoB;","names":["join","join"]}
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":";;;AAAA,MAAa,YAAY,SAAc;CACrC,OAAO,QAAQ,OAAO,SAAS,YAAY,CAAC,MAAM,QAAQ,IAAI;AAChE;AAEA,MAAa,aAAa,QAAa,GAAG,YAAkC;CAC1E,IAAI,CAAC,QAAQ,QAAQ,OAAO;CAC5B,MAAM,SAAS,QAAQ,MAAM;CAE7B,IAAI,SAAS,MAAM,KAAK,SAAS,MAAM,GACrC,KAAK,MAAM,OAAO,QAChB,IAAI,SAAS,OAAO,IAAI,GAAG;EACzB,IAAI,CAAC,OAAO,MAAM,OAAO,OAAO,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC;EACrD,UAAU,OAAO,MAAM,OAAO,IAAI;CACpC,OACE,OAAO,OAAO,QAAQ,GAAG,MAAM,OAAO,KAAK,CAAC;CAKlD,OAAO,UAAU,QA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;EACjB,QAAQ,EACN,QAAQ,KACV;EACA,QAAQ,EACN,QAAQ,OAAO,UAAU,MAC3B;CACF;CAEA,IAAI,OAAO,eACT,IAAI,mBAAmB;CAGzB,IAAI,OAAO,aAAa,MAAM;EAC5B,IAAI,YAAY,OAAO,IAAI,QAAQ;GACjC,IAAI,OAAO,WAAW,EAAE,OAAO,iBAAiB;GAChD,IAAI,OAAO,YAAY,EAAE,OAAO,mCAAmC;EACrE;EACA,IAAI,OAAO,UAAU,YAAY,OAAO,IAAI,QAAQ;GAClD,IAAI,OAAO,WAAW,EAAE,OAAO,iBAAiB;GAChD,IAAI,OAAO,YAAY,EAAE,OAAO,mCAAmC;EACrE;CACF;CAEA,OAAO;AACT;AAEA,MAAa,QAAQ,WAAsC;CACzD,MAAM,UAAU,UAAU,MAAM;CAChC,MAAM,YAAY,OAAO;CAEzB,OAAO,eACL,MAAM,CACJ,UAAU,SAAS,SAAS,SAAS,CAAC,GACtC,iBAAiB,UAAU,MAAM,GAAG,SAAiB,CACvD,CAAC,CACH;AACF"}
@@ -1,17 +1,19 @@
1
- import { Rule } from '@angular-devkit/schematics';
1
+ import { Rule } from "@angular-devkit/schematics";
2
2
 
3
+ //#region src/libs/docker/docker.schema.d.ts
3
4
  interface DockerSchema {
4
5
  /**
5
6
  * Target directory for generated Docker files
6
7
  */
7
8
  directory: string;
8
-
9
9
  /**
10
10
  * NanoForge application package manager
11
11
  */
12
12
  packageManager: "npm" | "yarn" | "pnpm" | "bun";
13
13
  }
14
-
14
+ //#endregion
15
+ //#region src/libs/docker/docker.factory.d.ts
15
16
  declare const main: (schema: DockerSchema) => Rule;
16
-
17
+ //#endregion
17
18
  export { main };
19
+ //# sourceMappingURL=docker.factory.d.ts.map
@@ -0,0 +1 @@
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,39 +1,20 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // src/libs/docker/docker.factory.ts
5
1
  import { normalize, strings } from "@angular-devkit/core";
6
- import {
7
- apply,
8
- mergeWith,
9
- move,
10
- template,
11
- url
12
- } from "@angular-devkit/schematics";
13
-
14
- // src/defaults.ts
15
- var DEFAULT_PACKAGE_MANAGER = "npm";
16
-
17
- // src/libs/docker/docker.factory.ts
18
- var transform = /* @__PURE__ */ __name((schema) => {
19
- return {
20
- packageManager: schema.packageManager ?? DEFAULT_PACKAGE_MANAGER
21
- };
22
- }, "transform");
23
- var generate = /* @__PURE__ */ __name((options, path) => {
24
- return apply(url("./files"), [
25
- template({
26
- ...strings,
27
- ...options
28
- }),
29
- move(normalize(path))
30
- ]);
31
- }, "generate");
32
- var main = /* @__PURE__ */ __name((schema) => {
33
- const options = transform(schema);
34
- return mergeWith(generate(options, schema.directory));
35
- }, "main");
36
- export {
37
- main
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" };
38
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
+
39
20
  //# sourceMappingURL=docker.factory.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/libs/docker/docker.factory.ts","../../../src/defaults.ts"],"sourcesContent":["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","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,WAAW,eAAe;AAC9C;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACJA,IAAM,0BAA0B;;;ADWvC,IAAM,YAAY,wBAAC,WAAwC;AACzD,SAAO;AAAA,IACL,gBAAgB,OAAO,kBAAkB;AAAA,EAC3C;AACF,GAJkB;AAMlB,IAAM,WAAW,wBAAC,SAAwB,SAAyB;AACjE,SAAO,MAAM,IAAI,SAAiB,GAAG;AAAA,IACnC,SAAS;AAAA,MACP,GAAG;AAAA,MACH,GAAG;AAAA,IACL,CAAC;AAAA,IACD,KAAK,UAAU,IAAI,CAAC;AAAA,EACtB,CAAC;AACH,GARiB;AAUV,IAAM,OAAO,wBAAC,WAA+B;AAClD,QAAM,UAAU,UAAU,MAAM;AAChC,SAAO,UAAU,SAAS,SAAS,OAAO,SAAS,CAAC;AACtD,GAHoB;","names":[]}
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"}
@@ -53,14 +53,14 @@
53
53
  "components": [
54
54
  {
55
55
  "name": "ExampleComponent",
56
- "path": "./components/example.component",
56
+ "path": "./components/example.component.js",
57
57
  "paramsNames": ["paramA", "paramB", "paramC"]
58
58
  }
59
59
  ],
60
60
  "systems": [
61
61
  {
62
62
  "name": "exampleSystem",
63
- "path": "./systems/example.system"
63
+ "path": "./systems/example.system.js"
64
64
  }
65
65
  ],
66
66
  "entities": [
@@ -25,14 +25,14 @@
25
25
  "components": [
26
26
  {
27
27
  "name": "ExampleComponent",
28
- "path": "./components/example.component",
28
+ "path": "./components/example.component.js",
29
29
  "paramsNames": ["paramA", "paramB", "paramC"]
30
30
  }
31
31
  ],
32
32
  "systems": [
33
33
  {
34
34
  "name": "exampleSystem",
35
- "path": "./systems/example.system"
35
+ "path": "./systems/example.system.js"
36
36
  }
37
37
  ],
38
38
  "entities": [
@@ -47,32 +47,26 @@ export const EDITOR_COMPONENT_MANIFEST = {
47
47
  name: "Example",
48
48
  description: "Example component description",
49
49
  params: [
50
- [
51
- {
52
- type: "string",
53
- name: "paramA",
54
- description: "Param A description",
55
- example: "Example value",
56
- },
57
- ],
58
- [
59
- {
60
- type: "number",
61
- name: "paramB",
62
- description: "Param B description",
63
- example: 3,
64
- },
65
- ],
66
- [
67
- {
68
- type: "boolean",
69
- name: "paramC",
70
- description: "Param C description",
71
- example: true,
72
- default: false,
73
- // Not required because it has a default value
74
- optional: true,
75
- },
76
- ],
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
+ },
77
71
  ],
78
72
  };
@@ -53,14 +53,14 @@
53
53
  "components": [
54
54
  {
55
55
  "name": "ExampleComponent",
56
- "path": "./components/example.component",
56
+ "path": "./components/example.component.ts",
57
57
  "paramsNames": ["paramA", "paramB", "paramC"]
58
58
  }
59
59
  ],
60
60
  "systems": [
61
61
  {
62
62
  "name": "exampleSystem",
63
- "path": "./systems/example.system"
63
+ "path": "./systems/example.system.ts"
64
64
  }
65
65
  ],
66
66
  "entities": [
@@ -25,14 +25,14 @@
25
25
  "components": [
26
26
  {
27
27
  "name": "ExampleComponent",
28
- "path": "./components/example.component",
28
+ "path": "./components/example.component.ts",
29
29
  "paramsNames": ["paramA", "paramB", "paramC"]
30
30
  }
31
31
  ],
32
32
  "systems": [
33
33
  {
34
34
  "name": "exampleSystem",
35
- "path": "./systems/example.system"
35
+ "path": "./systems/example.system.ts"
36
36
  }
37
37
  ],
38
38
  "entities": [