{"id":19974442,"url":"https://github.com/alanchenchen/codecounter","last_synced_at":"2025-05-04T02:32:49.285Z","repository":{"id":36052173,"uuid":"135688093","full_name":"alanchenchen/CodeCounter","owner":"alanchenchen","description":"An application to count code in golang(wails v2) or electron-vue","archived":false,"fork":false,"pushed_at":"2023-02-25T01:40:31.000Z","size":1114,"stargazers_count":10,"open_issues_count":6,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-02-26T05:11:55.294Z","etag":null,"topics":["count-lines-of-code","electron","electron-vue","go","vue","wails-app","wails2"],"latest_commit_sha":null,"homepage":"","language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alanchenchen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-01T08:10:32.000Z","updated_at":"2023-02-26T05:11:55.294Z","dependencies_parsed_at":"2023-01-16T12:26:30.848Z","dependency_job_id":null,"html_url":"https://github.com/alanchenchen/CodeCounter","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanchenchen%2FCodeCounter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanchenchen%2FCodeCounter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanchenchen%2FCodeCounter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanchenchen%2FCodeCounter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alanchenchen","download_url":"https://codeload.github.com/alanchenchen/CodeCounter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224379840,"owners_count":17301525,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["count-lines-of-code","electron","electron-vue","go","vue","wails-app","wails2"],"created_at":"2024-11-13T03:15:02.133Z","updated_at":"2024-11-13T03:15:02.869Z","avatar_url":"https://github.com/alanchenchen.png","language":"Vue","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Code Counter\n\n\u003e An application to count code in wails(golang)\n\n\u003e version:  2.0.1\n\n\u003e Author:  Alan Chen\n\n\u003e Technology stack:  Vue2 + Vite + iview + Golang + Wails v2\n\n`electron版本见branch v1`\n\n### Features\n * 采用wails v2包生成app、exe可执行文件，方便离线使用。\n * wails使用系统自带webview，而不是electron内置，软件打包后安装包2～3M，比内置chromium方案磁盘占用、内存占用率优秀很多\n * golang的go routine在读取文件和cpu计算会充分利用多核处理器，处理速度更快\n * 支持文件夹读取文件，自定义统计哪个文件夹下代码数量\n * 支持文件(夹)过滤，支持对应后缀名文件过滤\n * 支持对应后缀名文件添加自定义注释规则，目前只自带很小一部分代码的默认注释规则\n\n![](./screenshot/screenshot1.png)\n![](./screenshot/screenshot2.png)\n![](./screenshot/screenshot3.png)\n\n### Usage Help\n 1. 点击即可读取文件夹，目前仅支持统计一个文件夹，再次添加会覆盖\n 2. 过滤功能只对文件夹生效，在弹窗中按enter添加，注意添加后缀名必须带上点\n 3. 注释规则文件名不需要带点，规则分为多行注释和单行注释，非必填，一个后缀名文件可以添加多个规则，但不可重复。\n 4. 软件默认过滤`node_modules`和`.git`两个文件夹。\n 5. 软件默认提供js、ts、go、jsx、tsx、vue、svelte、html、css、java、vue、c和cpp等后缀名文件的注释规则\n 6. 读取代码的原理其实是将目标文件的buffer转换成utf-8的string，所以只支持uft-8编码的文件，。大多数code的编码格式是utf-8。\n\n### Download\n\u003e 见[release](https://github.com/alanchenchen/CodeCounter/releases)\n \n### Directory Tree\n``` bash\n    ├─build                 编译平台相关的配置文件、可执行程序\n    ├─count                 code counter的主要go module\n    ├─frontend              wails展示的前端静态资源，wails不强关联前端框架和构建工具\n    │  ├─src\n    │   └─wailsjs           wails在加载静态资源时自动生成的方法bindings，见wails文档\n    │  ├─index.html\n    │  ├─package.json\n    │  └─vite.config.js     vite config配置\n    ├─screenshot  \n    ├─scripts               wails的常用命令组合的shell脚本，见wails文档\n    ├─app.go                wails程序的app结构体，主要用于绑定go方法到js运行时，见wails文档\n    ├─main.go               wails程序的入口，初始化，见wails文档\n    └─wails.json            wails cli打包程序需要的配置，见wails文档\n```\n\n### Development Setup\n#### Required dependencies\n- Go 1.17+\n- wails v2 beta+\n- NPM (Node 15+)\n\u003e 详细见[wails文档](https://wails.io/zh-Hans/docs/gettingstarted/installation)\n\n#### Dev liveload\n项目逻辑分为前端和后端\n- 前端可以使用任意框架，兼容性不用过于考虑，因为windows平台使用的webview2(和chromium一致)，前端使用go绑定方法也十分简单，都是挂载windows对象\n- 后端的go方法可以使用任意go module，当需要绑定给js运行时，只需要在`app.go`里扩展App struct的接收器方法即可\n- 如果需要在程序运行中使用前端项目的hot load热更新，必须要先打开一个终端运行`wails dev`，然后另一个终端运行`npm run dev`\n- wails读取前端静态资源的策略比较奇怪，所以不建议使用wails的frontend构建\n\n#### Build\n```bash\n# 使用upx压缩打包\n$ wails build --upx\n```\n- target是mac平台\n    - 本机必须是mac系统，可以同时编译amd64、arm64架构\n- target是windows平台\n    - 只能编译windows，可以同时编译amd64、arm64架构\n\n- 所有平台均可使用upx来压缩，压缩比例非常强\n- mac平台编译完的是app文件，windows默认编译完的是exe，所有平台均可使用nsis来打包exe\n- wails使用的方案是系统自带的webview，目前macos/linux主流版本均内置，windows平台使用的webview2只在部分win10和正式win11内置，所以当你的windwos系统中不存在webview2时，程序启动后会引导你安装，大概118M左右\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falanchenchen%2Fcodecounter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falanchenchen%2Fcodecounter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falanchenchen%2Fcodecounter/lists"}