inl-ui 0.1.60 → 0.1.62
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/.babelrc +3 -0
- package/.gitignore +17 -0
- package/README.md +49 -49
- package/conf/build.ts +69 -0
- package/conf/buildDocs.ts +27 -0
- package/conf/buildtp.ts +54 -0
- package/conf/cp1.js +85 -0
- package/conf/modules.ts +44 -0
- package/conf/rollup.config.ts +131 -0
- package/conf/utils.ts +19 -0
- package/dist/components/index.cjs +63 -23
- package/dist/components/index.js +63 -23
- package/dist/hooks/index.cjs +50 -2
- package/dist/hooks/index.js +50 -2
- package/dist/iconfont.js +1 -1
- package/dist/index.cjs +64 -24
- package/dist/index.d.ts +1 -1
- package/dist/index.js +64 -24
- package/dist/style.css +1 -1
- package/dist/theme/index.js +70 -70
- package/dist/theme/scripts/dark-vars.js +21 -21
- package/dist/theme/scripts/default-vars.js +25 -25
- package/dist/theme/scripts/light-vars.js +22 -22
- package/dist/theme/style/color/bezierEasing.less +110 -110
- package/dist/theme/style/color/colorPalette.less +81 -81
- package/dist/theme/style/color/colors.less +162 -162
- package/dist/theme/style/color/tinyColor.less +1184 -1184
- package/dist/theme/style/compact.less +4 -4
- package/dist/theme/style/dark.less +4 -4
- package/dist/theme/style/default.less +4 -4
- package/dist/theme/style/index.less +2 -2
- package/dist/theme/style/index.tsx +2 -2
- package/dist/theme/style/themes/compact.less +295 -295
- package/dist/theme/style/themes/dark.less +790 -790
- package/dist/theme/style/themes/default.less +1067 -1067
- package/dist/theme/style/themes/index.less +7 -7
- package/dist/theme/style/themes/var-dark.less +343 -343
- package/dist/theme/style/themes/var-default.less +184 -184
- package/dist/theme/style/themes/variable.less +1122 -1122
- package/dist/theme/style/variable.less +4 -4
- package/dist/tplib/index.cjs +50 -2
- package/dist/tplib/index.js +50 -2
- package/dist/video/index.cjs +56 -2
- package/dist/video/index.js +56 -2
- package/dist/videoMobile/index.cjs +50 -2
- package/dist/videoMobile/index.js +50 -2
- package/global.d.ts +2 -0
- package/package.json +87 -87
- package/rollup.config.js +2 -0
- package/siteTp/index.html +13 -0
- package/siteTp/lay.tsx +53 -0
- package/siteTp/main.ts +11 -0
- package/siteTp/tsconfig.json +19 -0
- package/siteTp/vite.config.ts +36 -0
- package/src/assets/iconfont/index.js +1 -0
- package/src/assets/style/common/const.less +48 -0
- package/src/assets/style/common/font.less +72 -0
- package/src/assets/style/components/changeThemeSelect.less +25 -0
- package/src/assets/style/components/childLayout.less +92 -0
- package/src/assets/style/components/cloudVideo.less +9 -0
- package/src/assets/style/components/collapseTitle.less +24 -0
- package/src/assets/style/components/demo.less +5 -0
- package/src/assets/style/components/detailContainer.less +7 -0
- package/src/assets/style/components/headerMenu.less +123 -0
- package/src/assets/style/components/iconfonts.less +56 -0
- package/src/assets/style/components/index.less +18 -0
- package/src/assets/style/components/layout.less +429 -0
- package/src/assets/style/components/layoutSider.less +68 -0
- package/src/assets/style/components/llmChatBox.less +309 -0
- package/src/assets/style/components/login.less +430 -0
- package/src/assets/style/components/param-manager.less +56 -0
- package/src/assets/style/components/paramManagerV2.less +58 -0
- package/src/assets/style/components/peopleSelectCpn.less +78 -0
- package/src/assets/style/components/sszComment.less +18 -0
- package/src/assets/style/components/table.less +10 -0
- package/src/assets/style/components/video.less +304 -0
- package/src/assets/style/components/videoAlarm.less +278 -0
- package/src/assets/style/index.less +14 -0
- package/src/assets/style/reset.less +38 -0
- package/src/components/README.md +251 -0
- package/src/components/changeThemeSelect/README.md +5 -0
- package/src/components/changeThemeSelect/index.tsx +71 -0
- package/src/components/collapseTitle/README.md +12 -0
- package/src/components/collapseTitle/index.tsx +71 -0
- package/src/components/demo/README.md +3 -0
- package/src/components/demo/index.tsx +17 -0
- package/src/components/detailContainer/README.md +36 -0
- package/src/components/detailContainer/index.tsx +212 -0
- package/src/components/fontSelect/README.md +33 -0
- package/src/components/fontSelect/fonts.ts +22 -0
- package/src/components/fontSelect/index.tsx +41 -0
- package/src/components/gridForm/README.md +34 -0
- package/src/components/gridForm/helper.ts +45 -0
- package/src/components/gridForm/index.tsx +98 -0
- package/src/components/headerMenu/headerMenuItem.tsx +50 -0
- package/src/components/headerMenu/headerMenuTitle.tsx +32 -0
- package/src/components/headerMenu/index.tsx +142 -0
- package/src/components/iconFont/README.md +17 -0
- package/src/components/iconFont/icons.tsx +110 -0
- package/src/components/iconFont/index.tsx +6 -0
- package/src/components/importModal/README.md +15 -0
- package/src/components/importModal/index.tsx +141 -0
- package/src/components/index.ts +64 -0
- package/src/components/largeLanguageModel/answerStyle.ts +36 -0
- package/src/components/largeLanguageModel/chatBox.tsx +54 -0
- package/src/components/largeLanguageModel/components/answerBubble.tsx +213 -0
- package/src/components/largeLanguageModel/components/avatar.tsx +32 -0
- package/src/components/largeLanguageModel/components/input.tsx +95 -0
- package/src/components/largeLanguageModel/components/questionBubble.tsx +30 -0
- package/src/components/largeLanguageModel/components/speechRecognition.tsx +127 -0
- package/src/components/largeLanguageModel/device.ts +21 -0
- package/src/components/largeLanguageModel/index.ts +10 -0
- package/src/components/largeLanguageModel/layouts/bottom.tsx +36 -0
- package/src/components/largeLanguageModel/layouts/qaContext.tsx +82 -0
- package/src/components/largeLanguageModel/request.ts +29 -0
- package/src/components/largeLanguageModel/useQA.ts +146 -0
- package/src/components/layout/childLayout.tsx +302 -0
- package/src/components/layout/components/childHeader.tsx +84 -0
- package/src/components/layout/components/childHeaderDev.tsx +143 -0
- package/src/components/layout/components/childSideMenu.tsx +119 -0
- package/src/components/layout/components/header.tsx +199 -0
- package/src/components/layout/components/pageContent.tsx +448 -0
- package/src/components/layout/components/sideMenu.tsx +101 -0
- package/src/components/layout/components/tabList.tsx +445 -0
- package/src/components/layout/hooks/onAddExtraTabs.ts +31 -0
- package/src/components/layout/hooks/useActiveApp.ts +14 -0
- package/src/components/layout/hooks/useActiveMenu.ts +86 -0
- package/src/components/layout/hooks/useMicroApp.ts +67 -0
- package/src/components/layout/index.tsx +277 -0
- package/src/components/layout/table.tsx +33 -0
- package/src/components/layout/utils/menu.ts +126 -0
- package/src/components/login/README.md +19 -0
- package/src/components/login/box.tsx +295 -0
- package/src/components/login/index.tsx +117 -0
- package/src/components/login/leftImg.tsx +23 -0
- package/src/components/login/top-title.tsx +17 -0
- package/src/components/menuDetail/index.tsx +116 -0
- package/src/components/paramManager/README.md +3 -0
- package/src/components/paramManager/collapseContainer.tsx +54 -0
- package/src/components/paramManager/dynamicForm.tsx +134 -0
- package/src/components/paramManager/index.tsx +141 -0
- package/src/components/paramManager/proFormItem.tsx +197 -0
- package/src/components/paramManager/request.ts +42 -0
- package/src/components/paramManager/tabItem.tsx +194 -0
- package/src/components/paramManagerV2/README.md +23 -0
- package/src/components/paramManagerV2/fetch.ts +42 -0
- package/src/components/paramManagerV2/index.tsx +124 -0
- package/src/components/paramManagerV2/paramItem.tsx +203 -0
- package/src/components/paramManagerV2/tabLevel.tsx +238 -0
- package/src/components/peopleSelect/depBreadcrumb.tsx +50 -0
- package/src/components/peopleSelect/index.tsx +300 -0
- package/src/components/peopleSelect/searchPeopleInput.tsx +69 -0
- package/src/components/peopleSelect/utils.ts +156 -0
- package/src/components/queryFormContainer/README.md +3 -0
- package/src/components/queryFormContainer/index.tsx +59 -0
- package/src/components/sszComment/http.ts +32 -0
- package/src/components/sszComment/index.tsx +147 -0
- package/src/components/undeveloped/index.tsx +17 -0
- package/src/components/video/README.md +53 -0
- package/src/components/video/alarmVideo.tsx +385 -0
- package/src/components/video/cloudVideo.tsx +98 -0
- package/src/components/video/index.ts +16 -0
- package/src/components/video/indexMobile.ts +2 -0
- package/src/components/video/pollingPlay.tsx +218 -0
- package/src/components/video/tree.tsx +342 -0
- package/src/components/video/videoBox.tsx +410 -0
- package/src/components/video/videoBoxV2.tsx +686 -0
- package/src/components/video/videoPlayerV1.tsx +133 -0
- package/src/components/video/videoPlayerV2.tsx +194 -0
- package/src/config/index.ts +7 -0
- package/src/directives/autoScroll.ts +87 -0
- package/src/directives/focus.ts +14 -0
- package/src/directives/index.ts +7 -0
- package/src/hooks/README.md +107 -0
- package/src/hooks/index.ts +18 -0
- package/src/hooks/useCacheExclude.ts +71 -0
- package/src/hooks/useEvent.ts +25 -0
- package/src/hooks/useModalVisible.ts +34 -0
- package/src/hooks/useNow.ts +25 -0
- package/src/hooks/usePoolingReq.ts +34 -0
- package/src/hooks/useQiankunState.ts +36 -0
- package/src/hooks/useQiankunStateValue.ts +29 -0
- package/src/hooks/useRouteActive.ts +12 -0
- package/src/hooks/useTableList.ts +87 -0
- package/src/hooks/useTableSelec.ts +65 -0
- package/src/hooks/useZoomAdaptation.ts +25 -0
- package/src/hooks/videoV1.ts +241 -0
- package/src/hooks/videoV2.ts +307 -0
- package/src/index.ts +27 -0
- package/src/priviteUtils/className.ts +16 -0
- package/src/priviteUtils/getIconFonts.ts +16 -0
- package/src/priviteUtils/installComponent.ts +24 -0
- package/src/priviteUtils/route.ts +49 -0
- package/src/tp-lib/README.md +240 -0
- package/src/tp-lib/TP3D.md +144 -0
- package/src/tp-lib/findAlarmDeviceById.ts +35 -0
- package/src/tp-lib/getAlarmingCamera.ts +132 -0
- package/src/tp-lib/getDeviceDetail.ts +467 -0
- package/src/tp-lib/index.ts +4 -0
- package/src/tp-lib/package.json +13 -0
- package/src/tpInit/index.ts +130 -0
- package/src/tpInit/utils.ts +1 -0
- package/src/types/gl.d.ts +24 -0
- package/src/types/global.d.ts +41 -0
- package/src/types/ht/ht-widget.d.ts +11327 -0
- package/src/types/ht/ht.d.ts +11410 -0
- package/src/types/ht/index.d.ts +4 -0
- package/src/types/shims-vue.d.ts +1 -0
- package/src/utils/README.md +175 -0
- package/src/utils/ZLMRTCClient.js +9075 -0
- package/src/utils/apiInstance.ts +128 -0
- package/src/utils/base64.ts +22 -0
- package/src/utils/changeTheme.ts +37 -0
- package/src/utils/file.ts +35 -0
- package/src/utils/format.ts +268 -0
- package/src/utils/index.ts +38 -0
- package/src/utils/login.ts +105 -0
- package/src/utils/microApp.ts +120 -0
- package/src/utils/ramdom.ts +43 -0
- package/src/utils/setRem.ts +16 -0
- package/src/utils/upload.ts +26 -0
- package/theme/index.html +14 -0
- package/theme/src/Layouts/index.tsx +14 -0
- package/theme/src/assets/iconfont/iconfont.css +771 -0
- package/theme/src/assets/iconfont/iconfont.js +1 -0
- package/theme/src/assets/iconfont/iconfont.json +1332 -0
- package/theme/src/assets/iconfont/iconfont.ttf +0 -0
- package/theme/src/assets/iconfont/iconfont.woff +0 -0
- package/theme/src/assets/iconfont/iconfont.woff2 +0 -0
- package/theme/src/assets/img/1.png +0 -0
- package/theme/src/assets/img/loginBackground.png +0 -0
- package/theme/src/assets/img/loginPicBig.png +0 -0
- package/theme/src/assets/img/logo.png +0 -0
- package/theme/src/assets/img/logoBig.png +0 -0
- package/theme/src/assets/img/ms.png +0 -0
- package/theme/src/assets/img/platformLogo.png +0 -0
- package/theme/src/assets/img/selected-menu.svg +18 -0
- package/theme/src/assets/logo.png +0 -0
- package/theme/src/assets/styles/const.less +1 -0
- package/theme/src/assets/styles/constant/antd.less +1 -0
- package/theme/src/assets/styles/index.less +22 -0
- package/theme/src/assets/styles/layout.less +99 -0
- package/theme/src/assets/styles/login.less +111 -0
- package/theme/src/assets/styles/loginBox.less +181 -0
- package/theme/src/assets/styles/pages/modelManager/index.less +3 -0
- package/theme/src/assets/styles/reset.less +36 -0
- package/theme/src/assets/test.less +4 -0
- package/theme/src/assets/zh-cn.js +134 -0
- package/theme/src/main.ts +14 -0
- package/theme/src/router/index.ts +15 -0
- package/theme/src/views/index.tsx +98 -0
- package/theme/src/views/login.tsx +25 -0
- package/theme/theme/index.js +70 -0
- package/theme/theme/scripts/dark-vars.js +21 -0
- package/theme/theme/scripts/default-vars.js +25 -0
- package/theme/theme/scripts/light-vars.js +22 -0
- package/theme/theme/style/color/bezierEasing.less +110 -0
- package/theme/theme/style/color/colorPalette.less +81 -0
- package/theme/theme/style/color/colors.less +162 -0
- package/theme/theme/style/color/tinyColor.less +1184 -0
- package/theme/theme/style/compact.less +4 -0
- package/theme/theme/style/dark.less +4 -0
- package/theme/theme/style/default.less +4 -0
- package/theme/theme/style/index.less +2 -0
- package/theme/theme/style/index.tsx +2 -0
- package/theme/theme/style/themes/compact.less +295 -0
- package/theme/theme/style/themes/dark.less +790 -0
- package/theme/theme/style/themes/default.less +1067 -0
- package/theme/theme/style/themes/index.less +7 -0
- package/theme/theme/style/themes/var-dark.less +343 -0
- package/theme/theme/style/themes/var-default.less +184 -0
- package/theme/theme/style/themes/variable.less +1122 -0
- package/theme/theme/style/variable.less +4 -0
- package/theme/tsconfig.json +27 -0
- package/theme/vite.config.ts +32 -0
- package/tp-bundle/README.md +240 -0
- package/tp-bundle/TP3D.md +144 -0
- package/tp-bundle/index.c.js +73 -0
- package/tp-bundle/index.d.ts +272 -0
- package/tp-bundle/index.es.js +73 -0
- package/tp-bundle/index.iife.js +73 -0
- package/tp-bundle/package.json +13 -0
- package/tp-bundle.rar +0 -0
- package/tsconfig.json +27 -0
- package/yarn-error.log +4499 -0
- package/yarn.lock +4073 -0
package/.babelrc
ADDED
package/.gitignore
ADDED
package/README.md
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
# 工业PC ui库
|
|
2
|
-
|
|
3
|
-
前端通用库,包括组件、hooks、utils等。
|
|
4
|
-
|
|
5
|
-
### 运行
|
|
6
|
-
|
|
7
|
-
+ 开发模式 yarn dev
|
|
8
|
-
+ 生产打包 yarn build
|
|
9
|
-
+ 生成文档 yarn build:docs
|
|
10
|
-
+ 打包图扑工具 yarn buildtp
|
|
11
|
-
|
|
12
|
-
### 使用方法
|
|
13
|
-
|
|
14
|
-
```javascript
|
|
15
|
-
import inl from 'inl-ui';
|
|
16
|
-
import 'inl-ui/dist/style.css';
|
|
17
|
-
|
|
18
|
-
vue.use(inl)
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
### 激活主题
|
|
24
|
-
|
|
25
|
-
**vite.config.ts**
|
|
26
|
-
|
|
27
|
-
```javascript
|
|
28
|
-
const additionalData = require("inl-ui/dist/theme").default;
|
|
29
|
-
|
|
30
|
-
...
|
|
31
|
-
|
|
32
|
-
css: {
|
|
33
|
-
preprocessorOptions: {
|
|
34
|
-
less: {
|
|
35
|
-
javascriptEnabled: true,
|
|
36
|
-
additionalData,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### 文档链接
|
|
43
|
-
|
|
44
|
-
##### [组件文档](./src/components/README.md)
|
|
45
|
-
|
|
46
|
-
##### [hooks文档](./src/hooks/README.md)
|
|
47
|
-
|
|
48
|
-
##### [Utils文档](./src/utils/README.md)
|
|
49
|
-
|
|
1
|
+
# 工业PC ui库
|
|
2
|
+
|
|
3
|
+
前端通用库,包括组件、hooks、utils等。
|
|
4
|
+
|
|
5
|
+
### 运行
|
|
6
|
+
|
|
7
|
+
+ 开发模式 yarn dev
|
|
8
|
+
+ 生产打包 yarn build
|
|
9
|
+
+ 生成文档 yarn build:docs
|
|
10
|
+
+ 打包图扑工具 yarn buildtp
|
|
11
|
+
|
|
12
|
+
### 使用方法
|
|
13
|
+
|
|
14
|
+
```javascript
|
|
15
|
+
import inl from 'inl-ui';
|
|
16
|
+
import 'inl-ui/dist/style.css';
|
|
17
|
+
|
|
18
|
+
vue.use(inl)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### 激活主题
|
|
24
|
+
|
|
25
|
+
**vite.config.ts**
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
const additionalData = require("inl-ui/dist/theme").default;
|
|
29
|
+
|
|
30
|
+
...
|
|
31
|
+
|
|
32
|
+
css: {
|
|
33
|
+
preprocessorOptions: {
|
|
34
|
+
less: {
|
|
35
|
+
javascriptEnabled: true,
|
|
36
|
+
additionalData,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 文档链接
|
|
43
|
+
|
|
44
|
+
##### [组件文档](./src/components/README.md)
|
|
45
|
+
|
|
46
|
+
##### [hooks文档](./src/hooks/README.md)
|
|
47
|
+
|
|
48
|
+
##### [Utils文档](./src/utils/README.md)
|
|
49
|
+
|
package/conf/build.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { execSync, exec } from "child_process";
|
|
2
|
+
import { writeFileSync } from "fs";
|
|
3
|
+
import inquirer from "inquirer";
|
|
4
|
+
import pkg from "../package.json";
|
|
5
|
+
import { getDefaultNextVersion, resolvePath } from "./utils";
|
|
6
|
+
|
|
7
|
+
const args = process.argv.slice(2);
|
|
8
|
+
|
|
9
|
+
export async function build() {
|
|
10
|
+
console.log(">>>>>>> 📦打包开始");
|
|
11
|
+
|
|
12
|
+
// 删除dist
|
|
13
|
+
execSync("npm run clean", { stdio: "inherit" });
|
|
14
|
+
|
|
15
|
+
// 开始打包
|
|
16
|
+
execSync(`yarn build:rollup ${args.join(" ")}`, { stdio: "inherit" });
|
|
17
|
+
|
|
18
|
+
// 复制主题
|
|
19
|
+
execSync("npm run cp:theme", { stdio: "inherit" });
|
|
20
|
+
console.log(">>>>>>> 📦打包成功");
|
|
21
|
+
|
|
22
|
+
// 发版逻辑
|
|
23
|
+
runPublish();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// 发版流程
|
|
27
|
+
async function runPublish() {
|
|
28
|
+
const { response } = await inquirer.prompt({
|
|
29
|
+
name: "response",
|
|
30
|
+
message: "是否发版",
|
|
31
|
+
type: "confirm",
|
|
32
|
+
});
|
|
33
|
+
if (!response) return;
|
|
34
|
+
// 获取输入的版本
|
|
35
|
+
const defalutNextVersion = getDefaultNextVersion();
|
|
36
|
+
const { version: versionInput } = await inquirer.prompt({
|
|
37
|
+
name: "version",
|
|
38
|
+
message: "请输入版本号",
|
|
39
|
+
type: "input",
|
|
40
|
+
default: defalutNextVersion,
|
|
41
|
+
});
|
|
42
|
+
// 修改package.json
|
|
43
|
+
const newPkg = { ...pkg, version: versionInput };
|
|
44
|
+
writeFileSync(
|
|
45
|
+
resolvePath("../package.json"),
|
|
46
|
+
JSON.stringify(newPkg, null, 2),
|
|
47
|
+
{
|
|
48
|
+
encoding: "utf-8",
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
console.log(">>>>>>> 版本号修改成功");
|
|
52
|
+
// 发版
|
|
53
|
+
try {
|
|
54
|
+
// 指定仓库 防止使用yarn执行会发布到yarn源
|
|
55
|
+
execSync("npm publish --registry https://registry.npmjs.org/", {
|
|
56
|
+
cwd: resolvePath(".."),
|
|
57
|
+
stdio: "inherit",
|
|
58
|
+
});
|
|
59
|
+
// 打开浏览器同步cnpm
|
|
60
|
+
const isWindows = process.platform === "win32";
|
|
61
|
+
exec(
|
|
62
|
+
`${isWindows ? "start" : "open"} https://npmmirror.com/sync/${pkg.name}`
|
|
63
|
+
);
|
|
64
|
+
} catch (e) {
|
|
65
|
+
process.exit(0);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
build();
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fg from "fast-glob";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
|
|
5
|
+
const docModules = ["components"];
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 创建文档
|
|
9
|
+
* 把每个模块的单个文档集中到一个文档中
|
|
10
|
+
*/
|
|
11
|
+
export default async function buildDocs() {
|
|
12
|
+
for (const module of docModules) {
|
|
13
|
+
const moduleRoot = path.resolve(__dirname, `../src/${module}`);
|
|
14
|
+
const docFiles = await fg("*/README.md", { cwd: moduleRoot });
|
|
15
|
+
|
|
16
|
+
let outputDoc = ``;
|
|
17
|
+
for (const mdPath of docFiles) {
|
|
18
|
+
const mdContent = fs.readFileSync(path.join(moduleRoot, mdPath), "utf-8");
|
|
19
|
+
outputDoc += `${mdContent} \n\n---\n\n`;
|
|
20
|
+
}
|
|
21
|
+
fs.writeFileSync(path.join(moduleRoot, "README.md"), outputDoc, {
|
|
22
|
+
encoding: "utf-8",
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
buildDocs();
|
package/conf/buildtp.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { rollup } from "rollup";
|
|
2
|
+
import esbuild from "rollup-plugin-esbuild";
|
|
3
|
+
import copy from "rollup-plugin-copy";
|
|
4
|
+
import dts from "rollup-plugin-dts";
|
|
5
|
+
|
|
6
|
+
const input = "src/tp-lib/index.ts";
|
|
7
|
+
|
|
8
|
+
// 打包图扑工具
|
|
9
|
+
export async function buildtp() {
|
|
10
|
+
const res = await rollup({
|
|
11
|
+
input,
|
|
12
|
+
plugins: [
|
|
13
|
+
esbuild({
|
|
14
|
+
drop: ["console", "debugger"],
|
|
15
|
+
minify: true,
|
|
16
|
+
treeShaking: true,
|
|
17
|
+
}),
|
|
18
|
+
copy({
|
|
19
|
+
targets: [
|
|
20
|
+
{ src: "src/tp-lib/**/*.md", dest: "tp-bundle" },
|
|
21
|
+
{ src: "src/tp-lib/**/*.json", dest: "tp-bundle" },
|
|
22
|
+
],
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
});
|
|
26
|
+
res.write({
|
|
27
|
+
name: "tp-lib",
|
|
28
|
+
file: "tp-bundle/index.c.js",
|
|
29
|
+
format: "cjs",
|
|
30
|
+
});
|
|
31
|
+
res.write({
|
|
32
|
+
name: "tp-lib",
|
|
33
|
+
file: "tp-bundle/index.es.js",
|
|
34
|
+
format: "es",
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
res.write({
|
|
38
|
+
name: "tp-lib",
|
|
39
|
+
file: "tp-bundle/index.iife.js",
|
|
40
|
+
format: "iife",
|
|
41
|
+
extend: true,
|
|
42
|
+
});
|
|
43
|
+
const dtsCfg = await rollup({
|
|
44
|
+
input,
|
|
45
|
+
plugins: [dts()],
|
|
46
|
+
});
|
|
47
|
+
dtsCfg.write({
|
|
48
|
+
name: "tp-lib",
|
|
49
|
+
file: "tp-bundle/index.d.ts",
|
|
50
|
+
format: "cjs",
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
buildtp();
|
package/conf/cp1.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
var fs = require("fs");
|
|
2
|
+
var path = require("path");
|
|
3
|
+
|
|
4
|
+
const getPath = (p = "./") => {
|
|
5
|
+
return path.resolve(__dirname, p);
|
|
6
|
+
};
|
|
7
|
+
var copyFile = function (srcPath, tarPath, cb) {
|
|
8
|
+
var rs = fs.createReadStream(srcPath);
|
|
9
|
+
rs.on("error", function (err) {
|
|
10
|
+
if (err) {
|
|
11
|
+
console.log("read error", srcPath);
|
|
12
|
+
}
|
|
13
|
+
cb && cb(err);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
var ws = fs.createWriteStream(tarPath);
|
|
17
|
+
ws.on("error", function (err) {
|
|
18
|
+
if (err) {
|
|
19
|
+
console.log("write error", tarPath);
|
|
20
|
+
}
|
|
21
|
+
cb && cb(err);
|
|
22
|
+
});
|
|
23
|
+
ws.on("close", function (ex) {
|
|
24
|
+
cb && cb(ex);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
rs.pipe(ws);
|
|
28
|
+
};
|
|
29
|
+
var copyFolder = function (srcDir, tarDir, cb) {
|
|
30
|
+
fs.readdir(srcDir, function (err, files) {
|
|
31
|
+
var count = 0;
|
|
32
|
+
var checkEnd = function () {
|
|
33
|
+
++count == files.length && cb && cb();
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
if (err) {
|
|
37
|
+
checkEnd();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
files.forEach(function (file) {
|
|
42
|
+
var srcPath = path.join(srcDir, file);
|
|
43
|
+
var tarPath = path.join(tarDir, file);
|
|
44
|
+
|
|
45
|
+
fs.stat(srcPath, function (err, stats) {
|
|
46
|
+
if (stats.isDirectory()) {
|
|
47
|
+
console.log("mkdir", tarPath);
|
|
48
|
+
fs.mkdir(tarPath, function (err) {
|
|
49
|
+
if (err) {
|
|
50
|
+
console.log(err);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
copyFolder(srcPath, tarPath, checkEnd);
|
|
55
|
+
});
|
|
56
|
+
} else {
|
|
57
|
+
copyFile(srcPath, tarPath, checkEnd);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
//为空时直接回调
|
|
63
|
+
files.length === 0 && cb && cb();
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
const createDir = () => {
|
|
67
|
+
const path = getPath("../dist/theme");
|
|
68
|
+
fs.stat(path, async (err, res) => {
|
|
69
|
+
if (err) {
|
|
70
|
+
await fs.mkdirSync(path);
|
|
71
|
+
}
|
|
72
|
+
copyFolder(
|
|
73
|
+
getPath("../theme/theme"),
|
|
74
|
+
getPath("../dist/theme"),
|
|
75
|
+
function (err) {
|
|
76
|
+
if (err) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
//continue
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
createDir();
|
package/conf/modules.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const modules = [
|
|
2
|
+
{
|
|
3
|
+
name: "root",
|
|
4
|
+
entry: "src/index.ts",
|
|
5
|
+
description: "主包",
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
name: "utils",
|
|
9
|
+
entry: "src/utils/index.ts",
|
|
10
|
+
description: "工具集合",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: "hooks",
|
|
14
|
+
entry: "src/hooks/index.ts",
|
|
15
|
+
description: "hooks",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "components",
|
|
19
|
+
entry: "src/components/index.ts",
|
|
20
|
+
description: "组件",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "directives",
|
|
24
|
+
entry: "src/directives/index.ts",
|
|
25
|
+
description: "自定义指令",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "tplib",
|
|
29
|
+
entry: "src/tp-lib/index.ts",
|
|
30
|
+
description: "图扑工具库",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "video",
|
|
34
|
+
entry: "src/components/video/index.ts",
|
|
35
|
+
description: "视频",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "videoMobile",
|
|
39
|
+
entry: "src/components/video/indexMobile.ts",
|
|
40
|
+
description: "视频移动端",
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
export default modules;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { defineConfig, RollupOptions } from "rollup";
|
|
2
|
+
import pkg from "../package.json";
|
|
3
|
+
import modules from "./modules";
|
|
4
|
+
import esbuild from "rollup-plugin-esbuild";
|
|
5
|
+
import dts from "rollup-plugin-dts";
|
|
6
|
+
import babel from "@rollup/plugin-babel";
|
|
7
|
+
import postcss from "rollup-plugin-postcss";
|
|
8
|
+
import cssnano from "cssnano";
|
|
9
|
+
import json from "@rollup/plugin-json";
|
|
10
|
+
import jsx from "acorn-jsx";
|
|
11
|
+
import copy from "rollup-plugin-copy";
|
|
12
|
+
|
|
13
|
+
const extensions = [".ts", ".js", ".tsx", ".json", ".ttf", ".woff", ".woff2"];
|
|
14
|
+
const externals = [
|
|
15
|
+
...Object.keys(pkg.dependencies),
|
|
16
|
+
...Object.keys(pkg.devDependencies),
|
|
17
|
+
...Object.keys(pkg.peerDependencies),
|
|
18
|
+
/ant-design-vue\/*/,
|
|
19
|
+
/vite-plugin-qiankun\/*/,
|
|
20
|
+
"dayjs",
|
|
21
|
+
"@ant-design/icons-vue",
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
const onwarn = (warning, rollupWarn) => {
|
|
25
|
+
if (warning.code !== "UNUSED_EXTERNAL_IMPORT") {
|
|
26
|
+
rollupWarn(warning);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const isProduction = process.env.BUILD === "production";
|
|
31
|
+
|
|
32
|
+
const configList: RollupOptions[] = [];
|
|
33
|
+
|
|
34
|
+
for (const module of modules) {
|
|
35
|
+
const isMainBundle = module.name === "root";
|
|
36
|
+
|
|
37
|
+
const babelPlugin = babel({ babelHelpers: "bundled", extensions });
|
|
38
|
+
const copyPlugin =
|
|
39
|
+
isMainBundle &&
|
|
40
|
+
copy({
|
|
41
|
+
targets: [
|
|
42
|
+
{
|
|
43
|
+
src: "src/assets/iconfont/index.js",
|
|
44
|
+
dest: "dist",
|
|
45
|
+
rename: "iconfont.js",
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
verbose: true,
|
|
49
|
+
});
|
|
50
|
+
const esbuildPlugin = esbuild({
|
|
51
|
+
drop: isProduction ? ["console", "debugger"] : undefined,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// esm
|
|
55
|
+
configList.push({
|
|
56
|
+
input: module.entry,
|
|
57
|
+
output: {
|
|
58
|
+
file: `dist/${isMainBundle ? "index.js" : `${module.name}/index.js`}`,
|
|
59
|
+
format: "es",
|
|
60
|
+
name: module.name,
|
|
61
|
+
exports: "named",
|
|
62
|
+
},
|
|
63
|
+
plugins: [
|
|
64
|
+
json(),
|
|
65
|
+
esbuildPlugin,
|
|
66
|
+
babelPlugin,
|
|
67
|
+
postcss({ to: "dist/style.css", inject: false }),
|
|
68
|
+
copyPlugin,
|
|
69
|
+
],
|
|
70
|
+
acornInjectPlugins: [jsx() as any],
|
|
71
|
+
external: externals,
|
|
72
|
+
onwarn,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// cjs
|
|
76
|
+
configList.push({
|
|
77
|
+
input: module.entry,
|
|
78
|
+
output: {
|
|
79
|
+
file: `dist/${isMainBundle ? "index.cjs" : `${module.name}/index.cjs`}`,
|
|
80
|
+
format: "cjs",
|
|
81
|
+
name: module.name,
|
|
82
|
+
exports: "named",
|
|
83
|
+
},
|
|
84
|
+
plugins: [
|
|
85
|
+
json(),
|
|
86
|
+
esbuildPlugin,
|
|
87
|
+
babelPlugin,
|
|
88
|
+
postcss({ plugins: [cssnano], extract: "style.css" }),
|
|
89
|
+
copyPlugin,
|
|
90
|
+
],
|
|
91
|
+
acornInjectPlugins: [jsx() as any],
|
|
92
|
+
external: externals,
|
|
93
|
+
onwarn,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// // iife
|
|
97
|
+
// if (isMainBundle) {
|
|
98
|
+
// configList.push({
|
|
99
|
+
// input: module.entry,
|
|
100
|
+
// output: {
|
|
101
|
+
// file: `dist/${
|
|
102
|
+
// isMainBundle ? "index.min.js" : `${module.name}/index.min.js`
|
|
103
|
+
// }`,
|
|
104
|
+
// format: "iife",
|
|
105
|
+
// name: module.name,
|
|
106
|
+
// },
|
|
107
|
+
// plugins: [
|
|
108
|
+
// json(),
|
|
109
|
+
// esbuild({ minify: true, globalName: "inlUI" }),
|
|
110
|
+
// babelPlugin,
|
|
111
|
+
// postcss({ plugins: [cssnano], extract: "style.css" }),
|
|
112
|
+
// ],
|
|
113
|
+
// acornInjectPlugins: [jsx() as any],
|
|
114
|
+
// });
|
|
115
|
+
// }
|
|
116
|
+
|
|
117
|
+
// dts
|
|
118
|
+
configList.push({
|
|
119
|
+
input: module.entry,
|
|
120
|
+
output: {
|
|
121
|
+
file: `dist/${isMainBundle ? "index.d.ts" : `${module.name}/index.d.ts`}`,
|
|
122
|
+
format: "es",
|
|
123
|
+
name: module.name,
|
|
124
|
+
},
|
|
125
|
+
external: [/\.css$/, /\.less$/],
|
|
126
|
+
plugins: [json(), dts()],
|
|
127
|
+
acornInjectPlugins: [jsx() as any],
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export default defineConfig(configList);
|
package/conf/utils.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import pkg from "../package.json";
|
|
2
|
+
import { resolve } from "path";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 获取当前版本的下一个版本
|
|
6
|
+
* @returns 新版本
|
|
7
|
+
*/
|
|
8
|
+
export function getDefaultNextVersion() {
|
|
9
|
+
const version = pkg.version;
|
|
10
|
+
const versionList = version.split(".");
|
|
11
|
+
let lastV = Number(versionList[versionList.length - 1]);
|
|
12
|
+
lastV += 1;
|
|
13
|
+
versionList.splice(versionList.length - 1, 1, lastV + "");
|
|
14
|
+
return versionList.join(".");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function resolvePath(p: string) {
|
|
18
|
+
return resolve(__dirname, p);
|
|
19
|
+
}
|