feat: 初始化icon、map包

This commit is contained in:
NICE CODE BY DEV 2024-03-22 10:45:18 +08:00
parent bc5a281a50
commit 42513c21cf
20 changed files with 238 additions and 9 deletions

View File

@ -18,6 +18,8 @@ export default defineConfig({
'@zhst/request': path.join(__dirname, 'packages/request/src'),
'@zhst/slave': path.join(__dirname, 'packages/slave/src'),
'@zhst/material': path.join(__dirname, 'packages/material/src'),
'@zhst/icon': path.join(__dirname, 'packages/icon/src'),
'@zhst/map': path.join(__dirname, 'packages/map/src'),
},
resolve: {
docDirs: ['docs'],
@ -31,6 +33,8 @@ export default defineConfig({
{ type: 'other', subType: 'types', dir: 'packages/types/src' },
{ type: 'slave', dir: 'packages/slave/src' },
{ type: 'material', dir: 'packages/material/src' },
{ type: 'icon', dir: 'packages/icon/src' },
{ type: 'map', dir: 'packages/map/src' },
],
},
monorepoRedirect: {

1
.gitignore vendored
View File

@ -11,3 +11,4 @@ packages/**/es
packages/**/lib
/es
/lib
pnpm-lock.yaml

View File

@ -0,0 +1,7 @@
import { defineConfig } from 'father';
export default defineConfig({
// more father config: https://github.com/umijs/father/blob/master/docs/config.md
esm: { output: 'es' },
cjs: { output: 'lib' },
});

20
packages/icon/README.md Normal file
View File

@ -0,0 +1,20 @@
# @zhst/icon
:::info{title=开发中}
稍等...
:::
## 介绍
静态变量库
## 安装
> pnpm install @zhst/icon
## 使用
```js
import React from 'react';
import { Arrow } from '@zhst/icon'
```

View File

@ -0,0 +1,40 @@
{
"name": "@zhst/icon",
"version": "0.1.0",
"description": "图标库",
"keywords": [
"icon",
"zhst",
"图标库"
],
"license": "ISC",
"author": "dev",
"sideEffects": [
"dist/*",
"es/**/style/*",
"lib/**/style/*",
"*.less"
],
"main": "lib/index.js",
"module": "es/index.js",
"typings": "es/index.d.ts",
"exports": {
".": {
"require": "./lib/index.js",
"import": "./es/index.js",
"default": "./es/index.js"
}
},
"files": [
"es",
"lib"
],
"scripts": {
"build": "father build"
},
"publishConfig": {
"access": "public",
"registry": "http://10.0.0.77:4874"
},
"dependencies": {}
}

View File

@ -0,0 +1,13 @@
import React from 'react';
import { Heart } from '@zhst/icon';
const demo = () => {
return (
<div>
<Heart size={20} />
</div>
);
};
export default demo;

View File

@ -0,0 +1,17 @@
/**
* Created by jiangzhixiong on 2024/03/22
*/
import React, { FC } from 'react'
interface Iheart {
size?: string | number
}
const Heart: FC<Iheart> = (props) => {
return (
<svg style={{ width: `${props.size}px`, height: '100%' }} t="1711074821835" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="13154" width="200" height="200"><path d="M322.56 164.266667c-113.152 0-205.226667 92.16-205.226667 206.506666 0 138.666667 64 249.813333 144.64 332.373334 80.938667 82.944 176.64 134.912 233.898667 154.453333l0.341333 0.128c2.730667 0.981333 8.490667 2.005333 15.786667 2.005333 7.296 0 13.056-1.024 15.786667-2.005333l0.341333-0.128c57.258667-19.541333 152.96-71.509333 233.941333-154.453333 80.554667-82.56 144.597333-193.706667 144.597334-332.373334 0-114.346667-92.074667-206.506667-205.226667-206.506666a203.946667 203.946667 0 0 0-163.754667 82.645333 32 32 0 0 1-51.370666 0A203.349333 203.349333 0 0 0 322.56 164.266667zM53.333333 370.773333c0-149.333333 120.405333-270.506667 269.226667-270.506666 74.112 0 141.013333 30.122667 189.44 78.72a267.349333 267.349333 0 0 1 189.44-78.72c148.821333 0 269.226667 121.173333 269.226667 270.506666 0 160-74.24 286.293333-162.816 377.088-88.149333 90.282667-192.426667 147.541333-258.901334 170.24a114.986667 114.986667 0 0 1-36.949333 5.632c-11.818667 0-25.216-1.493333-36.949333-5.589333-66.432-22.741333-170.752-80-258.901334-170.282667C127.530667 657.066667 53.333333 530.773333 53.333333 370.773333z" p-id="13155"></path></svg>
)
}
export default Heart

View File

@ -0,0 +1,11 @@
---
nav:
title: Icon
order: 1
toc: content
title: 快速上手
---
<embed src="../README.md" ></embed>
<code src="./demo/basic.tsx">基本用法</code>

View File

@ -0,0 +1 @@
export { default as Heart } from './heart';

13
packages/map/.fatherrc.ts Normal file
View File

@ -0,0 +1,13 @@
import { defineConfig } from 'father';
export default defineConfig({
// more father config: https://github.com/umijs/father/blob/master/docs/config.md
esm: {
output: 'es',
ignores: ['**/demo/*', 'src/**/demo/*']
},
cjs: {
output: 'lib',
ignores: ['**/demo/*', 'src/**/demo/*']
},
});

View File

20
packages/map/README.md Normal file
View File

@ -0,0 +1,20 @@
# @zhst/map
:::info{title=开发中}
稍等...
:::
## 介绍
静态变量库
## 安装
> pnpm install @zhst/map
## 使用
```js
import React from 'react';
import { TYPE } from '@zhst/map'
```

40
packages/map/package.json Normal file
View File

@ -0,0 +1,40 @@
{
"name": "@zhst/map",
"version": "0.1.1",
"description": "地图库",
"keywords": [
"map",
"zhst",
"地图库"
],
"license": "ISC",
"author": "dev",
"sideEffects": [
"dist/*",
"es/**/style/*",
"lib/**/style/*",
"*.less"
],
"main": "lib/index.js",
"module": "es/index.js",
"typings": "es/index.d.ts",
"exports": {
".": {
"require": "./lib/index.js",
"import": "./es/index.js",
"default": "./es/index.js"
}
},
"files": [
"es",
"lib"
],
"scripts": {
"build": "father build"
},
"publishConfig": {
"access": "public",
"registry": "http://10.0.0.77:4874"
},
"dependencies": {}
}

View File

@ -0,0 +1,11 @@
---
nav:
title: 其它
title: 静态变量库
toc: content
---
<embed src="../../README.md" ></embed>
<embed src="../../CHANGELOG.md" ></embed>

View File

@ -0,0 +1,9 @@
---
nav:
title: Map
order: 1
toc: content
title: 快速上手
---
<embed src="../README.md" ></embed>

View File

@ -0,0 +1 @@
export * from './user'

View File

@ -0,0 +1 @@
export default {}

View File

@ -1,21 +1,41 @@
# @types/zhst
:::info{title=开发中}
可能会被弃用...
:::
# @zhst/slave
## 介绍
业务库
供微前端应用使用的公共方法
## 安装
> pnpm install @zhst/types
> pnpm install @zhst/slave
## 使用
```js
import React from 'react';
import type { User } from '@types/zhst'
import from '@zhst/slave'
slave.init({
jumpUrl: `http://10.0.0.222:30058/metarial/login`,
jumpToLogin: false,
tokenKey: 'token',
showMsg: false,
msgText: '你能不能先登录?'
})
```
## API
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| jumpToLogin | 是否打开登录校验跳转 | boolean | true | - |
| jumpUrl | 登录跳转页面 | string | - | - |
| tokenKey | 从链接获取的登录校验字段 | string | token | - |
| showMsg | 是否显示“请先登录”提示框 | boolean | true | - |
| msgText | 提示框自定义文案 | string | 请先登录 | - |
## slave 实例方法
| 方法 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| init | 初始化实例 | function | (data: SlaveProps) => void | - |
| logOut | 退出登录 | function | () => void | - |

View File

@ -1,6 +1,6 @@
---
nav:
title: 微前端库
title: slave
order: 99
toc: content
title: 快速上手