Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/utils/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ export const previewTemplate = (collections: ResolvedCollection[], gitInfo: GitI
filename: moduleTemplates.preview,
getContents: ({ options }: { options: { collections: ResolvedCollection[] } }) => {
const collectionsMeta = options.collections.reduce((acc, collection) => {
// Only include non remote collections and collections with at least one local source (remove `info` collection)
const localSources = collection.source?.filter(source => !source.repository) ?? []
if (localSources.length === 0) {
return acc
}

const schemaWithCollectionName = {
...collection.extendedSchema,
definitions: {
Expand All @@ -216,8 +222,7 @@ export const previewTemplate = (collections: ResolvedCollection[], gitInfo: GitI
name: collection.name,
pascalName: pascalCase(collection.name),
tableName: collection.tableName,
// Remove source from collection meta if it's a remote collection
source: collection.source?.filter(source => source.repository ? undefined : collection.source) || [],
source: localSources,
type: collection.type,
fields: collection.fields,
schema: schemaWithCollectionName,
Expand Down
Loading