@comet/cli 8.0.0-beta.5 → 8.0.0-beta.6
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.
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface BlockMeta {
|
|
2
|
+
name: string;
|
|
3
|
+
fields: BlockMetaField[];
|
|
4
|
+
inputFields: BlockMetaField[];
|
|
5
|
+
}
|
|
6
|
+
export type BlockMetaField = {
|
|
7
|
+
name: string;
|
|
8
|
+
kind: "String" | "Number" | "Boolean" | "Json";
|
|
9
|
+
nullable: boolean;
|
|
10
|
+
array?: boolean;
|
|
11
|
+
} | {
|
|
12
|
+
name: string;
|
|
13
|
+
kind: "Enum";
|
|
14
|
+
nullable: boolean;
|
|
15
|
+
enum: string[];
|
|
16
|
+
} | {
|
|
17
|
+
name: string;
|
|
18
|
+
kind: "Block";
|
|
19
|
+
nullable: boolean;
|
|
20
|
+
block: string;
|
|
21
|
+
} | {
|
|
22
|
+
name: string;
|
|
23
|
+
kind: "OneOfBlocks";
|
|
24
|
+
nullable: boolean;
|
|
25
|
+
blocks: Record<string, string>;
|
|
26
|
+
} | {
|
|
27
|
+
name: string;
|
|
28
|
+
kind: "NestedObject" | "NestedObjectList";
|
|
29
|
+
nullable: boolean;
|
|
30
|
+
object: BlockMetaNestedObject;
|
|
31
|
+
};
|
|
32
|
+
interface BlockMetaNestedObject {
|
|
33
|
+
fields: BlockMetaField[];
|
|
34
|
+
}
|
|
35
|
+
export {};
|
package/lib/BlockMeta.js
ADDED
|
@@ -120,6 +120,14 @@ function writeFieldType(field, blockNamePostfix) {
|
|
|
120
120
|
content += "}>\n";
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
+
var generateAllBlockNames = function (blockMeta) {
|
|
124
|
+
var uniqueBlockNames = Array.from(new Set(blockMeta.map(function (block) { return block.name; }))).sort();
|
|
125
|
+
var content = "export type AllBlockNames =";
|
|
126
|
+
uniqueBlockNames.forEach(function (blockName) {
|
|
127
|
+
content += " | \"".concat(blockName, "\"");
|
|
128
|
+
});
|
|
129
|
+
return content;
|
|
130
|
+
};
|
|
123
131
|
var generateBlockTypes = new commander_1.Command("generate-block-types")
|
|
124
132
|
.description("generate block types from block meta")
|
|
125
133
|
.option("--inputs", "include block inputs")
|
|
@@ -159,6 +167,7 @@ var generateBlockTypes = new commander_1.Command("generate-block-types")
|
|
|
159
167
|
content += "}\n";
|
|
160
168
|
});
|
|
161
169
|
}
|
|
170
|
+
content += generateAllBlockNames(blockMeta);
|
|
162
171
|
return [4 /*yield*/, (0, prettier_1.resolveConfig)(process.cwd())];
|
|
163
172
|
case 2:
|
|
164
173
|
prettierOptions = _a.sent();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comet/cli",
|
|
3
|
-
"version": "8.0.0-beta.
|
|
3
|
+
"version": "8.0.0-beta.6",
|
|
4
4
|
"repository": {
|
|
5
5
|
"directory": "packages/cli",
|
|
6
6
|
"type": "git",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"ts-node": "^10.9.2"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@types/node": "^22.15.
|
|
25
|
+
"@types/node": "^22.15.34",
|
|
26
26
|
"eslint": "^9.22.0",
|
|
27
27
|
"npm-run-all2": "^5.0.2",
|
|
28
28
|
"rimraf": "^6.0.1",
|
|
29
29
|
"typescript": "^5.7.3",
|
|
30
|
-
"@comet/eslint-config": "8.0.0-beta.
|
|
30
|
+
"@comet/eslint-config": "8.0.0-beta.6"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|
|
33
33
|
"node": ">=22.0.0"
|