Skip to content

Commit

Permalink
docs(changeset): --force flag
Browse files Browse the repository at this point in the history
  • Loading branch information
nksaraf committed Oct 21, 2023
1 parent d7850e4 commit f2cbc3c
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 16 deletions.
6 changes: 6 additions & 0 deletions .changeset/grumpy-adults-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"vinxi": patch
"@vinxi/plugin-references": patch
---

--force flag
16 changes: 6 additions & 10 deletions examples/vanilla/trpc/app.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { fileURLToPath } from "url";
import { createApp } from "vinxi";
import { config } from "vinxi/plugins/config";
import { input } from "vinxi/plugins/config";

/** @returns {import('vinxi').RouterSchemaInput} */
function trpcRouter({ plugins = () => [] } = {}) {
return {
name: "server",
Expand All @@ -10,15 +11,10 @@ function trpcRouter({ plugins = () => [] } = {}) {
handler: fileURLToPath(new URL("./handler.js", import.meta.url)),
target: "server",
plugins: () => [
config("trpc", {
resolve: {
alias: {
"#vinxi/trpc/router": fileURLToPath(
new URL("./app/server.ts", import.meta.url),
),
},
},
}),
input(
"#vinxi/trpc/router",
fileURLToPath(new URL("./app/server.ts", import.meta.url)),
),
],
};
}
Expand Down
2 changes: 1 addition & 1 deletion examples/vanilla/trpc/app/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { t } from "../trpc";
import { t } from "./trpc";

const appRouter = t.router({
greeting: t.procedure.query(() => "hello tRPC v10!"),
Expand Down
File renamed without changes.
5 changes: 0 additions & 5 deletions examples/vanilla/trpc/handler.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import appRouter from "#vinxi/trpc/router";
import { createHTTPHandler } from "@trpc/server/adapters/standalone";
import superjson from "superjson";
import { fromNodeMiddleware } from "vinxi/server";

// // Export only the type of a router!
// // This prevents us from importing server code on the client.
// export type AppRouter = typeof appRouter;

const handler = createHTTPHandler({
router: appRouter,

Expand Down
4 changes: 4 additions & 0 deletions examples/vanilla/trpc/trpc.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module "#vinxi/trpc/router" {
const x: any;
export default x;
}
16 changes: 16 additions & 0 deletions packages/vinxi/lib/plugins/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,19 @@ export function config(tag, conf) {
},
};
}

/**
*
* @param {string} path
* @param {string} file
* @returns {import('../vite-dev.d.ts').Plugin}
*/
export function input(path, file) {
return config(`input-${path}`, {
resolve: {
alias: {
[path]: file,
},
},
});
}

0 comments on commit f2cbc3c

Please sign in to comment.