Skip to content

Commit f01c525

Browse files
authored
ci, badges (#5)
1 parent de23a15 commit f01c525

File tree

10 files changed

+88
-15
lines changed

10 files changed

+88
-15
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ jobs:
2626
- name: Format check
2727
run: npm run format:check
2828

29+
- name: Typecheck
30+
run: npm run typecheck
31+
2932
- name: Lint
3033
run: npm run lint
3134

.husky/pre-push

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#!/usr/bin/env sh
22

3-
echo "Running checks before push..."
4-
5-
npm run lint
6-
npm run test
3+
echo "Running CI checks..."
4+
npm run ci

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import tseslint from 'typescript-eslint';
66
import { defineConfig, globalIgnores } from 'eslint/config';
77

88
export default defineConfig([
9-
globalIgnores(['dist']),
9+
globalIgnores(['dist', 'node_modules', 'build', 'coverage']),
1010
{
1111
files: ['**/*.{ts,tsx}'],
1212
extends: [

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
"scripts": {
77
"dev": "vite",
88
"build": "tsc -b && vite build",
9-
"elint": "eslint .",
10-
"lint": "tsc --noEmit -p tsconfig.json",
119
"preview": "vite preview",
10+
"lint": "eslint .",
11+
"lint:fix": "eslint . --fix",
12+
"typecheck": "tsc --noEmit",
1213
"format": "prettier --write .",
1314
"format:check": "prettier --check .",
1415
"test": "",
16+
"ci": "npm run format:check && npm run typecheck && npm run lint && npm run test",
1517
"lint-staged": "lint-staged",
1618
"prepare": "husky"
1719
},

src/components/Footer/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const Footer = () => {
3131
npm
3232
</Link>
3333
<Link
34-
href="https://github.com/dfsyncjs/dfsync"
34+
href="https://github.com/dfsyncjs/dfsync/tree/main/packages/client"
3535
target="_blank"
3636
rel="noreferrer"
3737
underline="hover"

src/components/Header/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const Header = () => {
3333
</Button>
3434
<Button
3535
color="inherit"
36-
href="https://github.com/dfsyncjs/dfsync"
36+
href="https://github.com/dfsyncjs/dfsync/tree/main/packages/client"
3737
target="_blank"
3838
rel="noreferrer"
3939
startIcon={<GitHubIcon />}

src/components/Hero/Hero.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
2+
import ListIcon from '@mui/icons-material/List';
23
import { Box, Button, Chip, Container, Stack, Typography } from '@mui/material';
4+
import { Link as RouterLink } from 'react-router-dom';
35
import { InstallCommand } from '../InstallCommand/InstallCommand';
6+
import { ProjectBadges } from '../ProjectBadges/ProjectBadges.tsx';
47

58
export const Hero = () => {
69
return (
@@ -37,6 +40,8 @@ export const Hero = () => {
3740
}}
3841
/>
3942

43+
<ProjectBadges />
44+
4045
<Typography
4146
variant="h6"
4247
color="text.secondary"
@@ -64,12 +69,11 @@ export const Hero = () => {
6469
View on npm
6570
</Button>
6671
<Button
72+
component={RouterLink}
6773
variant="outlined"
6874
size="medium"
69-
href="https://github.com/dfsyncjs/dfsync/blob/main/packages/client/README.md"
70-
target="_blank"
71-
rel="noreferrer"
72-
endIcon={<OpenInNewIcon />}
75+
to="/docs"
76+
startIcon={<ListIcon />}
7377
>
7478
Documentation
7579
</Button>
@@ -82,7 +86,7 @@ export const Hero = () => {
8286
mt: 3,
8387
width: '100%',
8488
p: { xs: 3, md: 4 },
85-
borderRadius: 4,
89+
borderRadius: 1,
8690
bgcolor: 'background.paper',
8791
border: '1px solid',
8892
borderColor: 'divider',

src/components/InstallCommand/InstallCommand.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const InstallCommand = () => {
2323
bgcolor: 'background.paper',
2424
border: '1px solid',
2525
borderColor: 'divider',
26-
borderRadius: 3,
26+
borderRadius: 1,
2727
px: 3,
2828
py: 2,
2929
maxWidth: 500,
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import { Stack, Box, Link } from '@mui/material';
2+
3+
const packageName = '@dfsync/client';
4+
const repoName = 'dfsyncjs/dfsync';
5+
6+
export const ProjectBadges = () => {
7+
return (
8+
<Stack direction="row" spacing={1.5} alignItems="center" flexWrap="wrap" sx={{ mt: 2 }}>
9+
{/* npm version */}
10+
<Link
11+
href={`https://www.npmjs.com/package/${packageName}`}
12+
target="_blank"
13+
rel="noreferrer"
14+
underline="none"
15+
sx={{ lineHeight: 1 }}
16+
>
17+
<Box
18+
component="img"
19+
src={`https://img.shields.io/npm/v/${encodeURI(packageName)}`}
20+
alt="npm version"
21+
sx={{ height: 20 }}
22+
/>
23+
</Link>
24+
25+
{/* npm weekly downloads */}
26+
<Link
27+
href={`https://www.npmjs.com/package/${packageName}`}
28+
target="_blank"
29+
rel="noreferrer"
30+
underline="none"
31+
sx={{ lineHeight: 1 }}
32+
>
33+
<Box
34+
component="img"
35+
src={`https://img.shields.io/npm/dw/${encodeURI(packageName)}`}
36+
alt="npm downloads"
37+
sx={{ height: 20 }}
38+
/>
39+
</Link>
40+
41+
{/* github stars */}
42+
<Link
43+
href={`https://github.com/${repoName}/tree/main/packages/client`}
44+
target="_blank"
45+
rel="noreferrer"
46+
underline="none"
47+
sx={{ lineHeight: 1 }}
48+
>
49+
<Box
50+
component="img"
51+
src={`https://img.shields.io/github/stars/${repoName}`}
52+
alt="github stars"
53+
sx={{ height: 20 }}
54+
/>
55+
</Link>
56+
57+
<Box
58+
component="img"
59+
src={`https://img.shields.io/github/license/${repoName}`}
60+
alt="license"
61+
sx={{ height: 20 }}
62+
/>
63+
</Stack>
64+
);
65+
};

src/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export { Features } from './Features/Features';
22
export { Footer } from './Footer/Footer';
33
export { Header } from './Header/Header';
44
export { Hero } from './Hero/Hero';
5+
export { ProjectBadges } from './ProjectBadges/ProjectBadges';

0 commit comments

Comments
 (0)