Merge pull request #27 from antonio-ivanovski/fix-dist-import 191b0192
fix: remove /dist from module imports
Steve Simkins · 2026-02-15 16:05 26 file(s) · +50 −41
src/installers/rpc.ts +10 −1
4 4
import fs from "fs-extra";
5 5
import pc from "picocolors";
6 6
import yoctoSpinner from "yocto-spinner";
7 -
import { honoClientTemplate, honoRpcTemplate } from "@/utils/templates";
8 7
import type { ProjectOptions } from "@/types";
9 8
import { EXTRAS_DIR } from "@/utils";
10 9
import { nameGenerator } from "@/utils/name-generator";
10 +
import { honoClientTemplate, honoRpcTemplate } from "@/utils/templates";
11 11
12 12
export async function rpcInstaller(
13 13
	options: Required<ProjectOptions>,
34 34
35 35
		// Update the dev script to include parallel TypeScript compilation
36 36
		serverPkg.scripts.dev = "bun --watch run src/index.ts & tsc --watch";
37 +
38 +
		// Add exports mapping for server/client subpath
39 +
		serverPkg.exports = {
40 +
			...serverPkg.exports,
41 +
			"./client": {
42 +
				types: "./dist/client.d.ts",
43 +
				default: "./dist/client.js",
44 +
			},
45 +
		};
37 46
38 47
		await fs.writeJson(serverPkgPath, serverPkg, { spaces: 2 });
39 48
src/templates/extras/client/src/App.tsx/App-with-rpc-shadcn-tailwind-tanstackquery.tsx +2 −2
1 +
import { useMutation } from "@tanstack/react-query";
2 +
import { hcWithType } from "server/client";
1 3
import beaver from "./assets/beaver.svg";
2 4
import { Button } from "./components/ui/button";
3 -
import { hcWithType } from "server/dist/client";
4 -
import { useMutation } from "@tanstack/react-query";
5 5
6 6
const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000";
7 7
src/templates/extras/client/src/App.tsx/App-with-rpc-shadcn-tailwind.tsx +1 −1
1 1
import { useState } from "react";
2 +
import { hcWithType } from "server/client";
2 3
import beaver from "./assets/beaver.svg";
3 4
import { Button } from "./components/ui/button";
4 -
import { hcWithType } from "server/dist/client";
5 5
6 6
const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000";
7 7
src/templates/extras/client/src/App.tsx/App-with-rpc-tailwind-tanstackquery.tsx +2 −2
1 -
import beaver from "./assets/beaver.svg";
2 -
import { hcWithType } from "server/dist/client";
3 1
import { useMutation } from "@tanstack/react-query";
2 +
import { hcWithType } from "server/client";
3 +
import beaver from "./assets/beaver.svg";
4 4
5 5
const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000";
6 6
src/templates/extras/client/src/App.tsx/App-with-rpc-tailwind.tsx +1 −1
1 1
import { useState } from "react";
2 +
import { hcWithType } from "server/client";
2 3
import beaver from "./assets/beaver.svg";
3 -
import { hcWithType } from "server/dist/client";
4 4
5 5
const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000";
6 6
src/templates/extras/client/src/App.tsx/App-with-rpc-tanstackquery.tsx +2 −2
1 -
import beaver from "./assets/beaver.svg";
2 -
import { hcWithType } from "server/dist/client";
3 1
import { useMutation } from "@tanstack/react-query";
2 +
import { hcWithType } from "server/client";
3 +
import beaver from "./assets/beaver.svg";
4 4
import "./App.css";
5 5
6 6
const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000";
src/templates/extras/client/src/App.tsx/App-with-rpc.tsx +1 −1
1 1
import { useState } from "react";
2 +
import { hcWithType } from "server/client";
2 3
import beaver from "./assets/beaver.svg";
3 -
import { hcWithType } from "server/dist/client";
4 4
import "./App.css";
5 5
6 6
const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000";
src/templates/extras/client/src/components/Home.tsx/Home-with-reactroutermpa-rpc-shadcn-tailwind-tanstackquery.tsx +2 −2
1 +
import { useMutation } from "@tanstack/react-query";
1 2
import { useState } from "react";
3 +
import { hcWithType } from "server/client";
2 4
import beaver from "@/assets/beaver.svg";
3 5
import { Button } from "@/components/ui/button";
4 -
import { hcWithType } from "server/dist/client";
5 -
import { useMutation } from "@tanstack/react-query";
6 6
import ClientOnly from "./ClientOnly";
7 7
8 8
const SERVER_URL = import.meta.env.DEV ? "http://localhost:3000" : "/api";
src/templates/extras/client/src/components/Home.tsx/Home-with-reactroutermpa-rpc-shadcn-tailwind.tsx +1 −1
1 1
import { useState } from "react";
2 +
import { hcWithType } from "server/client";
2 3
import beaver from "@/assets/beaver.svg";
3 4
import { Button } from "@/components/ui/button";
4 -
import { hcWithType } from "server/dist/client";
5 5
import ClientOnly from "./ClientOnly";
6 6
7 7
const SERVER_URL = import.meta.env.DEV ? "http://localhost:3000" : "/api";
src/templates/extras/client/src/components/Home.tsx/Home-with-reactroutermpa-rpc-tailwind-tanstackquery.tsx +2 −2
1 +
import { useMutation } from "@tanstack/react-query";
1 2
import { useState } from "react";
3 +
import { hcWithType } from "server/client";
2 4
import beaver from "../assets/beaver.svg";
3 -
import { hcWithType } from "server/dist/client";
4 -
import { useMutation } from "@tanstack/react-query";
5 5
import ClientOnly from "./ClientOnly";
6 6
7 7
const SERVER_URL = import.meta.env.DEV ? "http://localhost:3000" : "/api";
src/templates/extras/client/src/components/Home.tsx/Home-with-reactroutermpa-rpc-tailwind.tsx +1 −1
1 1
import { useState } from "react";
2 +
import { hcWithType } from "server/client";
2 3
import beaver from "../assets/beaver.svg";
3 -
import { hcWithType } from "server/dist/client";
4 4
import ClientOnly from "./ClientOnly";
5 5
6 6
const SERVER_URL = import.meta.env.DEV ? "http://localhost:3000" : "/api";
src/templates/extras/client/src/components/Home.tsx/Home-with-reactroutermpa-rpc-tanstackquery.tsx +2 −2
1 +
import { useMutation } from "@tanstack/react-query";
1 2
import { useState } from "react";
3 +
import { hcWithType } from "server/client";
2 4
import beaver from "../assets/beaver.svg";
3 -
import { hcWithType } from "server/dist/client";
4 -
import { useMutation } from "@tanstack/react-query";
5 5
import "../App.css";
6 6
import ClientOnly from "./ClientOnly";
7 7
src/templates/extras/client/src/components/Home.tsx/Home-with-reactroutermpa-rpc.tsx +1 −1
1 1
import { useState } from "react";
2 +
import { hcWithType } from "server/client";
2 3
import beaver from "../assets/beaver.svg";
3 -
import { hcWithType } from "server/dist/client";
4 4
import "../App.css";
5 5
import ClientOnly from "./ClientOnly";
6 6
src/templates/extras/client/src/components/Home.tsx/Home-with-rpc-shadcn-tailwind-tanstackquery.tsx +2 −2
1 +
import { useMutation } from "@tanstack/react-query";
1 2
import { useState } from "react";
3 +
import { hcWithType } from "server/client";
2 4
import beaver from "@/assets/beaver.svg";
3 5
import { Button } from "@/components/ui/button";
4 -
import { hcWithType } from "server/dist/client";
5 -
import { useMutation } from "@tanstack/react-query";
6 6
7 7
const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000";
8 8
src/templates/extras/client/src/components/Home.tsx/Home-with-rpc-shadcn-tailwind.tsx +1 −1
1 1
import { useState } from "react";
2 +
import { hcWithType } from "server/client";
2 3
import beaver from "@/assets/beaver.svg";
3 4
import { Button } from "@/components/ui/button";
4 -
import { hcWithType } from "server/dist/client";
5 5
6 6
const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000";
7 7
src/templates/extras/client/src/components/Home.tsx/Home-with-rpc-tailwind-tanstackquery.tsx +2 −2
1 +
import { useMutation } from "@tanstack/react-query";
1 2
import { useState } from "react";
3 +
import { hcWithType } from "server/client";
2 4
import beaver from "../assets/beaver.svg";
3 -
import { hcWithType } from "server/dist/client";
4 -
import { useMutation } from "@tanstack/react-query";
5 5
6 6
const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000";
7 7
src/templates/extras/client/src/components/Home.tsx/Home-with-rpc-tailwind.tsx +1 −1
1 1
import { useState } from "react";
2 +
import { hcWithType } from "server/client";
2 3
import beaver from "../assets/beaver.svg";
3 -
import { hcWithType } from "server/dist/client";
4 4
5 5
const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000";
6 6
src/templates/extras/client/src/components/Home.tsx/Home-with-rpc-tanstackquery.tsx +2 −2
1 +
import { useMutation } from "@tanstack/react-query";
1 2
import { useState } from "react";
3 +
import { hcWithType } from "server/client";
2 4
import beaver from "../assets/beaver.svg";
3 -
import { hcWithType } from "server/dist/client";
4 -
import { useMutation } from "@tanstack/react-query";
5 5
import "../App.css";
6 6
7 7
const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000";
src/templates/extras/client/src/components/Home.tsx/Home-with-rpc.tsx +1 −1
1 1
import { useState } from "react";
2 +
import { hcWithType } from "server/client";
2 3
import beaver from "../assets/beaver.svg";
3 -
import { hcWithType } from "server/dist/client";
4 4
import "../App.css";
5 5
6 6
const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000";
src/templates/extras/client/src/routes/index.tsx/index-with-rpc-shadcn-tailwind-tanstackquery.tsx +2 −2
1 +
import { useMutation } from "@tanstack/react-query";
1 2
import { createFileRoute } from "@tanstack/react-router";
2 3
import { useState } from "react";
4 +
import { hcWithType } from "server/client";
3 5
import beaver from "@/assets/beaver.svg";
4 6
import { Button } from "@/components/ui/button";
5 -
import { hcWithType } from "server/dist/client";
6 -
import { useMutation } from "@tanstack/react-query";
7 7
8 8
export const Route = createFileRoute("/")({
9 9
	component: Index,
src/templates/extras/client/src/routes/index.tsx/index-with-rpc-shadcn-tailwind.tsx +1 −1
1 1
import { createFileRoute } from "@tanstack/react-router";
2 2
import { useState } from "react";
3 +
import { hcWithType } from "server/client";
3 4
import beaver from "@/assets/beaver.svg";
4 5
import { Button } from "@/components/ui/button";
5 -
import { hcWithType } from "server/dist/client";
6 6
7 7
export const Route = createFileRoute("/")({
8 8
	component: Index,
src/templates/extras/client/src/routes/index.tsx/index-with-rpc-tailwind-tanstackquery.tsx +2 −2
1 +
import { useMutation } from "@tanstack/react-query";
1 2
import { createFileRoute } from "@tanstack/react-router";
2 3
import { useState } from "react";
4 +
import { hcWithType } from "server/client";
3 5
import beaver from "../assets/beaver.svg";
4 -
import { hcWithType } from "server/dist/client";
5 -
import { useMutation } from "@tanstack/react-query";
6 6
7 7
export const Route = createFileRoute("/")({
8 8
	component: Index,
src/templates/extras/client/src/routes/index.tsx/index-with-rpc-tailwind.tsx +1 −1
1 1
import { createFileRoute } from "@tanstack/react-router";
2 2
import { useState } from "react";
3 +
import { hcWithType } from "server/client";
3 4
import beaver from "../assets/beaver.svg";
4 -
import { hcWithType } from "server/dist/client";
5 5
6 6
export const Route = createFileRoute("/")({
7 7
	component: Index,
src/templates/extras/client/src/routes/index.tsx/index-with-rpc-tanstackquery.tsx +2 −2
1 +
import { useMutation } from "@tanstack/react-query";
1 2
import { createFileRoute } from "@tanstack/react-router";
2 3
import { useState } from "react";
4 +
import { hcWithType } from "server/client";
3 5
import beaver from "../assets/beaver.svg";
4 -
import { hcWithType } from "server/dist/client";
5 -
import { useMutation } from "@tanstack/react-query";
6 6
import "../App.css";
7 7
8 8
export const Route = createFileRoute("/")({
src/templates/extras/client/src/routes/index.tsx/index-with-rpc.tsx +1 −1
1 1
import { createFileRoute } from "@tanstack/react-router";
2 2
import { useState } from "react";
3 +
import { hcWithType } from "server/client";
3 4
import beaver from "../assets/beaver.svg";
4 -
import { hcWithType } from "server/dist/client";
5 5
import "../App.css";
6 6
7 7
export const Route = createFileRoute("/")({
src/utils/templates.ts +4 −4
14 14
15 15
export const honoRpcTemplate = `import { Hono } from "hono";
16 16
import { cors } from "hono/cors";
17 -
import type { ApiResponse } from "shared/dist";
17 +
import type { ApiResponse } from "shared";
18 18
19 19
export const app = new Hono()
20 20
46 46
47 47
export const tailwindTemplate = `import { useState } from 'react'
48 48
import beaver from './assets/beaver.svg'
49 -
import { hcWithType } from 'server/dist/client'
49 +
import { hcWithType } from 'server/client'
50 50
51 51
const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000"
52 52
111 111
export const shadcnTemplate = `import { useState } from 'react'
112 112
import beaver from './assets/beaver.svg'
113 113
import { Button } from './components/ui/button'
114 -
import { hcWithType } from 'server/dist/client'
114 +
import { hcWithType } from 'server/client'
115 115
116 116
const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000"
117 117
179 179
180 180
export const defaultTemplate = `import { useState } from 'react'
181 181
import beaver from './assets/beaver.svg'
182 -
import { hcWithType } from 'server/dist/client'
182 +
import { hcWithType } from 'server/client'
183 183
import './App.css'
184 184
185 185
const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000"