Skip to content

Commit 43b109e

Browse files
fix(cli): get all generated componnets types and compare with datasource type
1 parent 9b0085b commit 43b109e

File tree

1 file changed

+6
-2
lines changed
  • packages/cli/src/commands/types/generate

1 file changed

+6
-2
lines changed

packages/cli/src/commands/types/generate/actions.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,17 @@ export const generateTypes = async (
381381

382382
return componentSchema;
383383
});
384+
const resolvedComponentsSchema = await Promise.all(componentsSchema);
385+
384386
const datasourcesSchema = spaceData.datasources.map(async (datasource) => {
387+
const allComponentTypes = resolvedComponentsSchema.map(schema => schema.title);
388+
385389
const enumValues: string[] | undefined = datasource.entries
386390
?.filter(d => d.value)
387391
.map(d => d.value!);
388392
const type = getDatasourceTypeTitle(datasource.slug);
389393
// Check for conflicts with existing component types
390-
if (storyblokPropertyTypes.has(type)) {
394+
if (allComponentTypes.includes(type)) {
391395
console.warn(`Warning: Datasource type "${type}" conflicts with existing component type`);
392396
}
393397
const datasourceSchema: JSONSchema = {
@@ -398,8 +402,8 @@ export const generateTypes = async (
398402
};
399403
return datasourceSchema;
400404
});
401-
const resolvedComponentsSchema = await Promise.all(componentsSchema);
402405
const resolvedDatasourcesSchema = await Promise.all(datasourcesSchema);
406+
403407
const contentTypeSchema: JSONSchema = {
404408
$id: `#/ContentType`,
405409
title: 'ContentType',

0 commit comments

Comments
 (0)