@nanoforge-dev/schematics 2.1.3 → 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.
- package/README.md +3 -0
- package/dist/index.cjs +15 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -15
- package/dist/index.js.map +1 -1
- package/dist/libs/application/application.factory.d.ts +10 -13
- package/dist/libs/application/application.factory.d.ts.map +1 -0
- package/dist/libs/application/application.factory.js +52 -68
- package/dist/libs/application/application.factory.js.map +1 -1
- package/dist/libs/application/files/js/README.md +165 -0
- package/dist/libs/application/files/js/__dot__env +6 -0
- package/dist/libs/application/files/js/__dot__gitignore +134 -0
- package/dist/libs/application/files/ts/README.md +165 -0
- package/dist/libs/application/files/ts/__dot__env +6 -0
- package/dist/libs/application/files/ts/__dot__gitignore +134 -0
- package/dist/libs/application/schema.json +5 -0
- package/dist/libs/component/component.factory.d.ts +6 -6
- package/dist/libs/component/component.factory.d.ts.map +1 -0
- package/dist/libs/component/component.factory.js +32 -47
- package/dist/libs/component/component.factory.js.map +1 -1
- package/dist/libs/component/files/js/__fileName__.component.js +21 -27
- package/dist/libs/component/files/ts/__fileName__.component.ts +21 -27
- package/dist/libs/configuration/configuration.factory.d.ts +6 -7
- package/dist/libs/configuration/configuration.factory.d.ts.map +1 -0
- package/dist/libs/configuration/configuration.factory.js +91 -133
- package/dist/libs/configuration/configuration.factory.js.map +1 -1
- package/dist/libs/docker/docker.factory.d.ts +6 -4
- package/dist/libs/docker/docker.factory.d.ts.map +1 -0
- package/dist/libs/docker/docker.factory.js +17 -36
- package/dist/libs/docker/docker.factory.js.map +1 -1
- package/dist/libs/part-base/part-base.factory.d.ts +6 -7
- package/dist/libs/part-base/part-base.factory.d.ts.map +1 -0
- package/dist/libs/part-base/part-base.factory.js +30 -41
- package/dist/libs/part-base/part-base.factory.js.map +1 -1
- package/dist/libs/part-main/part-main.factory.d.ts +6 -9
- package/dist/libs/part-main/part-main.factory.d.ts.map +1 -0
- package/dist/libs/part-main/part-main.factory.js +228 -260
- package/dist/libs/part-main/part-main.factory.js.map +1 -1
- package/dist/libs/system/system.factory.d.ts +6 -6
- package/dist/libs/system/system.factory.d.ts.map +1 -0
- package/dist/libs/system/system.factory.js +32 -50
- package/dist/libs/system/system.factory.js.map +1 -1
- 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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
48
|
-
import { join } from "@angular-devkit/core";
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/utils/config/config.finder.ts
|
|
49
26
|
var ConfigFinder = class {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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,"
|
|
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,17 +1,19 @@
|
|
|
1
|
-
import { Rule } from
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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/
|
|
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,32 +1,31 @@
|
|
|
1
|
-
import { Rule } from
|
|
1
|
+
import { Rule } from "@angular-devkit/schematics";
|
|
2
2
|
|
|
3
|
+
//#region src/libs/part-base/part-base.schema.d.ts
|
|
3
4
|
interface PartBaseSchema {
|
|
4
5
|
/**
|
|
5
6
|
* NanoForge application destination directory
|
|
6
7
|
*/
|
|
7
8
|
directory: string;
|
|
8
|
-
|
|
9
9
|
/**
|
|
10
10
|
* The part of the application to generate
|
|
11
11
|
*/
|
|
12
12
|
part: "client" | "server";
|
|
13
|
-
|
|
14
13
|
/**
|
|
15
14
|
* NanoForge Application language
|
|
16
15
|
*/
|
|
17
16
|
language: "js" | "ts";
|
|
18
|
-
|
|
19
17
|
/**
|
|
20
18
|
* Add init functions to the application
|
|
21
19
|
*/
|
|
22
20
|
initFunctions: boolean;
|
|
23
|
-
|
|
24
21
|
/**
|
|
25
22
|
* Configure a server for the application
|
|
26
23
|
*/
|
|
27
24
|
server: boolean;
|
|
28
25
|
}
|
|
29
|
-
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/libs/part-base/part-base.factory.d.ts
|
|
30
28
|
declare const main: (schema: PartBaseSchema) => Rule;
|
|
31
|
-
|
|
29
|
+
//#endregion
|
|
32
30
|
export { main };
|
|
31
|
+
//# sourceMappingURL=part-base.factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"part-base.factory.d.ts","names":["directory","part","language","initFunctions","server"],"sources":["../../../src/libs/part-base/part-base.schema.d.ts","../../../src/libs/part-base/part-base.factory.ts"],"mappings":";;;UAAiB,cAAA;;;AAAjB;EAIEA,SAAAA;EAJ6B;;;EAS7BC,IAAAA;EAeAG;;AAAM;EAVNF,QAAAA;;ACgCF;;ED3BEC,aAAAA;EC2B2B;;;EDtB3BC,MAAAA;AAAAA;;;cCsBW,IAAA,GAAQ,MAAA,EAAQ,cAAA,KAAiB,IAI7C"}
|
|
@@ -1,44 +1,33 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// src/libs/part-base/part-base.factory.ts
|
|
5
1
|
import { join, normalize, strings } from "@angular-devkit/core";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const splited = path2.split("/");
|
|
31
|
-
return splited.at(-2) !== ".nanoforge" || splited.at(-1) === `${options.part}.save.json`;
|
|
32
|
-
})
|
|
33
|
-
];
|
|
34
|
-
if (!initFunctions) rules.push(filter((path2) => path2.split("/").at(-2) !== "init"));
|
|
35
|
-
return apply(url(join("./files", language)), rules);
|
|
36
|
-
}, "generate");
|
|
37
|
-
var main = /* @__PURE__ */ __name((schema) => {
|
|
38
|
-
const options = transform(schema);
|
|
39
|
-
return mergeWith(generate(options, schema.directory, schema.initFunctions, schema.language));
|
|
40
|
-
}, "main");
|
|
41
|
-
export {
|
|
42
|
-
main
|
|
2
|
+
import { apply, filter, mergeWith, move, template, url } from "@angular-devkit/schematics";
|
|
3
|
+
//#region src/libs/part-base/part-base.factory.ts
|
|
4
|
+
const transform = (schema) => {
|
|
5
|
+
return {
|
|
6
|
+
part: schema.part,
|
|
7
|
+
server: schema.server,
|
|
8
|
+
appClass: schema.part === "client" ? "NanoforgeClient" : "NanoforgeServer",
|
|
9
|
+
nanoforgeFolder: ".nanoforge"
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
const generate = (options, path, initFunctions, language) => {
|
|
13
|
+
const rules = [
|
|
14
|
+
template({
|
|
15
|
+
...strings,
|
|
16
|
+
...options
|
|
17
|
+
}),
|
|
18
|
+
move(normalize(path)),
|
|
19
|
+
filter((path) => {
|
|
20
|
+
const splited = path.split("/");
|
|
21
|
+
return splited.at(-2) !== ".nanoforge" || splited.at(-1) === `${options.part}.save.json`;
|
|
22
|
+
})
|
|
23
|
+
];
|
|
24
|
+
if (!initFunctions) rules.push(filter((path) => path.split("/").at(-2) !== "init"));
|
|
25
|
+
return apply(url(join("./files", language)), rules);
|
|
43
26
|
};
|
|
27
|
+
const main = (schema) => {
|
|
28
|
+
return mergeWith(generate(transform(schema), schema.directory, schema.initFunctions, schema.language));
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { main };
|
|
32
|
+
|
|
44
33
|
//# sourceMappingURL=part-base.factory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/libs/part-base/part-base.factory.ts"],"sourcesContent":["import { type Path, join, normalize, strings } from \"@angular-devkit/core\";\nimport {\n type Rule,\n type Source,\n apply,\n filter,\n mergeWith,\n move,\n template,\n url,\n} from \"@angular-devkit/schematics\";\n\nimport { type PartBaseOptions } from \"./part-base.options\";\nimport { type PartBaseSchema } from \"./part-base.schema\";\n\nconst transform = (schema: PartBaseSchema): PartBaseOptions => {\n return {\n part: schema.part,\n server: schema.server,\n appClass: schema.part === \"client\" ? \"NanoforgeClient\" : \"NanoforgeServer\",\n nanoforgeFolder: \".nanoforge\",\n };\n};\n\nconst generate = (\n options: PartBaseOptions,\n path: string,\n initFunctions: boolean,\n language: \"ts\" | \"js\",\n): Source => {\n const rules = [\n template({\n ...strings,\n ...options,\n }),\n move(normalize(path)),\n filter((path) => {\n const splited = path.split(\"/\");\n return splited.at(-2) !== \".nanoforge\" || splited.at(-1) === `${options.part}.save.json`;\n }),\n ];\n if (!initFunctions) rules.push(filter((path) => path.split(\"/\").at(-2) !== \"init\"));\n\n return apply(url(join(\"./files\" as Path, language)), rules);\n};\n\nexport const main = (schema: PartBaseSchema): Rule => {\n const options = transform(schema);\n\n return mergeWith(generate(options, schema.directory, schema.initFunctions, schema.language));\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"part-base.factory.js","names":[],"sources":["../../../src/libs/part-base/part-base.factory.ts"],"sourcesContent":["import { type Path, join, normalize, strings } from \"@angular-devkit/core\";\nimport {\n type Rule,\n type Source,\n apply,\n filter,\n mergeWith,\n move,\n template,\n url,\n} from \"@angular-devkit/schematics\";\n\nimport { type PartBaseOptions } from \"./part-base.options\";\nimport { type PartBaseSchema } from \"./part-base.schema\";\n\nconst transform = (schema: PartBaseSchema): PartBaseOptions => {\n return {\n part: schema.part,\n server: schema.server,\n appClass: schema.part === \"client\" ? \"NanoforgeClient\" : \"NanoforgeServer\",\n nanoforgeFolder: \".nanoforge\",\n };\n};\n\nconst generate = (\n options: PartBaseOptions,\n path: string,\n initFunctions: boolean,\n language: \"ts\" | \"js\",\n): Source => {\n const rules = [\n template({\n ...strings,\n ...options,\n }),\n move(normalize(path)),\n filter((path) => {\n const splited = path.split(\"/\");\n return splited.at(-2) !== \".nanoforge\" || splited.at(-1) === `${options.part}.save.json`;\n }),\n ];\n if (!initFunctions) rules.push(filter((path) => path.split(\"/\").at(-2) !== \"init\"));\n\n return apply(url(join(\"./files\" as Path, language)), rules);\n};\n\nexport const main = (schema: PartBaseSchema): Rule => {\n const options = transform(schema);\n\n return mergeWith(generate(options, schema.directory, schema.initFunctions, schema.language));\n};\n"],"mappings":";;;AAeA,MAAM,aAAa,WAA4C;CAC7D,OAAO;EACL,MAAM,OAAO;EACb,QAAQ,OAAO;EACf,UAAU,OAAO,SAAS,WAAW,oBAAoB;EACzD,iBAAiB;CACnB;AACF;AAEA,MAAM,YACJ,SACA,MACA,eACA,aACW;CACX,MAAM,QAAQ;EACZ,SAAS;GACP,GAAG;GACH,GAAG;EACL,CAAC;EACD,KAAK,UAAU,IAAI,CAAC;EACpB,QAAQ,SAAS;GACf,MAAM,UAAU,KAAK,MAAM,GAAG;GAC9B,OAAO,QAAQ,GAAG,EAAE,MAAM,gBAAgB,QAAQ,GAAG,EAAE,MAAM,GAAG,QAAQ,KAAK;EAC/E,CAAC;CACH;CACA,IAAI,CAAC,eAAe,MAAM,KAAK,QAAQ,SAAS,KAAK,MAAM,GAAG,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;CAElF,OAAO,MAAM,IAAI,KAAK,WAAmB,QAAQ,CAAC,GAAG,KAAK;AAC5D;AAEA,MAAa,QAAQ,WAAiC;CAGpD,OAAO,UAAU,SAFD,UAAU,MAEA,GAAS,OAAO,WAAW,OAAO,eAAe,OAAO,QAAQ,CAAC;AAC7F"}
|