Skip to content

Commit 4027e90

Browse files
committed
chore: initial release setup
1 parent 9e3b9fe commit 4027e90

File tree

14 files changed

+119
-89
lines changed

14 files changed

+119
-89
lines changed

.releaserc.json

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,11 @@
11
{
22
"branches": ["main"],
33
"plugins": [
4-
[
5-
"@semantic-release/commit-analyzer",
6-
{
7-
"preset": "angular",
8-
"releaseRules": [
9-
{ "type": "feat", "release": "minor" },
10-
{ "type": "fix", "release": "patch" },
11-
{ "type": "chore", "release": "patch" },
12-
{ "type": "refactor", "release": "patch" },
13-
{ "type": "docs", "release": "patch" },
14-
{ "type": "style", "release": "patch" },
15-
{ "type": "test", "release": "patch" },
16-
{ "type": "build", "release": "patch" },
17-
{ "type": "*", "release": "patch" }
18-
]
19-
}
20-
],
4+
"@semantic-release/commit-analyzer",
215
"@semantic-release/release-notes-generator",
226
"@semantic-release/changelog",
23-
[
24-
"@semantic-release/npm",
25-
{
26-
"npmPublish": true,
27-
"tarballDir": "dist"
28-
}
29-
],
30-
[
31-
"@semantic-release/github",
32-
{
33-
"assets": [
34-
"dist/*.tgz"
35-
]
36-
}
37-
]
7+
"@semantic-release/npm",
8+
"@semantic-release/github"
389
],
3910
"release": {
4011
"initialVersion": "0.0.1"

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@
44
"description": "A modern TypeScript library for integrating Uniswap into your dapp.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
7+
"exports": {
8+
".": {
9+
"import": "./dist/index.js",
10+
"require": "./dist/index.js"
11+
}
12+
},
13+
"files": ["dist/**/*"],
714
"scripts": {
815
"dev": "tsc --watch",
9-
"build": "npm run clean && tsc",
16+
"build": "npm run clean && tsc && tsc-alias",
1017
"format": "biome format",
1118
"lint": "biome check",
1219
"lint:fix": "biome check --write",
@@ -59,6 +66,7 @@
5966
"jsdom": "^26.1.0",
6067
"rimraf": "^6.0.1",
6168
"semantic-release": "^24.1.0",
69+
"tsc-alias": "^1.8.16",
6270
"typedoc": "^0.28.4",
6371
"typescript": "^5.8.3",
6472
"vitest": "^3.1.3"

pnpm-lock.yaml

Lines changed: 56 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/uniDevKitV4Factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { UniDevKitV4 } from "@/core/uniDevKitV4";
2-
import type { UniDevKitV4Config } from "@/types/core";
2+
import type { UniDevKitV4Config } from "@/types";
33

44
const instances = new Map<number, UniDevKitV4>();
55

src/hooks/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { useGetQuote } from "./useGetQuote";
1+
export { useGetQuote } from "@/hooks/useGetQuote";
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
removeInstance,
66
resetInstances,
77
} from "@/core/uniDevKitV4Factory";
8-
import type { UniDevKitV4Config } from "@/types/core";
8+
import type { UniDevKitV4Config } from "@/types";
99
import { afterEach, beforeEach, describe, expect, it } from "vitest";
1010

1111
describe("UniDevKitV4Factory", () => {
Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,17 @@ import { useGetQuote } from "@/hooks/useGetQuote";
22
import { getQuote } from "@/utils/getQuote";
33
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
44
import { renderHook, waitFor } from "@testing-library/react";
5-
import type { ReactNode } from "react";
5+
import { jsx as _jsx } from "react/jsx-runtime";
66
import { parseEther } from "viem";
77
import { beforeEach, describe, expect, it, vi } from "vitest";
8-
98
// Mock getQuote
109
vi.mock("@/utils/getQuote");
11-
12-
const mockGetQuote = getQuote as unknown as ReturnType<typeof vi.fn>;
13-
10+
const mockGetQuote = getQuote;
1411
// Real token addresses on Ethereum mainnet
1512
const USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
1613
const WETH = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
17-
1814
describe("useGetQuote", () => {
19-
let queryClient: QueryClient;
20-
15+
let queryClient;
2116
beforeEach(() => {
2217
queryClient = new QueryClient({
2318
defaultOptions: {
@@ -28,20 +23,15 @@ describe("useGetQuote", () => {
2823
});
2924
vi.resetAllMocks();
3025
});
31-
32-
const wrapper = ({ children }: { children: ReactNode }) => (
33-
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
34-
);
35-
26+
const wrapper = ({ children }) =>
27+
_jsx(QueryClientProvider, { client: queryClient, children: children });
3628
it("should fetch quote successfully", async () => {
3729
const mockQuote = {
3830
amountOut: parseEther("0.5"),
3931
estimatedGasUsed: BigInt(21000),
4032
timestamp: Date.now(),
4133
};
42-
4334
mockGetQuote.mockResolvedValueOnce(mockQuote);
44-
4535
const { result } = renderHook(
4636
() =>
4737
useGetQuote({
@@ -55,14 +45,11 @@ describe("useGetQuote", () => {
5545
}),
5646
{ wrapper },
5747
);
58-
5948
expect(result.current.isLoading).toBe(true);
6049
expect(result.current.data).toBeUndefined();
61-
6250
await waitFor(() => {
6351
expect(result.current.isLoading).toBe(false);
6452
});
65-
6653
expect(result.current.data).toEqual(mockQuote);
6754
expect(mockGetQuote).toHaveBeenCalledWith(
6855
{
@@ -75,11 +62,9 @@ describe("useGetQuote", () => {
7562
undefined,
7663
);
7764
});
78-
7965
it("should handle errors", async () => {
8066
const error = new Error("Failed to fetch quote");
8167
mockGetQuote.mockRejectedValueOnce(error);
82-
8368
const { result } = renderHook(
8469
() =>
8570
useGetQuote({
@@ -93,11 +78,9 @@ describe("useGetQuote", () => {
9378
}),
9479
{ wrapper },
9580
);
96-
9781
await waitFor(() => {
9882
expect(result.current.isLoading).toBe(false);
9983
});
100-
10184
expect(result.current.error).toEqual(error);
10285
});
10386
});

src/types/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export * from "./core";
2-
export * from "./utils";
1+
export * from "@/types/core";
2+
export * from "@/types/utils";

0 commit comments

Comments
 (0)