@nanoforge-dev/schematics 2.1.1 → 2.1.3
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/dist/libs/application/application.factory.js +1 -23
- package/dist/libs/application/application.factory.js.map +1 -1
- package/dist/libs/application/files/js/jsconfig.json +1 -1
- package/dist/libs/application/files/ts/tsconfig.json +1 -1
- package/dist/libs/part-base/files/js/__nanoforgeFolder__/client.save.json +2 -2
- package/dist/libs/part-base/files/js/__nanoforgeFolder__/server.save.json +2 -2
- package/dist/libs/part-base/files/js/__part__/components/example.component.js +21 -27
- package/dist/libs/part-base/files/ts/__nanoforgeFolder__/client.save.json +2 -2
- package/dist/libs/part-base/files/ts/__nanoforgeFolder__/server.save.json +2 -2
- package/dist/libs/part-base/files/ts/__part__/components/example.component.ts +21 -27
- package/package.json +1 -1
|
@@ -13,27 +13,6 @@ import {
|
|
|
13
13
|
} from "@angular-devkit/schematics";
|
|
14
14
|
import { firstValueFrom } from "rxjs";
|
|
15
15
|
|
|
16
|
-
// src/utils/formatting.ts
|
|
17
|
-
var toWords = /* @__PURE__ */ __name((str) => {
|
|
18
|
-
return str.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/[-_]+/g, " ").trim().split(/\s+/).filter(Boolean);
|
|
19
|
-
}, "toWords");
|
|
20
|
-
var toKebabCase = /* @__PURE__ */ __name((str) => {
|
|
21
|
-
return toWords(str).map((word) => word.toLowerCase()).join("-");
|
|
22
|
-
}, "toKebabCase");
|
|
23
|
-
|
|
24
|
-
// src/utils/name.ts
|
|
25
|
-
import { basename, parse } from "path";
|
|
26
|
-
var resolvePackageName = /* @__PURE__ */ __name((path) => {
|
|
27
|
-
const { base: baseFilename, dir: dirname } = parse(path);
|
|
28
|
-
if (baseFilename === ".") {
|
|
29
|
-
return basename(process.cwd());
|
|
30
|
-
}
|
|
31
|
-
if (dirname.match(/^@[^\s]/)) {
|
|
32
|
-
return `${dirname}/${baseFilename}`;
|
|
33
|
-
}
|
|
34
|
-
return baseFilename;
|
|
35
|
-
}, "resolvePackageName");
|
|
36
|
-
|
|
37
16
|
// src/defaults.ts
|
|
38
17
|
var DEFAULT_APP_NAME = "nanoforge-app";
|
|
39
18
|
var DEFAULT_VERSION = "0.0.0";
|
|
@@ -44,9 +23,8 @@ var DEFAULT_PACKAGE_MANAGER = "npm";
|
|
|
44
23
|
|
|
45
24
|
// src/libs/application/application.factory.ts
|
|
46
25
|
var transform = /* @__PURE__ */ __name((schema) => {
|
|
47
|
-
const name = resolvePackageName(toKebabCase(schema.name?.toString() ?? DEFAULT_APP_NAME));
|
|
48
26
|
return {
|
|
49
|
-
name,
|
|
27
|
+
name: schema.name ?? DEFAULT_APP_NAME,
|
|
50
28
|
version: schema.version ?? DEFAULT_VERSION,
|
|
51
29
|
author: schema.author ?? DEFAULT_AUTHOR,
|
|
52
30
|
description: schema.description ?? DEFAULT_DESCRIPTION,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/libs/application/application.factory.ts","../../../src/
|
|
1
|
+
{"version":3,"sources":["../../../src/libs/application/application.factory.ts","../../../src/defaults.ts"],"sourcesContent":["import { type Path, join, normalize, strings } from \"@angular-devkit/core\";\nimport {\n type Rule,\n type SchematicContext,\n type Source,\n type Tree,\n apply,\n mergeWith,\n move,\n renameTemplateFiles,\n template,\n url,\n} from \"@angular-devkit/schematics\";\nimport { firstValueFrom } from \"rxjs\";\n\nimport {\n DEFAULT_APP_NAME,\n DEFAULT_AUTHOR,\n DEFAULT_DESCRIPTION,\n DEFAULT_LANGUAGE,\n DEFAULT_PACKAGE_MANAGER,\n DEFAULT_VERSION,\n} from \"~/defaults\";\n\nimport { type ApplicationOptions } from \"./application.options\";\nimport { type ApplicationSchema } from \"./application.schema\";\n\nconst transform = (schema: ApplicationSchema): ApplicationOptions => {\n return {\n name: schema.name ?? DEFAULT_APP_NAME,\n version: schema.version ?? DEFAULT_VERSION,\n author: schema.author ?? DEFAULT_AUTHOR,\n description: schema.description ?? DEFAULT_DESCRIPTION,\n language: schema.language ?? DEFAULT_LANGUAGE,\n strict: schema.strict ?? true,\n lint: schema.lint ?? true,\n packageManager: schema.packageManager ?? DEFAULT_PACKAGE_MANAGER,\n server: schema.server ?? false,\n editor: schema.editor ?? false,\n };\n};\n\nconst generate = (options: ApplicationOptions, path: string): Source => {\n return apply(url(join(\"./files\" as Path, options.language)), [\n template({\n ...strings,\n ...options,\n }),\n renameTemplateFiles(),\n move(normalize(path)),\n ]);\n};\n\nexport const main = (schema: ApplicationSchema): Rule => {\n const options = transform(schema);\n const path = schema.directory ?? options.name;\n\n return async (baseTree: Tree, context: SchematicContext) => {\n let tree = await mergeWith(generate(options, path))(baseTree, context);\n if (!tree) return tree;\n if (!(\"delete\" in tree)) {\n if (typeof tree === \"function\") return tree;\n tree = await firstValueFrom(tree);\n }\n\n if (!options.lint) {\n const basePath = join(\"/\" as Path, path);\n tree.delete(join(basePath, \"eslint.config.js\"));\n tree.delete(join(basePath, \"prettier.config.js\"));\n tree.delete(join(basePath, \".prettierignore\"));\n if (options.language === \"js\") tree.delete(join(basePath, \"jsconfig.json\"));\n }\n\n return tree;\n };\n};\n","export const DEFAULT_APP_NAME = \"nanoforge-app\";\nexport const DEFAULT_VERSION = \"0.0.0\";\nexport const DEFAULT_AUTHOR = \"\";\nexport const DEFAULT_DESCRIPTION = \"\";\nexport const DEFAULT_LANGUAGE = \"ts\";\nexport const DEFAULT_PACKAGE_MANAGER = \"npm\";\n"],"mappings":";;;;AAAA,SAAoB,MAAM,WAAW,eAAe;AACpD;AAAA,EAKE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;;;ACbxB,IAAM,mBAAmB;AACzB,IAAM,kBAAkB;AACxB,IAAM,iBAAiB;AACvB,IAAM,sBAAsB;AAC5B,IAAM,mBAAmB;AACzB,IAAM,0BA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AAK,OAAO,KAAK,UAAU,eAAe,CAAC;AAAA,IAC5E;AAEA,WAAO;AAAA,EACT;AACF,GAtBoB;","names":[]}
|
|
@@ -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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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": [
|
|
@@ -30,32 +30,26 @@ export const EDITOR_COMPONENT_MANIFEST: EditorComponentManifest = {
|
|
|
30
30
|
name: "Example",
|
|
31
31
|
description: "Example 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
|
};
|