Skip to content

Commit

Permalink
fix blog
Browse files Browse the repository at this point in the history
  • Loading branch information
terrablue committed Aug 5, 2024
1 parent 6eb56f4 commit 30899ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
18 changes: 3 additions & 15 deletions docs/blog/release-032.md
Original file line number Diff line number Diff line change
Expand Up @@ -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";`.
!!!

Expand Down Expand Up @@ -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
11 changes: 11 additions & 0 deletions docs/migrations/0.32/routes.sh
Original file line number Diff line number Diff line change
@@ -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" {} +

0 comments on commit 30899ec

Please sign in to comment.