Skip to content

Commit

Permalink
✨ feat: Add or modify imports, update configurations, and add new files
Browse files Browse the repository at this point in the history
- Add or modify imports in various files
- Update configurations in .eslintrc.js, .fatherrc.ts, example/.dumirc.ts, package.json, tsconfig.json, and vitest.config.ts
- Add new files

This commit introduces new features by adding or modifying imports, updating configurations, and adding new files to the project. The changes were made to .eslintrc.js, .fatherrc.ts, example/.dumirc.ts, package.json, src/builtins/Container/style.ts, tsconfig.json, and vitest.config.ts files.
  • Loading branch information
canisminor1990 committed Jul 9, 2023
1 parent b8748a5 commit 465b9a5
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 13 deletions.
10 changes: 9 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
module.exports = require('@lobehub/lint').eslint;
const config = require('@lobehub/lint').eslint;

module.exports = {
...config,
rules: {
...config.rules,
'unicorn/prefer-string-replace-all': 0,
},
};
1 change: 1 addition & 0 deletions .fatherrc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig } from 'father';
import { resolve } from 'node:path';

export default defineConfig({
plugins: ['father-plugin-dumi-theme'],
Expand Down
6 changes: 3 additions & 3 deletions example/.dumirc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'dumi';
import path from 'node:path';
import { resolve } from 'node:path';

import { homepage, name } from '../package.json';

Expand Down Expand Up @@ -58,8 +58,8 @@ const themeConfig = {

export default defineConfig({
alias: {
'@': path.join(__dirname, '../src'),
'dumi-theme-lobehub': path.join(__dirname, '../src'),
'@': resolve(__dirname, 'src'),
'dumi-theme-lobehub': resolve(__dirname, '../src'),
},
codeSplitting: {
jsStrategy: 'granularChunks',
Expand Down
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"scripts": {
"build": "father build",
"build:docs": "npm run build && npm run build --prefix=example",
"ci": "npm run test",
"ci": "npm run lint && npm run type-check && npm run test",
"dev": "father dev",
"dev:docs": "npm run start --prefix=example",
"lint": "eslint \"{src,example}/**/*.{js,jsx,ts,tsx}\" --fix",
Expand All @@ -38,7 +38,9 @@
"prettier": "prettier -c --write --no-error-on-unmatched-pattern \"**/**\"",
"release": "semantic-release",
"start": "concurrently \"npm run dev\" \"npm run dev:docs\"",
"test": "npm run type-check && npm run lint",
"test": "vitest --passWithNoTests",
"test:coverage": "vitest run --coverage --passWithNoTests",
"test:update": "vitest -u",
"type-check": "tsc -p tsconfig-check.json"
},
"lint-staged": {
Expand Down Expand Up @@ -69,7 +71,6 @@
"antd-style": "^3",
"chalk": "^4",
"fast-deep-equal": "^3",
"history": "^5",
"lodash-es": "^4",
"lucide-react": "latest",
"polished": "^4",
Expand All @@ -86,6 +87,7 @@
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@vitest/coverage-c8": "latest",
"antd-style": "^3",
"commitlint": "^17",
"concurrently": "^8",
Expand All @@ -94,7 +96,9 @@
"eslint": "^8",
"father": "^4",
"father-plugin-dumi-theme": "latest",
"history": "^5",
"husky": "^8",
"jsdom": "^22",
"leva": "^0",
"lint-staged": "^13",
"prettier": "^2",
Expand All @@ -104,7 +108,8 @@
"remark-cli": "^11",
"semantic-release": "^21",
"stylelint": "^15",
"typescript": "^5"
"typescript": "^5",
"vitest": "latest"
},
"peerDependencies": {
"antd": ">=5",
Expand Down
2 changes: 1 addition & 1 deletion src/builtins/Container/style.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FullToken, createStyles } from 'antd-style';

const toCamelCase = (string_: string) => {
return string_.replaceAll(/( |^)[a-z]/g, (L) => L.toUpperCase());
return string_.replace(/( |^)[a-z]/g, (L) => L.toUpperCase());
};
export const useStyles = createStyles(({ token, prefixCls, css }) => {
// 把首字母大写
Expand Down
Empty file added tests/test-setup.ts
Empty file.
5 changes: 1 addition & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"declaration": true,
"downlevelIteration": true,
"skipLibCheck": true,
"esModuleInterop": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"jsx": "react-jsx",
"types": ["vitest/globals"],
"baseUrl": ".",
"paths": {
"@@/*": ["example/.dumi/tmp/*"],
Expand Down
21 changes: 21 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { defineConfig } from 'vitest/config';

import { name } from './package.json';

export default defineConfig({
esbuild: {
jsxInject: "import React from 'react'",
},
test: {
alias: {
'@': './src',
[name]: './src',
},
coverage: {
reporter: ['text', 'text-summary', 'json', 'lcov'],
},
environment: 'jsdom',
globals: true,
setupFiles: './tests/test-setup.ts',
},
});

0 comments on commit 465b9a5

Please sign in to comment.