From ac8cdf652f98316425e59270da990817356caf2d Mon Sep 17 00:00:00 2001 From: terrablue <102580937+terrablue@users.noreply.github.com> Date: Mon, 5 Aug 2024 02:05:31 +0200 Subject: [PATCH] release fixes --- docs/blog/release-032.md | 18 +++--------------- docs/migrations/0.32/routes.sh | 11 +++++++++++ packages/html/package.json | 2 +- packages/native/package.json | 1 + packages/primate/package.json | 7 +++---- 5 files changed, 19 insertions(+), 20 deletions(-) create mode 100755 docs/migrations/0.32/routes.sh diff --git a/docs/blog/release-032.md b/docs/blog/release-032.md index 66d1563b..e8acf397 100644 --- a/docs/blog/release-032.md +++ b/docs/blog/release-032.md @@ -231,24 +231,11 @@ export default { }; ``` -You can apply the following command in your routes directory to convert +You can apply a [route migration script] your routes directory to convert all routes to the new format. -```sh -find . -type f -exec sed -i 's/import { view } from "primate"/import view from "primate\/handler\/view"/g' {} + && -find . -type f -exec sed -i "s/import { view } from 'primate'/import view from 'primate\/handler\/view'/g" {} + && -find . -type f -exec sed -i 's/import { error } from "primate"/import error from "primate\/handler\/error"/g' {} + && -find . -type f -exec sed -i "s/import { error } from 'primate'/import error from 'primate\/handler\/error'/g" {} + && -find . -type f -exec sed -i 's/import { redirect } from "primate"/import redirect from "primate\/handler\/redirect "/g' {} + && -find . -type f -exec sed -i "s/import { redirect } from 'primate'/import redirect from 'primate\/handler\/redirect'/g" {} + && -find . -type f -exec sed -i 's/import { ws } from "primate"/import ws from "primate\/handler\/ws"/g' {} + && -find . -type f -exec sed -i "s/import { ws } from 'primate'/import ws from 'primate\/handler\/ws'/g" {} + && -find . -type f -exec sed -i 's/import { sse } from "primate"/import sse from "primate\/handler\/sse"/g' {} + && -find . -type f -exec sed -i "s/import { sse } from 'primate'/import sse from 'primate\/handler\/sse'/g" {} + -``` - !!! -Note that this command won't convert combined imports of the form +Note that the script won't convert combined imports of the form `import { view, redirect } from "primate";`. !!! @@ -312,3 +299,4 @@ Otherwise, have a blast with the new version! [Voby]: https://github.com/vobyjs/voby [discord]: https://discord.gg/RSg4NNwM4f [HTML frontend]: /modules/html +[route migration script]: https://github.com/primatejs/primate/tree/master/docs/migrations/0.32/routes.sh diff --git a/docs/migrations/0.32/routes.sh b/docs/migrations/0.32/routes.sh new file mode 100755 index 00000000..310d5da2 --- /dev/null +++ b/docs/migrations/0.32/routes.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +find . -type f -exec sed -i 's/import view from "primate/handler/view"/import view from "primate\/handler\/view"/g' {} + && +find . -type f -exec sed -i "s/import view from 'primate/handler/view'/import view from 'primate\/handler\/view'/g" {} + && +find . -type f -exec sed -i 's/import error from "primate/handler/error"/import error from "primate\/handler\/error"/g' {} + && +find . -type f -exec sed -i "s/import error from 'primate/handler/error'/import error from 'primate\/handler\/error'/g" {} + && +find . -type f -exec sed -i 's/import redirect from "primate/handler/redirect "/import redirect from "primate\/handler\/redirect "/g' {} + && +find . -type f -exec sed -i "s/import redirect from 'primate/handler/redirect'/import redirect from 'primate\/handler\/redirect'/g" {} + && +find . -type f -exec sed -i 's/import ws from "primate/handler/ws"/import ws from "primate\/handler\/ws"/g' {} + && +find . -type f -exec sed -i "s/import ws from 'primate/handler/ws'/import ws from 'primate\/handler\/ws'/g" {} + && +find . -type f -exec sed -i 's/import sse from "primate/handler/sse"/import sse from "primate\/handler\/sse"/g' {} + && +find . -type f -exec sed -i "s/import sse from 'primate/handler/sse'/import sse from 'primate\/handler\/sse'/g" {} + diff --git a/packages/html/package.json b/packages/html/package.json index 4b08dcbd..be198cbf 100644 --- a/packages/html/package.json +++ b/packages/html/package.json @@ -1,6 +1,6 @@ { "name": "@primate/html", - "version": "0.1.0", + "version": "0.10.0", "description": "Primate HTML frontend", "homepage": "https://primatejs.com/modules/html", "bugs": "https://github.com/primatejs/primate/issues", diff --git a/packages/native/package.json b/packages/native/package.json index 9958f85a..140ae2bb 100644 --- a/packages/native/package.json +++ b/packages/native/package.json @@ -15,6 +15,7 @@ "directory": "packages/native" }, "dependencies": { + "@primate/core": "workspace:^", "@rcompat/cli": "^0.5.1", "@rcompat/fs": "^0.4.0", "@rcompat/stdio": "^0.4.0", diff --git a/packages/primate/package.json b/packages/primate/package.json index a000d463..0a8cb720 100644 --- a/packages/primate/package.json +++ b/packages/primate/package.json @@ -30,9 +30,8 @@ "type": "module", "types": "./types/index.d.ts", "exports": { - "./handler/*": "./src/handlers/*.js" - }, - "scripts": { - "prepublishOnly": "dts-buddy" + "./handler/*": { + "default": "./src/handlers/*.js" + } } }