ci: add code-check workflow (#71)

This commit is contained in:
shadcn
2023-02-10 11:15:33 +04:00
committed by GitHub
parent a94375fb85
commit 19813d25d6
17 changed files with 163 additions and 16 deletions

View File

@@ -11,7 +11,8 @@
"rules": {
"@next/next/no-html-link-for-pages": "off",
"react/jsx-key": "off",
"tailwindcss/no-custom-classname": "off"
"tailwindcss/no-custom-classname": "off",
"tailwindcss/classnames-order": "error"
},
"settings": {
"tailwindcss": {

113
.github/workflows/code-check.yml vendored Normal file
View File

@@ -0,0 +1,113 @@
name: Code check
on:
pull_request:
branches: ["*"]
jobs:
lint:
runs-on: ubuntu-latest
name: Lint
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- uses: pnpm/action-setup@v2.2.4
name: Install pnpm
id: pnpm-install
with:
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- run: pnpm lint
format:
runs-on: ubuntu-latest
name: Format
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- uses: pnpm/action-setup@v2.2.4
name: Install pnpm
id: pnpm-install
with:
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- run: pnpm format:check
tsc:
runs-on: ubuntu-latest
name: TypeScript
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- uses: pnpm/action-setup@v2.2.4
name: Install pnpm
id: pnpm-install
with:
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- run: pnpm typecheck

3
.gitignore vendored
View File

@@ -32,4 +32,5 @@ yarn-error.log*
# turbo
.turbo
.contentlayer
.contentlayer
tsconfig.tsbuildinfo

5
.prettierignore Normal file
View File

@@ -0,0 +1,5 @@
dist
node_modules
.next
build
.contentlayer

5
apps/www/.prettierignore Normal file
View File

@@ -0,0 +1,5 @@
dist
node_modules
.next
build
.contentlayer

View File

@@ -8,13 +8,13 @@ import {
const fontSans = FontSans({
subsets: ["latin"],
variable: "--font-sans",
display: 'swap',
display: "swap",
})
const fontMono = FontMono({
subsets: ["latin"],
variable: "--font-mono",
display: 'swap',
display: "swap",
})
export function Fonts() {

View File

@@ -65,7 +65,7 @@ const DropdownMenuContent = React.forwardRef<
ref={ref}
sideOffset={sideOffset}
className={cn(
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-slate-100 bg-white p-1 text-slate-700 shadow-md dark:border-slate-800 dark:bg-slate-800 dark:text-slate-400 animate-in data-[side=right]:slide-in-from-left-2 data-[side=left]:slide-in-from-right-2 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2",
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-slate-100 bg-white p-1 text-slate-700 shadow-md animate-in data-[side=right]:slide-in-from-left-2 data-[side=left]:slide-in-from-right-2 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 dark:border-slate-800 dark:bg-slate-800 dark:text-slate-400",
className
)}
{...props}

View File

@@ -11,7 +11,7 @@ const Switch = React.forwardRef<
>(({ className, ...props }, ref) => (
<SwitchPrimitives.Root
className={cn(
"peer inline-flex items-center h-[24px] w-[44px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=unchecked]:bg-slate-200 data-[state=checked]:bg-slate-900 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-900 dark:data-[state=unchecked]:bg-slate-700 dark:data-[state=checked]:bg-slate-400",
"peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=unchecked]:bg-slate-200 data-[state=checked]:bg-slate-900 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-900 dark:data-[state=unchecked]:bg-slate-700 dark:data-[state=checked]:bg-slate-400",
className
)}
{...props}

View File

@@ -81,13 +81,12 @@ Dropdown Menu component in the Dialog component. For more information, refer to
<DialogHeader>
<DialogTitle>Are you sure absolutely sure?</DialogTitle>
<DialogDescription>
This action cannot be undone. Are you sure you want to permanently delete this file from our servers?
This action cannot be undone. Are you sure you want to permanently
delete this file from our servers?
</DialogDescription>
</DialogHeader>
<DialogFooter>
<Button type="submit">
Confirm
</Button>
<Button type="submit">Confirm</Button>
</DialogFooter>
</DialogContent>
</Dialog>

View File

@@ -7,7 +7,10 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"preview": "next build && next start"
"preview": "next build && next start",
"typecheck": "contentlayer build && tsc --noEmit",
"format:write": "prettier --write \"**/*.{ts,tsx,mdx}\" --cache",
"format:check": "prettier --check \"**/*.{ts,tsx,mdx}\" --cache"
},
"dependencies": {
"@next/font": "^13.1.6",

View File

@@ -26,6 +26,12 @@
}
]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
".contentlayer/generated"
],
"exclude": ["node_modules"]
}

View File

@@ -17,7 +17,9 @@
"dev": "turbo run dev --parallel",
"lint": "turbo run lint",
"preview": "turbo run preview",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"typecheck": "turbo run typecheck",
"format:write": "turbo run format",
"format:check": "turbo run format:check",
"sync:templates": "./scripts/sync-templates.sh \"templates/*\"",
"prepare": "husky install"
},

View File

@@ -5,3 +5,8 @@ package-lock.json
public
CHANGELOG.md
.yarn
dist
node_modules
.next
build
.contentlayer

View File

@@ -1,6 +1,6 @@
import Link from "next/link"
import { siteConfig } from "@/config/site"
import { siteConfig } from "@/config/site"
import { Icons } from "@/components/icons"
import { MainNav } from "@/components/main-nav"
import { ThemeToggle } from "@/components/theme-toggle"

View File

@@ -7,7 +7,10 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"preview": "next build && next start"
"preview": "next build && next start",
"typecheck": "tsc --noEmit",
"format:write": "prettier --write \"**/*.{ts,tsx,mdx}\" --cache",
"format:check": "prettier --check \"**/*.{ts,tsx,mdx}\" --cache"
},
"dependencies": {
"@next/font": "^13.1.6",

View File

@@ -7,7 +7,7 @@ import "@/styles/globals.css"
const fontSans = FontSans({
subsets: ["latin"],
variable: "--font-sans",
display: 'swap',
display: "swap",
})
export default function App({ Component, pageProps }: AppProps) {

View File

@@ -19,6 +19,10 @@
"lint": {
"outputs": []
},
"format:check": {
"outputs": []
},
"typecheck": {},
"dev": {
"cache": false
}