@glodon-aiot/libs 0.0.0-20251107034219

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.git.md ADDED
@@ -0,0 +1,73 @@
1
+ git 使用文档 | [组件库使用文档](./README.lib.md)
2
+
3
+ ## 模板工程使用:
4
+
5
+ ### 模板代码拉取与安装
6
+
7
+ `git clone https://geek.glodon.com/scm/gos/aiot-standard-frontend.git`,克隆代码。
8
+
9
+ `yarn install`,安装项目所有依赖。
10
+
11
+ yarn 安装可参考:https://blog.csdn.net/qq_45112637/article/details/125543953
12
+
13
+ `yarn start`,运行模板项目。
14
+
15
+ ### 贡献代码
16
+
17
+ `git switch master`,切换分支 master。
18
+
19
+ `git pull`,获取 master 最新代码。
20
+
21
+ `git switch –c feature/xxx`,在 master 分支下创建并切换到新分支 feature/xxx。
22
+
23
+ 在新分支编写代码。
24
+
25
+ `git add .`,把所有文件修改添加到暂存区。
26
+
27
+ `git commit -m "备注信息"`,将暂存区内容添加到本地仓库。
28
+
29
+ `git push`,把本地仓库的更新推到远程仓库。
30
+
31
+ 分支代码完成后提 PR,将分支`feature/xxx`merge 到 develop 分支。
32
+
33
+ - 若有冲突,`git switch feature/xxx`切换到该分支,然后`git pull origin develop`,手动解决冲突之后再次提交代码。
34
+ - 没有冲突且测试没有问题,再提 PR,将 develop 分支 merge 到 master 分支。
35
+
36
+ ### 更换远程仓库
37
+
38
+ **可向自己的代码仓库提交代码,不要在模板项目上提交代码哦~**
39
+
40
+ 关联远程库例子:`git remote add origin git@server-name:path/repo-name.git`,可参考https://www.liaoxuefeng.com/wiki/896043488029600/898732864121440。
41
+
42
+ `git add .`,把所有文件修改添加到暂存区。
43
+
44
+ `git commit -m "备注信息"`,将暂存区内容添加到本地仓库。
45
+
46
+ `git push`,把本地仓库的更新推到远程仓库。
47
+
48
+ ## 代码提交规范:
49
+
50
+ [@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional)
51
+
52
+ ```
53
+ {
54
+ 'build': 打包
55
+ 'chore': 性能,
56
+ 'ci': 脚手架/工程化,
57
+ 'docs': 文档,
58
+ 'feat' : 新功能,
59
+ 'fix': 修改bug,
60
+ 'perf': 性能优化,
61
+ 'refactor': 重构,
62
+ 'revert': 回退,
63
+ 'style': 样式,
64
+ 'test': 单元测试
65
+ }
66
+ ```
67
+
68
+ 举个例子
69
+ ```
70
+ git commit -m "fix: some bug"
71
+
72
+ git commit -m "feat: some feautre"
73
+ ```
package/README.lib.md ADDED
@@ -0,0 +1,135 @@
1
+ [git 使用文档](./README.git.md) | 组件库使用文档
2
+
3
+ ## 组件库使用文档
4
+
5
+ ### 项目结构
6
+
7
+ ```
8
+ sdk/
9
+ |-.husky
10
+ |-.storybook
11
+ |-dist/
12
+ |-example/
13
+ |-App.tsx
14
+ |-main.tsx
15
+ |-node_modules/
16
+ |-packages/
17
+ |-api/
18
+ |-common
19
+ |-base.api.ts
20
+ |-base.model.ts
21
+ |-panorama
22
+ |-index.ts
23
+ |-model.ts
24
+ |-index.ts
25
+ |-react-biz-components/
26
+ |-PanoramaMap
27
+ |-index.ts
28
+ |-style.less
29
+ |-react-components/
30
+ |-Button
31
+ |-index.ts
32
+ |-style.less
33
+ |-index.tsx
34
+ |-public/
35
+ |-stories/
36
+ |-Button/
37
+ |-Button.stories.tsx
38
+ |-package.json
39
+ |-index.html
40
+ |-vite.config
41
+ ```
42
+
43
+ | 目录/文件 | 作用介绍 |
44
+ | ---------- | --------------------------- |
45
+ | .storybook | 文档预览服务的配置文件 |
46
+ | dist | 打包文件,上传到 npm 上的包 |
47
+ | example | 开发组件挂在在 root |
48
+ | packages | 需要开发的组件 |
49
+ | stories | 需要生成预览文档的组件 |
50
+
51
+ #### 组件开发
52
+
53
+ 1、项目启动: `npm run dev`
54
+
55
+ 2、预览:`http://localhost:3000`
56
+
57
+ 3、App.tsx 中引入 packages 中开发的组件,example 中示例如下:
58
+
59
+ ```
60
+ import React from 'react';
61
+ import { Button } from '../packages/index';
62
+ const Test = () => {
63
+ return (
64
+ <div>
65
+ <Button label="按钮" primary></Button>
66
+ </div>
67
+ );
68
+ };
69
+
70
+ export default Test;
71
+ ```
72
+
73
+ ### 组件发布
74
+
75
+ 1、执行`npm run build`打包文件
76
+
77
+ 2、命令行使用`npm login`登录 npm
78
+
79
+ 3、使用`npm publish`发布
80
+
81
+ package.json 上定义的基础入口信息和类型声明
82
+
83
+ ```
84
+ {
85
+ "name": "aiot-panorama-jssdk",
86
+ "private": false,
87
+ "version": "0.0.2",
88
+ "description": "React components",
89
+ "type": "module",
90
+ "keywords": [
91
+ "react",
92
+ "react-component"
93
+ ],
94
+ "files": [
95
+ "dist"
96
+ ],
97
+ "main": "./dist/aiot-panorama-jssdk.umd.cjs",
98
+ "module": "./dist/aiot-panorama-jssdk.js",
99
+ "typings": "./dist/index.d.ts",
100
+ "exports": {
101
+ ".": {
102
+ "import": "./dist/aiot-panorama-jssdk.js",
103
+ "require": "./dist/aiot-panorama-jssdk.umd.cjs"
104
+ },
105
+ "./style.css": "./dist/style.css"
106
+ },
107
+ "repository": "",
108
+ "author": "gspace",
109
+ "license": "MIT"
110
+ }
111
+ ```
112
+
113
+ ### 组件使用
114
+
115
+ #### 安装
116
+
117
+ ```bash
118
+ yarn add aiot-panorama-jssdk
119
+ ```
120
+
121
+ #### 使用
122
+
123
+ ```
124
+ import { Button } from 'aiot-panorama-jssdk';
125
+ import "aiot-panorama-jssdk/style.css"
126
+
127
+ <Button label="按钮" primary></Button>
128
+
129
+ ```
130
+
131
+ 附:
132
+
133
+ [storybook 中文使用文档](https://storybook.js.org/tutorials/design-systems-for-developers/react/zh-CN/document/)
134
+
135
+ [storybook 英文使用文档](https://storybook.js.org/docs/react/get-started/introduction)