Skip to content

Commit

Permalink
chore(release): 📦 version packages (#164)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
t3dotgg and github-actions[bot] committed Jun 20, 2023
1 parent 8d4bf32 commit 1ac0f1b
Show file tree
Hide file tree
Showing 12 changed files with 403 additions and 143 deletions.
7 changes: 0 additions & 7 deletions .changeset/honest-seas-rush.md

This file was deleted.

114 changes: 0 additions & 114 deletions .changeset/new-cooks-visit.md

This file was deleted.

4 changes: 2 additions & 2 deletions examples/appdir/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
},
"dependencies": {
"@tanstack/react-query": "^4.29.12",
"@uploadthing/react": "4.1.3",
"@uploadthing/react": "5.0.0",
"autoprefixer": "10.4.14",
"next": "13.4.4",
"postcss": "8.4.22",
"react": "18.2.0",
"react-dom": "18.2.0",
"tailwindcss": "^3.3.2",
"uploadthing": "4.1.3",
"uploadthing": "5.0.0",
"zod": "^3.21.4",
"zod-validation-error": "^1.3.0"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/pagedir/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
},
"dependencies": {
"@tanstack/react-query": "^4.29.12",
"@uploadthing/react": "4.1.3",
"@uploadthing/react": "5.0.0",
"autoprefixer": "10.4.14",
"next": "13.4.4",
"next-auth": "^4.22.1",
"postcss": "8.4.22",
"react": "18.2.0",
"react-dom": "18.2.0",
"tailwindcss": "^3.3.2",
"uploadthing": "4.1.3",
"uploadthing": "5.0.0",
"zod": "^3.21.4",
"zod-validation-error": "^1.3.0"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
"dependencies": {
"@solidjs/meta": "^0.28.5",
"@solidjs/router": "^0.8.2",
"@uploadthing/solid": "4.1.3",
"@uploadthing/solid": "5.0.0",
"attr-accept": "^2.2.2",
"file-selector": "^0.6.0",
"solid-js": "^1.7.6",
"solid-start": "^0.2.26",
"solidjs-dropzone": "^1.0.0",
"undici": "5.20.0",
"uploadthing": "4.1.3",
"uploadthing": "5.0.0",
"zod": "^3.21.4"
},
"engines": {
Expand Down
130 changes: 130 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,135 @@
# @uploadthing/react

## 5.0.0

### Major Changes

- [#157](https://github.com/pingdotgg/uploadthing/pull/157)
[`5652869`](https://github.com/pingdotgg/uploadthing/commit/56528690adb7b1500c4db53b8f0fa10432d13139)
Thanks [@juliusmarminge](https://github.com/juliusmarminge)! - feat!: allow
client side metadata to be passed along with the files

## Summary

You can now pass input along with the files when uploading.

In your file route:

```ts
withInput: f(["image"])
.input(
z.object({
foo: z.string(),
}),
)
.middleware((opts) => {
console.log("input", opts.input);
// input is typed as { foo: string }
return {};
})
.onUploadComplete((data) => {
console.log("upload completed", data);
}),
```

Then, when uploading, attach the input to the component or the `startUpload`
function:

```tsx
const { useUploadThing } = generateReactHelpers<typeof OurFileRouter>();
function MyComponent() {
// Vanilla way
const { startUpload } = useUploadthing("withInput");
async function onSubmit(files: File[]) {
await startUpload(files, { foo: "bar" });
}
// Component way
return (
<UploadButton<OurFileRouter>
endpoint="withInput"
input={{ foo: "bar" }} // or use some state to be dynamic
/>
);
}
```

The input is validated on **your** server and only leaves your server if you
pass it along from the `.middleware` to the `.onUploadComplete`. If you only
use the input in the middleware without returning it, the Uploadthing server
won't have any knowledge of it.

## Breaking changes

- Options passed in the `middleware` now comes as an object.

```ts
// before
route: f(["image"])
// res only for Next.js pages
.middleware((req, res) => {
return {};
});
// after
route: f(["image"])
// res only for Next.js pages
.middleware((opts) => {
opts.req; // Request, NextRequest, NextApiRequest depending on runtime
opts.res; // NextApiResponse for Next.js pages
opts.input; // typesafe, validated input
return {};
});
```

- The `endpoint` option in the `useUploadthing` hook has been moved out to a
separate positional argument.

```ts
// before
useUploadthing({
endpoint: "withInput"
onUploadComplete: ...
})
// after
useUploadthing("withInput", {
onUploadComplete: ...
})
```

- The signature for `uploadFiles` has changed to object syntax.

```ts
// before
const { uploadFiles } = generateReactHelpers<OurFileRouter>();
uploadFiles(files, endpoint, { url: "" })
// after
const { uploadFiles } = generateReactHelpers<OurFileRouter>();
uploadFiles({
files,
endpoint,
input, // <-- new option
url,
})
```

### Minor Changes

- [#61](https://github.com/pingdotgg/uploadthing/pull/61)
[`9162cce`](https://github.com/pingdotgg/uploadthing/commit/9162cce03245e500cae0d0c0564a388473c1ae13)
Thanks [@OrJDev](https://github.com/OrJDev)! - feat: `generateComponents`
functions for solid and react allows to pass the generic `FileRouter` once
instead of for everytime the component is used

### Patch Changes

- Updated dependencies
[[`5652869`](https://github.com/pingdotgg/uploadthing/commit/56528690adb7b1500c4db53b8f0fa10432d13139)]:
- uploadthing@5.0.0

## 4.1.3

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@uploadthing/react",
"version": "4.1.3",
"version": "5.0.0",
"license": "MIT",
"exports": {
"./package.json": "./package.json",
Expand Down Expand Up @@ -39,7 +39,7 @@
"peerDependencies": {
"react": "^17.0.2 || ^18.0.0",
"react-dropzone": "^14.2.3",
"uploadthing": "^4.0.0"
"uploadthing": "^5.0.0"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.3",
Expand All @@ -57,7 +57,7 @@
"tailwindcss": "^3.3.2",
"tsup": "6.7.0",
"typescript": "5.1.3",
"uploadthing": "4.1.3",
"uploadthing": "5.0.0",
"vitest": "^0.30.1",
"wait-on": "^7.0.1",
"zod": "^3.21.4"
Expand Down
Loading

1 comment on commit 1ac0f1b

@vercel
Copy link

@vercel vercel bot commented on 1ac0f1b Jun 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.