Skip to content

Commit

Permalink
🔧 chore: add project config
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed May 21, 2023
1 parent 7861f97 commit 250dda4
Show file tree
Hide file tree
Showing 14 changed files with 169 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const config = require('@umijs/lint/dist/config/eslint');

module.exports = {
...config,
extends: ['plugin:@next/next/recommended'],
};
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

# testing
/coverage
.idea

# next.js
/.next/
Expand Down
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit ${1}
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install lint-staged
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lockfile=false
resolution-mode=highest
28 changes: 28 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -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 changes: 13 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 0 deletions .releaserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['semantic-release-config-gitmoji'],
};
10 changes: 10 additions & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['gitmoji'],
};
35 changes: 30 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,58 @@
{
"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",
"react-dom": "^18"
},
"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"
}
}
4 changes: 2 additions & 2 deletions src/pages/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const Home: NextPage = () => {
return (
<>
<Head>
<title>lobehub</title>
<title>lobechat</title>
</Head>
lobehub
lobechat
</>
);
};
Expand Down

0 comments on commit 250dda4

Please sign in to comment.