Skip to content

Commit d11176b

Browse files
committed
Update Biome, enable Tailwind CSS parsing, and reformat code
Bump Biome schema to 2.4.5 and enable CSS parsing with tailwindDirectives across root and package biome configs; add CSS globs to includes. Reformat many TypeScript/TSX files (standardize to double quotes, wrap long JSX/props, consistent imports) across create-sei templates and components, update postcss.config.mjs formatting, and tidy globals.css. Improve create-sei CLI/test code formatting and small CLI enhancements (message formatting, safer prompts, and directory handling). These changes are primarily non-functional style/config updates to support Tailwind directives and maintain consistent code style across the repo.
1 parent d454b0c commit d11176b

97 files changed

Lines changed: 2196 additions & 1754 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

biome.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.2.2/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.4.5/schema.json",
33
"vcs": {
44
"enabled": false,
55
"clientKind": "git",
66
"useIgnoreFile": false
77
},
88
"files": {
99
"ignoreUnknown": false,
10-
"includes": ["packages/*/src/**/*.ts", "packages/*/tests/**/*.ts"]
10+
"includes": ["packages/*/src/**/*.ts", "packages/*/tests/**/*.ts", "**/*.css"]
1111
},
1212
"formatter": {
1313
"enabled": true,
@@ -31,6 +31,11 @@
3131
"quoteStyle": "double"
3232
}
3333
},
34+
"css": {
35+
"parser": {
36+
"tailwindDirectives": true
37+
}
38+
},
3439
"assist": {
3540
"actions": {
3641
"source": {

packages/create-sei/biome.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.2.2/schema.json",
3-
"root": false,
4-
"files": {
5-
"ignoreUnknown": false
6-
}
7-
}
2+
"$schema": "https://biomejs.dev/schemas/2.4.5/schema.json",
3+
"root": false,
4+
"css": {
5+
"parser": {
6+
"tailwindDirectives": true
7+
}
8+
},
9+
"files": {
10+
"ignoreUnknown": false,
11+
"includes": ["src/**/*.ts", "!dist", "!templates"]
12+
}
13+
}

packages/create-sei/extensions/precompiles/src/components/default/index.tsx

Lines changed: 101 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,54 @@
1-
'use client';
1+
"use client";
22

3-
import React from 'react';
4-
import { CodeHighlight } from '@mantine/code-highlight';
5-
import { ActionIcon, Badge, Button, Card, Collapse, Container, Flex, Group, Paper, Stack, Text, ThemeIcon, Title } from '@mantine/core';
6-
import { notifications } from '@mantine/notifications';
7-
import { BANK_PRECOMPILE_ADDRESS, VIEM_BANK_PRECOMPILE_ABI } from '@sei-js/precompiles';
8-
import { IconBulb, IconChevronDown, IconChevronUp, IconCopy, IconDatabase } from '@tabler/icons-react';
9-
import { useState } from 'react';
10-
import { type ReadContractParameters, formatEther } from 'viem';
11-
import { useAccount, usePublicClient } from 'wagmi';
3+
import React from "react";
4+
import { CodeHighlight } from "@mantine/code-highlight";
5+
import {
6+
ActionIcon,
7+
Badge,
8+
Button,
9+
Card,
10+
Collapse,
11+
Container,
12+
Flex,
13+
Group,
14+
Paper,
15+
Stack,
16+
Text,
17+
ThemeIcon,
18+
Title,
19+
} from "@mantine/core";
20+
import { notifications } from "@mantine/notifications";
21+
import {
22+
BANK_PRECOMPILE_ADDRESS,
23+
VIEM_BANK_PRECOMPILE_ABI,
24+
} from "@sei-js/precompiles";
25+
import {
26+
IconBulb,
27+
IconChevronDown,
28+
IconChevronUp,
29+
IconCopy,
30+
IconDatabase,
31+
} from "@tabler/icons-react";
32+
import { useState } from "react";
33+
import { type ReadContractParameters, formatEther } from "viem";
34+
import { useAccount, usePublicClient } from "wagmi";
1235

1336
function Examples() {
14-
const [supply, setSupply] = useState('');
37+
const [supply, setSupply] = useState("");
1538
const [showCode, setShowCode] = useState(false);
1639

1740
const publicClient = usePublicClient();
1841
const { address } = useAccount();
1942

2043
const formatLargeSeiNumber = (num: string, decimals: number): string => {
2144
if (num.length > 10) {
22-
return `${(Number(num) / 1000000 / 1000000000).toLocaleString(navigator.language, {
23-
minimumFractionDigits: decimals,
24-
maximumFractionDigits: decimals
25-
})} B`;
45+
return `${(Number(num) / 1000000 / 1000000000).toLocaleString(
46+
navigator.language,
47+
{
48+
minimumFractionDigits: decimals,
49+
maximumFractionDigits: decimals,
50+
},
51+
)} B`;
2652
}
2753
return (Number(num) / 1000000).toLocaleString(navigator.language);
2854
};
@@ -31,17 +57,17 @@ function Examples() {
3157
try {
3258
navigator.clipboard.writeText(text).then(() => {
3359
notifications.show({
34-
title: 'Copied!',
35-
message: 'Code copied to clipboard',
36-
color: 'green'
60+
title: "Copied!",
61+
message: "Code copied to clipboard",
62+
color: "green",
3763
});
3864
});
3965
} catch (err) {
40-
console.error('Failed to copy text: ', err);
66+
console.error("Failed to copy text: ", err);
4167
notifications.show({
42-
title: 'Error',
43-
message: 'Failed to copy to clipboard',
44-
color: 'red'
68+
title: "Error",
69+
message: "Failed to copy to clipboard",
70+
color: "red",
4571
});
4672
}
4773
};
@@ -54,19 +80,19 @@ function Examples() {
5480
const readContractParams: ReadContractParameters = {
5581
abi: VIEM_BANK_PRECOMPILE_ABI,
5682
address: BANK_PRECOMPILE_ADDRESS,
57-
functionName: 'supply',
58-
args: ['usei']
83+
functionName: "supply",
84+
args: ["usei"],
5985
};
6086

6187
try {
6288
const result = await publicClient.readContract(readContractParams);
6389
setSupply((result as bigint).toString());
6490
} catch (error) {
65-
console.error('Error fetching supply:', error);
91+
console.error("Error fetching supply:", error);
6692
notifications.show({
67-
title: 'Error',
68-
message: 'Failed to fetch SEI supply',
69-
color: 'red'
93+
title: "Error",
94+
message: "Failed to fetch SEI supply",
95+
color: "red",
7096
});
7197
}
7298
};
@@ -103,7 +129,8 @@ const getSeiSupply = async () => {
103129
Sei Precompiles
104130
</Title>
105131
<Text size="lg" c="gray.6" mt={4}>
106-
Access native Sei blockchain functionality through EVM precompiles
132+
Access native Sei blockchain functionality through EVM
133+
precompiles
107134
</Text>
108135
</div>
109136
</Group>
@@ -115,16 +142,27 @@ const getSeiSupply = async () => {
115142
<Flex justify="space-between" align="flex-start">
116143
<Stack gap="xs">
117144
<Group gap="md">
118-
<ThemeIcon size={40} radius="md" color="orange" variant="light">
145+
<ThemeIcon
146+
size={40}
147+
radius="md"
148+
color="orange"
149+
variant="light"
150+
>
119151
<IconDatabase size={20} />
120152
</ThemeIcon>
121153
<Title order={3} fw={600} c="gray.9">
122154
Bank Precompile
123155
</Title>
124156
</Group>
125157
<Text size="sm" c="gray.6">
126-
Query total SEI supply using Sei's native{' '}
127-
<Text component="a" href="https://www.docs.sei.io/dev-interoperability/precompiles/bank" target="_blank" c="orange" td="underline">
158+
Query total SEI supply using Sei's native{" "}
159+
<Text
160+
component="a"
161+
href="https://www.docs.sei.io/dev-interoperability/precompiles/bank"
162+
target="_blank"
163+
c="orange"
164+
td="underline"
165+
>
128166
Bank precompile
129167
</Text>
130168
</Text>
@@ -162,8 +200,15 @@ const getSeiSupply = async () => {
162200
</Paper>
163201
)}
164202
</Flex>
165-
<Button onClick={getSeiSupply} size="sm" radius="md" variant="light" color="orange" leftSection={<IconDatabase size={14} />}>
166-
{supply ? 'Refresh' : 'Query Supply'}
203+
<Button
204+
onClick={getSeiSupply}
205+
size="sm"
206+
radius="md"
207+
variant="light"
208+
color="orange"
209+
leftSection={<IconDatabase size={14} />}
210+
>
211+
{supply ? "Refresh" : "Query Supply"}
167212
</Button>
168213
</Flex>
169214
</Paper>
@@ -174,21 +219,39 @@ const getSeiSupply = async () => {
174219
color="gray"
175220
size="sm"
176221
radius="md"
177-
leftSection={showCode ? <IconChevronUp size={14} /> : <IconChevronDown size={14} />}
222+
leftSection={
223+
showCode ? (
224+
<IconChevronUp size={14} />
225+
) : (
226+
<IconChevronDown size={14} />
227+
)
228+
}
178229
onClick={() => setShowCode(!showCode)}
179230
>
180-
{showCode ? 'Hide' : 'View'} Implementation
231+
{showCode ? "Hide" : "View"} Implementation
181232
</Button>
182233
{showCode && (
183-
<ActionIcon variant="subtle" color="gray" size="sm" radius="md" onClick={() => copyToClipboard(codeExample)}>
234+
<ActionIcon
235+
variant="subtle"
236+
color="gray"
237+
size="sm"
238+
radius="md"
239+
onClick={() => copyToClipboard(codeExample)}
240+
>
184241
<IconCopy size={14} />
185242
</ActionIcon>
186243
)}
187244
</Group>
188245

189246
<Collapse in={showCode}>
190247
<Paper mt="sm" p="md" bg="gray.0" radius="md" withBorder>
191-
<CodeHighlight code={codeExample} language="tsx" withCopyButton={false} expandCodeLabel="" collapseCodeLabel="" />
248+
<CodeHighlight
249+
code={codeExample}
250+
language="tsx"
251+
withCopyButton={false}
252+
expandCodeLabel=""
253+
collapseCodeLabel=""
254+
/>
192255
</Paper>
193256
</Collapse>
194257
</Stack>

packages/create-sei/src/main.test.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { describe, test, expect, beforeEach, afterEach } from 'bun:test';
2-
import { promises as fs } from 'node:fs';
3-
import path from 'node:path';
1+
import { describe, test, expect, beforeEach, afterEach } from "bun:test";
2+
import { promises as fs } from "node:fs";
3+
import path from "node:path";
44

5-
describe('Extension System', () => {
6-
const packageDir = path.resolve(import.meta.dir, '..');
7-
const testDir = path.join(packageDir, 'test-output');
8-
const extensionsDir = path.join(packageDir, 'extensions');
5+
describe("Extension System", () => {
6+
const packageDir = path.resolve(import.meta.dir, "..");
7+
const testDir = path.join(packageDir, "test-output");
8+
const extensionsDir = path.join(packageDir, "extensions");
99

1010
beforeEach(async () => {
1111
// Clean up test directory
@@ -26,14 +26,15 @@ describe('Extension System', () => {
2626
}
2727
});
2828

29-
test('should list available extensions', async () => {
30-
const extensionExists = await fs.access(path.join(extensionsDir, 'precompiles'))
29+
test("should list available extensions", async () => {
30+
const extensionExists = await fs
31+
.access(path.join(extensionsDir, "precompiles"))
3132
.then(() => true)
3233
.catch(() => false);
3334

3435
expect(extensionExists).toBe(true);
3536

3637
const extensionFiles = await fs.readdir(extensionsDir);
37-
expect(extensionFiles).toContain('precompiles');
38+
expect(extensionFiles).toContain("precompiles");
3839
});
3940
});

0 commit comments

Comments
 (0)