Skip to content

Commit

Permalink
Merge pull request #2185 from XiaoMi/develop
Browse files Browse the repository at this point in the history
Publish HiUI v4.
  • Loading branch information
solarjoker authored Jul 22, 2022
2 parents 1445e43 + 11447e6 commit 5b5993f
Show file tree
Hide file tree
Showing 3,719 changed files with 139,182 additions and 140,710 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
21 changes: 0 additions & 21 deletions .babelrc

This file was deleted.

1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# MIFE dotfiles

root = true

[*]
Expand Down
40 changes: 31 additions & 9 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,44 @@
// MIFE dotfiles

module.exports = {
parser: '@typescript-eslint/parser',
root: true,
env: {
browser: true,
es2021: true
es2021: true,
'jest/globals': true,
},
parser: 'babel-eslint',
extends: ['plugin:react/recommended', 'standard', 'prettier'],
extends: ['plugin:react/recommended', 'standard', 'prettier', 'prettier/@typescript-eslint'],
parserOptions: {
ecmaFeatures: {
jsx: true
jsx: true,
},
ecmaVersion: 12,
sourceType: 'module'
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'react', 'react-hooks', 'prettier', 'jest'],
settings: {
react: {
version: 'detect',
},
},
plugins: ['react', 'prettier'],
rules: {
'prettier/prettier': ['error', { singleQuote: true, semi: false, printWidth: 120, trailingComma: 'none' }],
'prettier/prettier': [
'error',
{
singleQuote: true,
semi: false,
printWidth: 100,
trailingComma: 'es5',
},
],
'no-use-before-define': 0,
'@typescript-eslint/no-use-before-define': 0,
'react/prop-types': 0,
'react/no-children-prop': 0,
'react/display-name': 0
}
'react-hooks/rules-of-hooks': 2, // check Hook rules
'react-hooks/exhaustive-deps': 1, // check effect deps
'no-case-declarations': 0,
},
ignorePatterns: ['*.d.ts', 'lib'],
}
17 changes: 13 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# MIFE dotfiles

# Output files
dist/
lib/
es/

# Editor generate files
.idea/
.settings/
.vscode/
.tmp/

test/coverage/
packages/*/test/coverage/
# Dev dependencies and cache files
packages/*/node_modules/
node_modules/

# Misc files
*~
~*
Expand All @@ -24,3 +23,13 @@ Thumbs.db
.Spotlight-V100
.Trashes
.eslintrc.json
package-lock.json
lerna-debug.log
yarn-error.log

.turbo
build/**
dist/**
.next/**

storybook-static
49 changes: 49 additions & 0 deletions .hygen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const Path = require('path')

const PROJ_ROOT = __dirname
const resolveApp = (...paths) => Path.resolve(PROJ_ROOT, ...paths)

module.exports = {
templates: resolveApp('.hygen'),
helpers: {
root: () => __dirname,
uiDir: (to) => resolveApp('packages/ui', to),
utilsDir: (to) => resolveApp('packages/utils', to),
hooksDir: (to) => resolveApp('packages/hooks', to),
camelCase: (function () {
const cache = {}
return function (str) {
if (!str) return ''
if (cache[str]) return cache[str]

return (cache[str] = str
.replace(/-([a-z])/g, (_, i) => i.toUpperCase())
.replace(/^([a-z])/, (_, i) => i.toUpperCase())
)
}
})(),
hump: (function () {
const cache = {}
return function (str) {
if (!str) return ''
if (cache[str]) return cache[str]

return (cache[str] = str
.replace(/-([a-z])/g, (_, i) => i.toUpperCase())
)
}
})(),
capt: (function () {
const cache = {}
return function (str) {
if (!str) return ''
if (cache[str]) return cache[str]

return (cache[str] = str
.replace(/-/g, '_')
.replace(/([a-z])/g, (_, i) => i.toUpperCase())
)
}
})(),
},
}
14 changes: 14 additions & 0 deletions .hygen/create/hook/README.md.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
to: <%= h.hooksDir(`${name}/README.md`) %>
---
# `@hi-ui/<%= name %>`

> TODO: description

## Usage

```
const <%= h.hump(name) %> = require('@hi-ui/<%= name %>');

// TODO: DEMONSTRATE API
```
8 changes: 8 additions & 0 deletions .hygen/create/hook/__tests__/{name}.test.js.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
to: <%= h.hooksDir(`${name}/__tests__/${name}.test.js`) %>
---
const <%= h.hump(name) %> = require('../src')

describe('@hi-ui/<%= name %>', () => {
it('needs tests', () => {})
})
4 changes: 4 additions & 0 deletions .hygen/create/hook/jest.config.js.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
to: <%= h.hooksDir(`${name}/jest.config.js`) %>
---
module.exports = require('../../../jest.config')
55 changes: 55 additions & 0 deletions .hygen/create/hook/package.json.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
to: <%= h.hooksDir(`${name}/package.json`) %>
---
{
"name": "@hi-ui/<%= name %>",
"version": "4.0.0-beta.0",
"description": "A sub-package for @hi-ui/hooks.",
"keywords": [],
"author": "HIUI <mi-hiui@xiaomi.com>",
"homepage": "https://github.com/XiaoMi/hiui/tree/master/packages/hooks/<%= name %>#readme",
"license": "MIT",
"directories": {
"lib": "lib",
"test": "__tests__"
},
"files": [
"lib"
],
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
"types": "lib/types/index.d.ts",
"typings": "lib/types/index.d.ts",
"exports": {
".": {
"require": "./lib/cjs/index.js",
"default": "./lib/esm/index.js"
}
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/XiaoMi/hiui.git"
},
"scripts": {
"test": "jest",
"clean": "rimraf lib",
"prebuild": "yarn clean",
"build:esm": "hi-build ./src/index.ts --format esm -d ./lib/esm",
"build:cjs": "hi-build ./src/index.ts --format cjs -d ./lib/cjs",
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib/types",
"build": "concurrently yarn:build:*"
},
"bugs": {
"url": "https://github.com/XiaoMi/hiui/issues"
},
"peerDependencies": {
"react": ">=16.8.6"
},
"devDependencies": {
"@hi-ui/hi-build": "^4.0.0-beta.0",
"react": "^17.0.1"
}
}
16 changes: 16 additions & 0 deletions .hygen/create/hook/src/index.ts.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
to: <%= h.hooksDir(`${name}/src/index.ts`) %>
---
import { } from 'react'

/**
* TODO: What is <%= h.hump(name) %>
*/
export const <%= h.hump(name) %> = ({}: <%= h.camelCase(name) %>Props) => {

}

export interface <%= h.camelCase(name) %>Props {
}

export type <%= h.camelCase(name) %>Return = ReturnType<typeof <%= h.hump(name) %>>
7 changes: 7 additions & 0 deletions .hygen/create/hook/tsconfig.json.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
to: <%= h.hooksDir(`${name}/tsconfig.json`) %>
---
{
"extends": "../../../tsconfig.json",
"include": ["./src"]
}
14 changes: 14 additions & 0 deletions .hygen/create/ui-pro/README.md.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
to: <%= h.uiDir(`${name}/README.md`) %>
---
# `@hi-ui/<%= name %>`

> TODO: description

## Usage

```
const <%= h.camelCase(name) %> = require('@hi-ui/<%= name %>');

// TODO: DEMONSTRATE API
```
8 changes: 8 additions & 0 deletions .hygen/create/ui-pro/__tests__/{name}.test.js.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
to: <%= h.uiDir(`${name}/__tests__/${name}.test.js`) %>
---
const <%= h.camelCase(name) %> = require('../src')

describe('@hi-ui/<%= name %>', () => {
it('needs tests', () => {})
})
15 changes: 15 additions & 0 deletions .hygen/create/ui-pro/hi-docs.config.mdx.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# <%= h.camelCase(name) %> 组件中文名

组件一句话介绍

## 何时使用

何时使用介绍

## 使用示例

<!-- Inject Stories -->

## Props

<!-- Inject Props -->
4 changes: 4 additions & 0 deletions .hygen/create/ui-pro/jest.config.js.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
to: <%= h.uiDir(`${name}/jest.config.js`) %>
---
module.exports = require('../../../jest.config')
61 changes: 61 additions & 0 deletions .hygen/create/ui-pro/package.json.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
to: <%= h.uiDir(`${name}/package.json`) %>
---
{
"name": "@hi-ui/<%= name %>",
"version": "4.0.0-beta.0",
"description": "A sub-package for @hi-ui/hiui.",
"keywords": [],
"author": "HIUI <mi-hiui@xiaomi.com>",
"homepage": "https://github.com/XiaoMi/hiui/tree/master/packages/ui/<%= name %>#readme",
"license": "MIT",
"directories": {
"lib": "lib",
"test": "__tests__"
},
"files": [
"lib"
],
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
"types": "lib/types/index.d.ts",
"typings": "lib/types/index.d.ts",
"exports": {
".": {
"require": "./lib/cjs/index.js",
"default": "./lib/esm/index.js"
}
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/XiaoMi/hiui.git"
},
"scripts": {
"test": "jest",
"clean": "rimraf lib",
"prebuild": "yarn clean",
"build:esm": "hi-build ./src/index.ts --format esm -d ./lib/esm",
"build:cjs": "hi-build ./src/index.ts --format cjs -d ./lib/cjs",
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib/types",
"build": "concurrently yarn:build:*"
},
"bugs": {
"url": "https://github.com/XiaoMi/hiui/issues"
},
"dependencies": {
"@hi-ui/classname": "^4.0.0-beta.0",
"@hi-ui/core": "^4.0.0-beta.0",
"@hi-ui/core-css": "^4.0.0-beta.0",
"@hi-ui/env": "^4.0.0-beta.0"
},
"peerDependencies": {
"react": ">=16.8.6"
},
"devDependencies": {
"@hi-ui/hi-build": "^4.0.0-beta.1",
"react": "^17.0.1"
}
}
Loading

0 comments on commit 5b5993f

Please sign in to comment.