Skip to content

Commit

Permalink
chore(release): 📦 version packages (#100)
Browse files Browse the repository at this point in the history
* chore(release): 📦 version packages

* chore(release): 📦 sync lockfile

* fixy

* silence manypkg for nwo

* json parse

* silence

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: juliusmarminge <[email protected]>
  • Loading branch information
3 people committed May 28, 2023
1 parent 5e88dd3 commit 11c5ab3
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{ "repo": "pingdotgg/uploadthing" }
],
"commit": false,
"fixed": [["uploadthing", "@uploadthing/react", "@uploadthing/solid"]],
"fixed": [["uploadthing", "@uploadthing/react"]],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
Expand Down
5 changes: 0 additions & 5 deletions .changeset/ninety-monkeys-notice.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/olive-donkeys-move.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/swift-bottles-dream.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.28.0",
"@uploadthing/react": "3.0.5",
"@uploadthing/react": "4.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": "3.0.5",
"uploadthing": "4.0.0",
"zod": "^3.21.4",
"zod-validation-error": "^1.1.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.28.0",
"@uploadthing/react": "3.0.5",
"@uploadthing/react": "4.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": "3.0.5",
"uploadthing": "4.0.0",
"zod": "^3.21.4",
"zod-validation-error": "^1.1.0"
},
Expand Down
34 changes: 14 additions & 20 deletions examples/solid/src/routes/api/uploadthing/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,25 @@ const auth = (req: Request) => Promise.resolve({ id: "fakeId" }); // Fake auth f
// FileRouter for your app, can contain multiple FileRoutes
export const ourFileRouter = {
// Define as many FileRoutes as you like, each with a unique routeSlug
withMdwr: f({
image: {
maxFileCount: 2,
maxFileSize: "1MB",
},
})
imageUploader: f
// Set permissions and file types for this FileRoute
.fileTypes(["image", "video"])
.maxSize("1GB")
.middleware(async (req) => {
const h = req.headers.get("someProperty");
const authed = await auth(req);
// This code runs on your server before upload
const user = await auth(req);

return {
someProperty: h,
userId: authed.id,
};
// If you throw, the user will not be able to upload
if (!user) throw new Error("Unauthorized");

// Whatever is returned here is accessible in onUploadComplete as `metadata`
return { userId: user.id };
})
.onUploadComplete(({ metadata, file }) => {
console.log("uploaded with the following metadata:", metadata);
metadata.someProperty;
// ^?
metadata.userId;
// ^?
// This code RUNS ON YOUR SERVER after upload
console.log("Upload complete for userId:", metadata.userId);

console.log("files successfully uploaded:", file);
file;
// ^?
console.log("file url", file.url);
}),
} satisfies FileRouter;

Expand Down
2 changes: 1 addition & 1 deletion examples/solid/src/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Home: VoidComponent = () => {
return (
<main class="flex min-h-screen flex-col items-center justify-center gap-16 p-24">
<Uploader<OurFileRouter>
endpoint="withMdwr"
endpoint="imageUploader"
// needed when server side rendering
url="http://localhost:9898"
onClientUploadComplete={(res) => {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"build": "turbo run build",
"clean": "turbo run clean && git clean -xdf node_modules",
"dev": "turbo run dev",
"lint": "turbo run lint && manypkg check",
"lint": "turbo run lint",
"lint fixme after solid package is updated": "turbo run lint && manypkg check",
"format": "prettier --write . --ignore-path .gitignore",
"test": "turbo run test",
"test:watch": "turbo run test:watch",
Expand Down
11 changes: 11 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# @uploadthing/react

## 4.0.0

### Major Changes

- [#94](https://github.com/pingdotgg/uploadthing/pull/94) [`91fb166`](https://github.com/pingdotgg/uploadthing/commit/91fb1660ba9a3dd2eb92df16b5bb1d3373b77662) Thanks [@t3dotgg](https://github.com/t3dotgg)! - Overhauled file router syntax

### Patch Changes

- Updated dependencies [[`16157de`](https://github.com/pingdotgg/uploadthing/commit/16157de54198d0838007efb4f6a37a4cd8720bab), [`91fb166`](https://github.com/pingdotgg/uploadthing/commit/91fb1660ba9a3dd2eb92df16b5bb1d3373b77662), [`b073c96`](https://github.com/pingdotgg/uploadthing/commit/b073c96120edccf9c9dd8f6db78611f43b841d20)]:
- [email protected]

## 3.0.5

### 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": "3.0.5",
"version": "4.0.0",
"license": "MIT",
"exports": {
"./package.json": "./package.json",
Expand Down Expand Up @@ -36,7 +36,7 @@
"peerDependencies": {
"react": "^17.0.2 || ^18.0.0",
"react-dropzone": "^14.2.3",
"uploadthing": "3.0.5"
"uploadthing": "4.0.0"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.3",
Expand All @@ -54,7 +54,7 @@
"tailwindcss": "^3.3.2",
"tsup": "6.7.0",
"typescript": "5.1.0-beta",
"uploadthing": "3.0.5",
"uploadthing": "4.0.0",
"vitest": "^0.30.1",
"wait-on": "^7.0.1"
},
Expand Down
14 changes: 14 additions & 0 deletions packages/uploadthing/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# uploadthing

## 4.0.0

### Major Changes

- [#94](https://github.com/pingdotgg/uploadthing/pull/94) [`91fb166`](https://github.com/pingdotgg/uploadthing/commit/91fb1660ba9a3dd2eb92df16b5bb1d3373b77662) Thanks [@t3dotgg](https://github.com/t3dotgg)! - Overhauled file router syntax

### Minor Changes

- [#93](https://github.com/pingdotgg/uploadthing/pull/93) [`16157de`](https://github.com/pingdotgg/uploadthing/commit/16157de54198d0838007efb4f6a37a4cd8720bab) Thanks [@markflorkowski](https://github.com/markflorkowski)! - [feat] API Helpers -- deleteFiles() and getFileUrls()

### Patch Changes

- [#97](https://github.com/pingdotgg/uploadthing/pull/97) [`b073c96`](https://github.com/pingdotgg/uploadthing/commit/b073c96120edccf9c9dd8f6db78611f43b841d20) Thanks [@ayatofrench](https://github.com/ayatofrench)! - [Fix] Update to buildRequestHandler secret

## 3.0.5

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/uploadthing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "uploadthing",
"version": "3.0.5",
"version": "4.0.0",
"license": "MIT",
"exports": {
"./package.json": "./package.json",
Expand Down
5 changes: 4 additions & 1 deletion packages/uploadthing/src/next/core/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@ export const createNextPageApiHandler = <TRouter extends FileRouter>(
return res.status(400).send("`actionType` must not be an array");
if (uploadthingHook && typeof uploadthingHook !== "string")
return res.status(400).send("`uploadthingHook` must not be an array");
if (typeof req.body !== "string")
return res.status(400).send("Request body must be a JSON string");

const standardRequest = {
...req,
json: () => Promise.resolve(req.body),
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
json: () => Promise.resolve(JSON.parse(req.body)),
headers: {
get: (key: string) => req.headers[key],
} as Headers,
Expand Down
17 changes: 10 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit 11c5ab3

@vercel
Copy link

@vercel vercel bot commented on 11c5ab3 May 28, 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.