mirror of
https://github.com/supabase/supabase.git
synced 2026-10-13 21:29:08 +03:00
* Search and replace all mentions of SUPABASE_ANON_KEY. * Copy over some comments from the nextjs template. * Bump shadcn version. * Change the building of the blocks to append envVars and docs. * Use the new envVars property in the clients. * Rebuild all blocks. * Fix the wording. * Update the docs.
30 lines
997 B
TypeScript
30 lines
997 B
TypeScript
import lodash from 'lodash'
|
|
import { Registry } from 'shadcn/registry'
|
|
const { uniq, uniqBy } = lodash
|
|
|
|
const registryItemAppend = (item: Registry['items'][number], items: Registry['items']) => {
|
|
const neededRegDependencies = [
|
|
...(item.registryDependencies || []),
|
|
...items.flatMap((i) => i.registryDependencies),
|
|
]
|
|
const neededDependencies = [...(item.dependencies || []), ...items.flatMap((i) => i.dependencies)]
|
|
const neededFiles = [...(item.files || []), ...items.flatMap((i) => i.files)]
|
|
|
|
const registryBlock = {
|
|
...item,
|
|
registryDependencies: uniq(neededRegDependencies),
|
|
dependencies: uniq(neededDependencies),
|
|
files: uniqBy(neededFiles, (file) => file?.path),
|
|
docs: (item.docs, items.flatMap((i) => i.docs)).filter(Boolean).join('\n\n'),
|
|
// merge all environment variables
|
|
envVars: {
|
|
...item.envVars,
|
|
...items.reduce((acc, i) => ({ ...acc, ...i.envVars }), {}),
|
|
},
|
|
}
|
|
|
|
return registryBlock
|
|
}
|
|
|
|
export { registryItemAppend }
|