Skip to content

Commit

Permalink
feat: use tsup config file and ignore build files from linting
Browse files Browse the repository at this point in the history
  • Loading branch information
samhwang committed Jun 3, 2023
1 parent c61fd63 commit e8c46d5
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 10 deletions.
2 changes: 2 additions & 0 deletions packages/trpc-netlify-functions/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
coverage
2 changes: 1 addition & 1 deletion packages/trpc-netlify-functions/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"parserOptions": {
"project": "./tsconfig.json"
}
}
}
2 changes: 2 additions & 0 deletions packages/trpc-netlify-functions/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
coverage
9 changes: 4 additions & 5 deletions packages/trpc-netlify-functions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ import { initTRPC } from '@trpc/server';
export const t = initTRPC.create();

export const userRouter = t.router({
me: t.procedure.query((_req) => "hello, it's me"),
me: t.procedure.query((_req) => "hello, it's me"),
});

export const appRouter = t.router({
users: userRouter,
users: userRouter,
});

export type AppRouter = typeof appRouter;

```

```ts
Expand Down Expand Up @@ -65,5 +64,5 @@ export const handler = netlifyTRPCHandler({
Build and deploy your code, and you can use your Netlify Functions URL to call your function.

| Endpoint | HTTP URI |
|------------|----------------------------------------------------------------|
| `users.me` | `GET https://<your-site-url>/.netlify/functions/trpc/users.me` |
| ---------- | -------------------------------------------------------------- |
| `users.me` | `GET https://<your-site-url>/.netlify/functions/trpc/users.me` |
4 changes: 2 additions & 2 deletions packages/trpc-netlify-functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --dts",
"build": "tsup",
"lint": "eslint --cache .",
"lint:fix": "npm run lint --fix",
"test": "vitest run",
"prettier": "prettier --cache --write .",
"format": "npm run lint:fix && npm run prettier && prisma format",
"format": "npm run lint:fix && npm run prettier",
"typecheck": "tsc",
"release": "pnpm run build && changeset publish"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/trpc-netlify-functions/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "../../tsconfig.json",
"include": ["src", "vitest.config.ts"]
}
"include": ["src", "vitest.config.ts", "tsup.config.ts"]
}
9 changes: 9 additions & 0 deletions packages/trpc-netlify-functions/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from 'tsup';

export default defineConfig({
entry: ['src/index.ts'],
format: ['cjs', 'esm'],
outDir: 'dist',
dts: true,
sourcemap: true,
});

0 comments on commit e8c46d5

Please sign in to comment.