Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*.sh
node_modules
*.md
*.woff
*.ttf
.vscode
.idea
*/dist
/public
/docs
.husky
.local
/bin
Dockerfile
.npmrc
config
*.config.js
11 changes: 11 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"plugins": ["prettier"],
"extends": ["taro", "plugin:react/jsx-runtime", "plugin:prettier/recommended"],
"rules": {
"react-hooks/exhaustive-deps": 0,
"prettier/prettier": 2,
"@typescript-eslint/no-unused-vars": 2,
"import/no-commonjs": 0,
"@typescript-eslint/no-shadow": 0
}
}
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.DS_Store
.history
.idea
node_modules
package-lock.json
*/dist
lib
*.zip

#packages
/packages/hooks
/packages/utils

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directornd files
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
13 changes: 13 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/dist/*
.local
.output.js
/node_modules/**

**/*.svg
**/*.sh

/public/*

.md
.npmrc
*/dist
16 changes: 16 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true,
"quoteProps": "as-needed",
"bracketSpacing": true,
"trailingComma": "all",
"jsxSingleQuote": true,
"arrowParens": "always",
"insertPragma": false,
"requirePragma": false,
"proseWrap": "never",
"endOfLine": "auto"
}
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## **ygp-taro-react-design**

基于taro react的跨端ui库

目录结构

```json
taro-demo 组件库小程序demo
packages 包文件夹
components 组件
hooks 钩子函数
utils 工具类
styles 样式
site 文档静态站点

```

###### **组件列表**
27 changes: 27 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
ignores: [(commit) => commit.includes('init')],
extends: ['@commitlint/config-conventional'],
rules: {
'body-leading-blank': [2, 'always'],
'footer-leading-blank': [1, 'always'],
'header-max-length': [2, 'always', 108],
'subject-empty': [2, 'never'],
'type-empty': [2, 'never'],
'type-enum': [
2,
'always',
[
'feat', //新增功能
'fix', //缺陷修复
'perf', //优化相关
'style', //格式
'docs', //文档
'test', //测试
'refactor', //功能重构
'build', //版本构建
'chore', //构建过程或辅助工具的变动。
'revert', //回滚到上一个版本
],
],
},
}
83 changes: 83 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"name": "ygp-taro-react-design",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev:weapp": "cd taro-demo && npm run dev:weapp",
"dev:h5": "cd taro-demo && npm run dev:h5",
"build": "cd packages && npm run build",
"publish": "cd packages && npm run publish",
"prepare": "husky install"
},
"repository": {
"type": "git",
"url": "http://gitlab.yigongpin.net/ygp-bciscm-frontend/ygp-taro-react-design.git"
},
"author": "",
"license": "ISC",
"dependencies": {
"@babel/runtime": "^7.7.7",
"@tarojs/components": "3.4.3",
"@tarojs/plugin-framework-react": "3.4.3",
"@tarojs/react": "3.4.3",
"@tarojs/runtime": "3.4.3",
"@tarojs/taro": "3.4.3",
"async-validator": "^4.2.5",
"classnames": "^2.3.1",
"lodash": "^4.17.21",
"rc-field-form": "^1.27.1",
"react": "^17.0.0",
"react-dom": "^17.0.0"
},
"devDependencies": {
"@babel/core": "^7.8.0",
"@babel/eslint-parser": "^7.18.9",
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@rollup/plugin-typescript": "^8.3.3",
"@tarojs/mini-runner": "3.4.3",
"@tarojs/webpack-runner": "3.4.3",
"@types/react": "^17.0.2",
"@types/uuid": "^8.3.4",
"@types/webpack-env": "^1.13.6",
"@typescript-eslint/eslint-plugin": "^5.6.0",
"@typescript-eslint/parser": "^5.6.0",
"babel-preset-taro": "3.4.3",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.23.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-taro": "^3.4.3",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.31.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-taro": "^3.3.20",
"fs-extra": "^8.1.0",
"husky": "^8.0.1",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"rimraf": "^2.7.1",
"rollup": "^2.79.1",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-typescript2": "^0.34.1",
"stylelint": "^14.4.0",
"tslib": "^2.4.0",
"typescript": "^4.8.4"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --fix",
"prettier --write",
"eslint"
],
"*.less": [
"prettier --write"
]
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
3 changes: 3 additions & 0 deletions packages/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## **ygp-taro-react-design**

基于taro react的跨端ui库
11 changes: 11 additions & 0 deletions packages/build/after-build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import fs from 'fs-extra'
import { resolveFile, modules } from './scripts.js'

const refs = modules.map((dir) => `/// <reference path="../${dir}/index.d.ts" />`)
const dtsPath = resolveFile('dist/index.d.ts')
const dts = await fs.readFileSync(dtsPath, 'utf-8').split(/\r\n|\n|\r/gm)
const newDts = refs.concat(dts).join('\r\n')

fs.writeFileSync(dtsPath, newDts)

console.info('success!')
11 changes: 11 additions & 0 deletions packages/build/before-build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import fs from 'fs-extra'
import { resolveFile } from './scripts.js'

const Package = await fs.readJSON('package.json')
const files = Package.files

// 删除文件夹
files.forEach((f) => {
const folderPath = resolveFile(f)
fs.removeSync(folderPath)
})
7 changes: 7 additions & 0 deletions packages/build/scripts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import path from 'path'

const cwd = process.cwd()

export const modules = ['hooks']

export const resolveFile = (filePath) => path.join(cwd, filePath)
31 changes: 31 additions & 0 deletions packages/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "taro-react-form",
"version": "1.0.0",
"description": "",
"main": "dist/index.js",
"type": "module",
"types": "dist/index.d.ts",
"typings": "dist/index.d.ts",
"scripts": {
"build": "node build/before-build.js && rollup -c rollup.config.js && node build/after-build.js"
},
"repository": {
"type": "git",
"url": "https://github.com/RickTam/taro-react-form.git"
},
"publishConfig": {
"registry": "http://localhost:4873/"
},
"files": [
"dist",
"hooks",
"utils"
],
"author": "tanyufeng",
"license": "ISC",
"dependencies": {
"async-validator": "^4.2.5",
"classnames": "^2.3.1",
"rc-field-form": "^1.27.1"
}
}
66 changes: 66 additions & 0 deletions packages/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import RollupTypescript from 'rollup-plugin-typescript2'
import RollupCopy from 'rollup-plugin-copy'
import { resolveFile, modules } from './build/scripts.js'

const externalPackages = [
'classnames',
'react',
'react-dom',
'@tarojs/components',
'@tarojs/runtime',
'@tarojs/taro',
'@tarojs/react',
'rc-field-form',
]

const genConfig = (module) => {
return {
input: resolveFile(`src/${module}/index.ts`),
output: [
{
file: resolveFile(`${module}/index.js`),
format: 'esm',
},
],
plugins: [
RollupTypescript({
tsconfig: resolveFile(`src/${module}/tsconfig.json`),
}),
],
}
}

export default [
...modules.map((m) => genConfig(m)),
{
input: resolveFile('src/index.ts'),
output: [
{
file: resolveFile('dist/index.js'),
format: 'esm',
sourcemap: false,
globals: {
react: 'React',
'react-dom': 'ReactDOM',
},
},
],
external: externalPackages,
extensions: ['json', 'js', 'ts'],
plugins: [
RollupTypescript({
clean: true,
tsconfig: resolveFile('tsconfig.json'),
}),
RollupCopy({
verbose: true,
targets: [
{
src: resolveFile('src/styles'),
dest: resolveFile('dist'),
},
],
}),
],
},
]
Loading