mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 18:05:11 +03:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Refactor, bug fix. Part 1 of 6 in a stack that splits the library redesign into reviewable pieces. This one is the foundation the rest build on and has no visual change. ## What is the current behavior? Three build steps each reimplement "where does this registry file land in the user's project": `process-registry`'s `getDefaultPath`, `registry/utils`' `uniqBy` on `file.path`, and the Markdown exporter. They disagree, which produces real bugs: - A Vue block whose files come from `node_modules/@supabase/vue-blocks/` keeps its package path, so the installer writes the package folder into the user's project. - `registryItemAppend` builds its `docs` string from `(item.docs, items.flatMap(...))` — a comma expression, so the item's own docs are discarded. - A name collision between a block file and its client's file silently keeps one of the two. - Install commands guess the CLI family from substrings in the item name, so `infinite-query-composable` — a Vue block with neither "vue" nor "nuxtjs" in its name — gets the React CLI. - Production Vue installs use `@supabase/<name>`, but the `@supabase` namespace is registered with shadcn, not shadcn-vue. - `build:registry`, `build:content`, `build:markdown` and `build:llms` run in parallel, but the last three read `public/r`. ## What is the new behavior? `lib/registry-resolution.ts` owns installed-path derivation, first-party dependency naming, deduplication, and cycle detection, and every consumer calls it. `build-registry` validates the whole registry against shadcn's schema and resolves every item, so a broken reference fails the build instead of shipping. `clean-registry` throws rather than logging past a failure. Pages declare their install `framework` explicitly instead of it being inferred, and production Vue installs use the absolute registry URL. The build steps are serialized behind `build:prepare`, and a new `library-tests.yml` workflow runs the library's tests, checks the generated registry is committed, and builds the app. ## Additional context Regenerated registry artifacts are the mechanical result of the resolution fix — the Vue client items and the OAuth consent items that gained their client's docs. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added explicit React and Vue framework selection for library blocks and installation commands. * Improved registry resolution, dependency handling, path validation, and Vue file normalization. * Added support for reliable local, preview, and production registry URLs. * **Documentation** * Updated Vue and Nuxt installation documentation to identify the Vue framework explicitly. * **Bug Fixes** * Preserved combined documentation and validated generated registry content more consistently. * **Tests** * Added coverage for installation commands, registry resolution, dependency handling, and generated artifacts. * **Chores** * Added automated pull-request checks for library tests and builds. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
83 lines
2.8 KiB
Plaintext
83 lines
2.8 KiB
Plaintext
---
|
|
title: Dropzone (File Upload)
|
|
description: Displays a control for easier uploading of files directly to Supabase Storage
|
|
---
|
|
|
|
<ComponentPreview
|
|
name="dropzone-demo"
|
|
description="A file upload dropzone component that allows users to drag-and-drop files or select them manually. It supports multiple files, displays upload progress, previews images, and shows validation errors."
|
|
showCode={false}
|
|
/>
|
|
|
|
## Installation
|
|
|
|
<BlockItem
|
|
name="dropzone-vue"
|
|
description="Displays a control for easier uploading of files directly to Supabase Storage"
|
|
framework="vue"
|
|
/>
|
|
|
|
## Folder structure
|
|
|
|
This block assumes that you have already installed a Supabase client for Vue from the previous step.
|
|
|
|
<RegistryBlock itemName="dropzone-vue" />
|
|
|
|
## Introduction
|
|
|
|
Uploading files should be easy—this component handles the tricky parts for you.
|
|
|
|
The File Upload component makes it easy to add file uploads to your app, with built-in support for drag-and-drop, file type restrictions, image previews, and configurable limits on file size and number of files. All the essentials, ready to go.
|
|
|
|
**Features**
|
|
|
|
- Drag-and-drop support
|
|
- Multiple file uploads
|
|
- File size and count limits
|
|
- Image previews for supported file types
|
|
- MIME type restrictions
|
|
- Invalid file handling
|
|
- Success and error states with clear feedback
|
|
|
|
## Usage
|
|
|
|
- Simply add this `<Dropzone />` component to your page and it will handle the rest.
|
|
|
|
```vue
|
|
<script setup>
|
|
import { Dropzone, DropzoneContent, DropzoneEmptyState } from '@/components/dropzone'
|
|
import { useSupabaseUpload } from '@/composables/use-supabase-upload'
|
|
|
|
const upload = useSupabaseUpload({
|
|
bucketName: 'test',
|
|
path: 'test',
|
|
allowedMimeTypes: ['image/*'],
|
|
maxFiles: 2,
|
|
maxFileSize: 1000 * 1000 * 10, // 10MB,
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<Dropzone v-bind="upload">
|
|
<DropzoneEmptyState />
|
|
<DropzoneContent />
|
|
</Dropzone>
|
|
</template>
|
|
```
|
|
|
|
## Props
|
|
|
|
| Prop | Type | Default | Description |
|
|
| ------------------ | ---------- | ---------- | ---------------------------------------------------- |
|
|
| `bucketName` | `string` | `null` | The name of the Supabase Storage bucket to upload to |
|
|
| `path` | `string` | `null` | The path or subfolder to upload the file to |
|
|
| `allowedMimeTypes` | `string[]` | `[]` | The MIME types to allow for upload |
|
|
| `maxFiles` | `number` | `1` | Maximum number of files to upload |
|
|
| `maxFileSize` | `number` | `Infinity` | Maximum file size in bytes |
|
|
|
|
## Further reading
|
|
|
|
- [Creating buckets](https://supabase.com/docs/guides/storage/buckets/creating-buckets)
|
|
- [Access control](https://supabase.com/docs/guides/storage/security/access-control)
|
|
- [Standard uploads](https://supabase.com/docs/guides/storage/uploads/standard-uploads)
|