🔧 chore: add project config

This commit is contained in:
arvinxx
2023-05-21 15:42:20 +08:00
parent 7861f97152
commit 250dda4499
14 changed files with 169 additions and 7 deletions
+6
View File
@@ -0,0 +1,6 @@
const config = require('@umijs/lint/dist/config/eslint');
module.exports = {
...config,
extends: ['plugin:@next/next/recommended'],
};
+33
View File
@@ -0,0 +1,33 @@
name: Release
on:
push:
branches:
- main
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install deps
run: pnpm install
- name: Test
run: pnpm run test
- name: release
run: pnpm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+30
View File
@@ -0,0 +1,30 @@
name: Test CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install deps
run: pnpm install
- name: lint
run: pnpm run lint
- name: Test and coverage
run: pnpm run test:coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
+1
View File
@@ -7,6 +7,7 @@
# testing
/coverage
.idea
# next.js
/.next/
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no -- commitlint --edit ${1}
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no-install lint-staged
+2
View File
@@ -0,0 +1,2 @@
lockfile=false
resolution-mode=highest
+28
View File
@@ -0,0 +1,28 @@
**/*.svg
.umi
.umi-production
/dist
.dockerignore
.DS_Store
.eslintignore
*.png
*.jpg
*.webp
*.toml
*.py
docker
.editorconfig
Dockerfile*
.gitignore
.prettierignore
LICENSE
.eslintcache
*.lock
yarn-error.log
.idea
.husky
.npmrc
.env.local
.next
__snapshots__
.snap
+13
View File
@@ -0,0 +1,13 @@
module.exports = {
printWidth: 100,
singleQuote: true,
trailingComma: 'all',
proseWrap: 'never',
endOfLine: 'lf',
overrides: [{ files: '.prettierrc', options: { parser: 'json' } }],
plugins: [
require.resolve('prettier-plugin-packagejson'),
require.resolve('prettier-plugin-organize-imports'),
],
pluginSearchDirs: false,
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
extends: ['semantic-release-config-gitmoji'],
};
+10
View File
@@ -0,0 +1,10 @@
module.exports = {
extends: ['stylelint-config-recommended', 'stylelint-config-clean-order'],
files: ['*.js', '*.jsx', '*.ts', '*.tsx'],
plugins: ['stylelint-order'],
customSyntax: 'postcss-styled-syntax',
rules: {
'no-empty-source': null,
'no-invalid-double-slash-comments': null,
},
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
extends: ['gitmoji'],
};
+30 -5
View File
@@ -1,20 +1,23 @@
{
"name": "@lobehub/web",
"name": "lobe-chat",
"version": "1.1.0",
"private": true,
"scripts": {
"build": "next build",
"dev": "next dev",
"lint": "next lint && npm run ts-check",
"lint": "next lint && npm run ts-check && npm run stylelint",
"prepare": "husky install",
"prettier": "prettier -c --write \"**/**\"",
"release": "semantic-release",
"start": "next start",
"stylelint": "stylelint \"src/**/*.{js,jsx,ts,tsx}\" --fix",
"test": "vitest",
"test:coverage": "vitest run --coverage",
"test:update": "vitest -u",
"ts-check": "tsc --noEmit"
},
"dependencies": {
"@vercel/analytics": "^0.1",
"@vercel/analytics": "^1",
"lobe-ui": "1.0.0",
"next": "^13",
"react": "^18",
@@ -22,12 +25,34 @@
},
"devDependencies": {
"@next/eslint-plugin-next": "^13",
"@testing-library/jest-dom": "^5",
"@testing-library/react": "^14",
"@types/chroma-js": "^2",
"@types/lodash.isempty": "^4",
"@types/lodash-es": "^4",
"@types/node": "^18",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/testing-library__jest-dom": "^5",
"@types/uuid": "^9",
"@umijs/lint": "^4",
"@vitest/coverage-c8": "latest",
"eslint": "^8",
"husky": "^8",
"jsdom": "^21",
"lint-staged": "^13",
"next-pwa": "^5",
"node-fetch": "^3"
"node-fetch": "^3",
"postcss-styled-syntax": "^0.4",
"prettier": "^2",
"prettier-plugin-organize-imports": "^3",
"prettier-plugin-packagejson": "^2",
"semantic-release": "^20",
"semantic-release-config-gitmoji": "^1",
"stylelint": "^15",
"stylelint-config-clean-order": "^5",
"stylelint-config-recommended": "^12",
"stylelint-order": "^6",
"typescript": "^5",
"vitest": "latest"
}
}
+2 -2
View File
@@ -6,9 +6,9 @@ const Home: NextPage = () => {
return (
<>
<Head>
<title>lobehub</title>
<title>lobechat</title>
</Head>
lobehub
lobechat
</>
);
};