├── .github └── ISSUE_TEMPLATE │ ├── Bug.md │ └── Feature or Suggestion.md ├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── README_ZH.md ├── design ├── logo.html └── vue.png ├── index.html ├── package.js ├── package.json ├── publish.py ├── shortcut ├── dragging.gif ├── ele-info.png ├── logo.png └── vue-web-terminal.gif ├── src ├── Terminal.vue ├── ansi │ ├── ansi-256-colors.json │ └── index.ts ├── common │ ├── api │ │ └── index.ts │ ├── configuration.ts │ ├── store │ │ └── index.ts │ └── util.ts ├── components │ ├── TEditor.vue │ ├── THeader.vue │ ├── THelpBox.vue │ ├── TViewerCode.vue │ ├── TViewerJson.vue │ ├── TViewerNormal.vue │ └── TViewerTable.vue ├── css │ ├── ansi.css │ ├── scrollbar.css │ ├── style.css │ └── theme │ │ ├── dark.css │ │ └── light.css ├── env.d.ts ├── index.ts └── types │ └── index.ts ├── test ├── App.vue └── main.ts ├── tsconfig.json ├── tsconfig.node.json ├── vite.config.ts └── vue-web-terminal.iml /.github/ISSUE_TEMPLATE/Bug.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: tzfun 7 | 8 | --- 9 | 10 | **Bug description** 11 | A clear and concise description of what the bug is. 12 | 13 | **Steps to reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Screenshot** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Reproduce environment:** 24 | - OS: [e.g. iOS] 25 | - Browser [e.g. chrome, safari] 26 | - Version [e.g. 2.0.4] 27 | 28 | **Detailed Description** 29 | Add any other context about the problem here. 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Feature or Suggestion.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature or Suggestion 3 | about: Provide some better suggestions or optimizations 4 | title: '' 5 | labels: enhancement 6 | assignees: tzfun 7 | 8 | --- 9 | 10 | **Feature or optimization description** 11 | 12 | **Applicable scene** 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | # local env files 11 | .env.local 12 | .env.*.local 13 | 14 | node_modules 15 | dist 16 | dist-ssr 17 | *.local 18 | /lib 19 | 20 | # Editor directories and files 21 | .vscode/* 22 | !.vscode/extensions.json 23 | .idea 24 | .vscode 25 | .DS_Store 26 | *.suo 27 | *.ntvs* 28 | *.njsproj 29 | *.sln 30 | *.sw? 31 | 32 | /vue-web-terminal.css 33 | /vue-web-terminal.js 34 | stats.html 35 | /docs/ 36 | /docs/.vuepress/ 37 | pnpm-lock.yaml 38 | /yarn.lock 39 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .* 2 | *.md 3 | *.yml 4 | *.iml 5 | *.lock 6 | *.html 7 | tsconfig.json 8 | tsconfig.node.json 9 | vite.config.ts 10 | build/ 11 | node_modules/ 12 | src/ 13 | test/ 14 | dist/ 15 | public/ 16 | gulpfile.js 17 | babel.config.js 18 | webpack.config.js 19 | vue.config.js 20 | package.js 21 | lib/*.html 22 | lib/*.chunk.* 23 | lib/*.txt 24 | lib/*.png 25 | lib/*.gif 26 | lib/*.jpg 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [中文版](./README_ZH.md) | English 2 | 3 |
4 | 5 |
6 | 7 | # vue-web-terminal 8 | 9 | 10 | 11 | 12 | Downloads 13 | Version 14 | 15 | A web-side command line plugin built by `Vue`, supports multiple message formats such as tables, json, and codes, supports custom message styles, command line libraries, typing search prompts, etc., and simulates native terminal support ← → cursor toggle and ↑ ↓ history command toggle. 16 | 17 | > :tada: The new document is now available. It's more detailed and more friendly, welcome to experience it: [https://tzfun.github.io/vue-web-terminal/](https://tzfun.github.io/vue-web-terminal/) 18 | 19 | ## Feature Support 20 | 21 | * Supported message formats: plain text, table, json, code/multi-line text, html, ansi 22 | * Supports real-time content display and appending, and can create simple animation effects 23 | * Support user question and answer input 24 | * Support online text editing 25 | * Support window dragging and fixing 26 | * Support ← → cursor key switching and ↑ ↓ key history command switching 27 | * Support fullscreen 28 | * Support command input prompts 29 | * Support logging group folding 30 | * Supports multiple styles of slots, customizable styles 31 | * Supports themes, with built-in dark and light themes by default, and you can also customize themes 32 | * Provides a rich set of JS APIs, almost all functions can be simulated by APIs to simulate non-human operations 33 | * Supports Vue2/Vue3 34 | 35 | ![vue-web-terminal](shortcut/vue-web-terminal.gif) 36 | 37 | > Short description: 38 | > 39 | > It does not have the ability to execute a specific command. This ability needs to be implemented by the developer. 40 | > What it is responsible for is to get the command to be executed from the user in the form of an interface, and then 41 | > hand it over to the developer to implement and execute. After that, hand it over to show it to the user 42 | 43 | # Online Experience 44 | 45 | You can learn about some of the features of this plugin through the [Online Experience](https://tzfun.github.io/vue-web-terminal/demo.html), or try editing the code and previewing it on [![Edit Vue Template](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/silly-scooby-l8wk9b). 46 | 47 | # Document 48 | 49 | Please go to [Document](https://tzfun.github.io/vue-web-terminal/) 50 | 51 | # Quick Start 52 | 53 | > The **Vue2** version will be officially archived from **December 24, 2024** and will no longer provide maintenance updates. 54 | > For the source code, see [vue2 branch](https://github.com/tzfun/vue-web-terminal/tree/vue2). 55 | 56 | Install vue-web-terminal by npm. The `2.x.x` version corresponds to vue2, and the `3.x.x` version corresponds to vue3. 57 | It is recommended to download the latest version corresponding to the main version. 58 | 59 | ```shell 60 | # install for vue2 61 | npm install vue-web-terminal@2.xx --save 62 | 63 | # install for vue3 64 | npm install vue-web-terminal@3.xx --save 65 | ``` 66 | 67 | Use Terminal plugin in `main` 68 | 69 | **Vue2** 70 | ```js 71 | import Terminal from 'vue-web-terminal' 72 | 73 | Vue.use(Terminal) 74 | ``` 75 | 76 | **Vue3** 77 | ```ts 78 | import { createTerminal } from 'vue-web-terminal' 79 | 80 | const app = createApp(App) 81 | 82 | app.use(createTerminal()) 83 | 84 | app.mount('#app') 85 | ``` 86 | 87 | Example: 88 | 89 | ```vue 90 | 109 | 114 | 115 | 123 | ``` 124 | 125 | # Contact Author 126 | 127 | I am a backend coder, and I know a little bit about frontend. This plugin was created out of my interest. 128 | 129 | If you have good ideas for code optimization or functions and are willing to contribute code, please submit [PR](https://github.com/tzfun/vue-web-terminal/pulls), 130 | If you have any questions about the use of the plugin or find bugs, please submit[issue](https://github.com/tzfun/vue-web-terminal/issues). 131 | 132 | > Contact me (Add please note vue-web-terminal) 133 | > 134 | > 📮 Email: *beifengtz@qq.com* 135 | > 136 | > ![](https://open.weixin.qq.com/zh_CN/htmledition/res/assets/res-design-download/icon16_wx_logo.png) WeChat: *beifeng-tz* 137 | 138 | # License 139 | 140 | [Apache License 2.0](LICENSE) 141 | -------------------------------------------------------------------------------- /README_ZH.md: -------------------------------------------------------------------------------- 1 | 中文版 | [English](./README.md) 2 | 3 |
4 | 5 |
6 | 7 | # vue-web-terminal 8 | 9 | 10 | 11 | 12 | Downloads 13 | Version 14 | 15 | 一个由 Vue 构建的支持多内容格式显示的网页端命令行窗口插件,支持表格、json、代码等多种消息格式,支持自定义消息样式、命令行库、键入搜索提示等,模拟原生终端窗口支持 ← → 16 | 光标切换和 ↑ ↓ 历史命令切换。 17 | 18 | > :tada: 新版文档已开放访问,文档更详细界面更友好,欢迎体验:[https://tzfun.github.io/vue-web-terminal/](https://tzfun.github.io/vue-web-terminal/) 19 | 20 | ## 功能支持 21 | 22 | * 支持消息格式:普通文本、表格、json、代码/多行文本、html、ansi 23 | * 支持内容实时回显、追加,可制作简单的动画效果 24 | * 支持用户问答输入 25 | * 支持在线文本编辑 26 | * 支持窗口拖拽、固定 27 | * 支持 ← → 光标键切换和 ↑ ↓ 键历史命令切换 28 | * 支持一键全屏 29 | * 支持命令输入提示 30 | * 支持日志记录分组折叠 31 | * 支持多种样式 Slot 插槽,可自定义样式 32 | * 支持主题,默认内置暗色和亮色主题,也可自定义主题 33 | * 提供丰富的JS API,几乎所有功能均可由API来模拟非人为操作 34 | * 支持Vue2/Vue3 35 | 36 | ![vue-web-terminal](shortcut/vue-web-terminal.gif) 37 | 38 | > 一句话描述: 39 | > 40 | > 它并不具备执行某个具体命令的能力,这个能力需要开发者自己去实现,它负责的事情是在网页上以终端界面的形式从用户那拿到想要执行的命令,然后交给开发者去实现,执行完之后再交给它展示给用户。 41 | 42 | # 在线体验 43 | 44 | 你可以通过 [在线体验](https://tzfun.github.io/vue-web-terminal/demo.html) 了解本插件的一些功能,也可以在 [![Edit Vue Template](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/silly-scooby-l8wk9b) 上尝试编辑代码并预览。 45 | 46 | # 文档 47 | 48 | 请前往 [Document](https://tzfun.github.io/vue-web-terminal/) 阅读使用文档 49 | 50 | # 快速上手 51 | 52 | > **Vue2**版本从 **2024年12月24日** 开始正式归档,不再提供维护更新, 53 | > 源码见 [vue2分支](https://github.com/tzfun/vue-web-terminal/tree/vue2)。 54 | 55 | npm安装vue-web-terminal,`2.x.x`版本对应vue2,`3.x.x`版本对应vue3,建议下载对应大版本的最新版。 56 | 57 | ```shell 58 | # install for vue2 59 | npm install vue-web-terminal@2.xx --save 60 | 61 | # install for vue3 62 | npm install vue-web-terminal@3.xx --save 63 | ``` 64 | 65 | `main`中载入 Terminal 插件 66 | 67 | **Vue2** 68 | ```js 69 | import Terminal from 'vue-web-terminal' 70 | 71 | Vue.use(Terminal) 72 | ``` 73 | 74 | **Vue3** 75 | ```ts 76 | import { createTerminal } from 'vue-web-terminal' 77 | 78 | const app = createApp(App) 79 | 80 | app.use(createTerminal()) 81 | 82 | app.mount('#app') 83 | ``` 84 | 85 | 使用示例 86 | 87 | ```vue 88 | 107 | 112 | 113 | 121 | ``` 122 | 123 | # 联系作者 124 | 125 | 我是一名后端Coder,恰巧对前端也会一点,个人兴趣开发了此插件。 126 | 127 | 如果对代码优化或功能有好的想法并乐意贡献代码欢迎提交[PR](https://github.com/tzfun/vue-web-terminal/pulls) 128 | ,对插件使用存在疑问或发现bug请提交[issue](https://github.com/tzfun/vue-web-terminal/issues)。 129 | 130 | > 联系我(添加请备注vue-web-terminal) 131 | > 132 | > 📮 Email: *beifengtz@qq.com* 133 | > 134 | > ![](https://open.weixin.qq.com/zh_CN/htmledition/res/assets/res-design-download/icon16_wx_logo.png) 微信: *beifeng-tz* 135 | 136 | # License 137 | 138 | [Apache License 2.0](LICENSE) 139 | -------------------------------------------------------------------------------- /design/logo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | vue-web-terminal design 6 | 47 | 48 | 49 | 50 | 64 | 65 | 66 | 91 | -------------------------------------------------------------------------------- /design/vue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzfun/vue-web-terminal/64e018f2107e8bf6aae2f095f7d6e735baf534da/design/vue.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | vue-web-terminal demo 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /package.js: -------------------------------------------------------------------------------- 1 | import path from 'path' 2 | import fs from 'fs' 3 | 4 | function copyDir(src, dest) { 5 | fs.mkdirSync(dest) 6 | for (let f of fs.readdirSync(src)) { 7 | fs.copyFileSync(path.join(src, f), path.join(dest, f)); 8 | } 9 | console.log('copied', `'${src}'`, '-->', `'${dest}'`) 10 | } 11 | 12 | function deleteFile(fileOrDirName) { 13 | let stat = fs.statSync(fileOrDirName) 14 | if (stat.isDirectory()) { 15 | for (let f of fs.readdirSync(fileOrDirName)) { 16 | let filePath = path.join(fileOrDirName, f) 17 | deleteFile(filePath) 18 | } 19 | fs.rmdirSync(fileOrDirName) 20 | } else { 21 | fs.unlinkSync(fileOrDirName) 22 | console.log(`deleted ==> ${fileOrDirName}`) 23 | } 24 | } 25 | 26 | function deleteFileWithPattern(dir, regexp) { 27 | for (let f of fs.readdirSync(dir)) { 28 | if (f.match(regexp)) { 29 | fs.unlinkSync(path.join(dir, f)) 30 | console.log(`deleted ==> ${dir}/${f}`) 31 | } 32 | } 33 | } 34 | 35 | function copyTypes() { 36 | fs.copyFileSync('./lib/types/index.d.ts', './lib/types.d.ts') 37 | deleteFile('./lib/types') 38 | console.log(`copied types.d.ts`) 39 | } 40 | 41 | // copyDir('./src/css/theme', './lib/theme'); 42 | deleteFile('./lib/ansi') 43 | deleteFile('./lib/common') 44 | deleteFile('./lib/components') 45 | deleteFileWithPattern('./lib', /\.(png|gif|jpg)/) 46 | // copyTypes() 47 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-web-terminal", 3 | "version": "3.4.1", 4 | "description": "A beautiful web-side command line window plugin (native simulation). 一个漂亮的网页命令行插件(原生模拟)", 5 | "license": "Apache-2.0", 6 | "private": false, 7 | "type": "module", 8 | "main": "lib/vue-web-terminal.umd.cjs", 9 | "module": "lib/vue-web-terminal.js", 10 | "types": "./lib/index.d.ts", 11 | "exports": { 12 | ".": { 13 | "import": "./lib/vue-web-terminal.js", 14 | "require": "./lib/vue-web-terminal.umd.cjs", 15 | "types": [ 16 | "./lib/index.d.ts", 17 | "./lib/Terminal.vue.d.ts", 18 | "./lib/types/index.d.ts" 19 | ] 20 | } 21 | }, 22 | "files": [ 23 | "package.json", 24 | "README.md", 25 | "LICENSE", 26 | "lib" 27 | ], 28 | "publishConfig": { 29 | "registry": "https://registry.npmjs.org", 30 | "access": "public" 31 | }, 32 | "scripts": { 33 | "test": "vite --host", 34 | "build": "vite build&& vue-tsc", 35 | "preview": "vite preview" 36 | }, 37 | "dependencies": { 38 | "vue": "^3.3.4", 39 | "vue-json-viewer": "^3.0.4" 40 | }, 41 | "devDependencies": { 42 | "@types/node": "20.16.13", 43 | "@vitejs/plugin-vue": "4.6.2", 44 | "rollup-plugin-visualizer": "5.9.3", 45 | "sass": "1.62.1", 46 | "terser": "5.37.0", 47 | "typescript": "5.4.5", 48 | "vite": "5.4.6", 49 | "vue-tsc": "1.8.26", 50 | "vite-plugin-css-injected-by-js": "3.3.1", 51 | "vite-plugin-dts": "3.6.3" 52 | }, 53 | "browserslist": [ 54 | "> 1%", 55 | "last 2 versions", 56 | "not dead", 57 | "not ie 11" 58 | ], 59 | "repository": { 60 | "type": "git", 61 | "url": "https://github.com/tzfun/vue-web-terminal.git" 62 | }, 63 | "bugs": { 64 | "url": "https://github.com/tzfun/vue-web-terminal/issues" 65 | }, 66 | "homepage": "https://tzfun.github.io/vue-web-terminal/", 67 | "keywords": [ 68 | "terminal", 69 | "vue", 70 | "vue3", 71 | "web-terminal", 72 | "vue-terminal", 73 | "console", 74 | "web-console", 75 | "vue-console" 76 | ], 77 | "author": "beifengtz" 78 | } 79 | -------------------------------------------------------------------------------- /publish.py: -------------------------------------------------------------------------------- 1 | # encoding=utf8 2 | 3 | import subprocess 4 | import platform 5 | 6 | NPM_REPOSITORY="https://registry.npmjs.org" 7 | NPM_REPOSITORY_MIRROR="https://registry.npmmirror.com" 8 | NODE_VERSION = 18 9 | ENCODING = "gbk" if platform.system().lower() == 'windows' else 'utf-8' 10 | 11 | def execute(command, with_result = False,encoding = ENCODING): 12 | print(f"[calling]: {command}") 13 | if with_result: 14 | p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding=encoding) 15 | stdout,stderr = p.communicate() 16 | if p.returncode == 0: 17 | return stdout 18 | else: 19 | raise Exception(f"exit with {p.returncode}, stderr: {stderr}") 20 | else: 21 | returncode = subprocess.call(command, shell=True, encoding=encoding) 22 | if returncode != 0: 23 | raise Exception(f"exit with {returncode}") 24 | 25 | if __name__ == '__main__': 26 | registry = execute(f'npm config get registry', with_result=True) 27 | node_version = execute(f'node -v', with_result=True) 28 | if not node_version.startswith(f'v{NODE_VERSION}'): 29 | raise Exception(f'Node version must be {NODE_VERSION}') 30 | try: 31 | execute(f'pnpm install') 32 | execute(f'pnpm run build') 33 | execute(f'npm config set registry {NPM_REPOSITORY}') 34 | execute(f'npm publish') 35 | finally: 36 | execute(f'npm config set registry {registry}') 37 | -------------------------------------------------------------------------------- /shortcut/dragging.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzfun/vue-web-terminal/64e018f2107e8bf6aae2f095f7d6e735baf534da/shortcut/dragging.gif -------------------------------------------------------------------------------- /shortcut/ele-info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzfun/vue-web-terminal/64e018f2107e8bf6aae2f095f7d6e735baf534da/shortcut/ele-info.png -------------------------------------------------------------------------------- /shortcut/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzfun/vue-web-terminal/64e018f2107e8bf6aae2f095f7d6e735baf534da/shortcut/logo.png -------------------------------------------------------------------------------- /shortcut/vue-web-terminal.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzfun/vue-web-terminal/64e018f2107e8bf6aae2f095f7d6e735baf534da/shortcut/vue-web-terminal.gif -------------------------------------------------------------------------------- /src/Terminal.vue: -------------------------------------------------------------------------------- 1 | 2076 | 2077 |