{"id":21708528,"url":"https://github.com/ufologist/weappdevtools-cli","last_synced_at":"2025-04-12T16:31:17.604Z","repository":{"id":136687095,"uuid":"150951719","full_name":"ufologist/weappdevtools-cli","owner":"ufologist","description":"微信小程序开发者工具命令行小秘书","archived":false,"fork":false,"pushed_at":"2020-05-25T08:48:52.000Z","size":51,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T10:52:19.973Z","etag":null,"topics":["cli","spec","upload","weapp","wechatdevtools"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/ufologist.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-30T09:17:49.000Z","updated_at":"2024-03-12T10:58:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"c0d06c8d-573b-47a0-b8e5-3f81a5d8176c","html_url":"https://github.com/ufologist/weappdevtools-cli","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufologist%2Fweappdevtools-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufologist%2Fweappdevtools-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufologist%2Fweappdevtools-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufologist%2Fweappdevtools-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ufologist","download_url":"https://codeload.github.com/ufologist/weappdevtools-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248596476,"owners_count":21130709,"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":["cli","spec","upload","weapp","wechatdevtools"],"created_at":"2024-11-25T22:27:42.242Z","updated_at":"2025-04-12T16:31:17.589Z","avatar_url":"https://github.com/ufologist.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# weappdevtools-cli\n\n[![NPM version][npm-image]][npm-url] [![changelog][changelog-image]][changelog-url] [![license][license-image]][license-url]\n\n[npm-image]: https://img.shields.io/npm/v/weappdevtools-cli.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/weappdevtools-cli\n[license-image]: https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square\n[license-url]: https://github.com/ufologist/weappdevtools-cli/blob/master/LICENSE\n[changelog-image]: https://img.shields.io/badge/CHANGE-LOG-blue.svg?style=flat-square\n[changelog-url]: https://github.com/ufologist/weappdevtools-cli/blob/master/CHANGELOG.md\n\n\u003e 微信小程序官方已经推出了 [miniprogram-ci](https://developers.weixin.qq.com/miniprogram/dev/devtools/ci.html \"开发者可不打开小程序开发者工具，独立使用 miniprogram-ci 进行小程序代码的上传、预览等操作\"), 推荐大家使用, `weappdevtools-cli` 可以光荣的退休了\n\n微信小程序开发者工具命令行小秘书\n\n## Why\n\n通过工具规范化微信小程序上传代码时需要人为填写的 **版本号** 和 **备注**\n![upload-example](https://raw.githubusercontent.com/ufologist/weappdevtools-cli/master/upload-example.png)\n\n* 生成的 **版本号** 规则\n  * 尝试读取微信小程序项目根目录下的 `package.json` 文件中的版本号\n  * 尝试读取微信小程序项目 GIT 最后提交的日志的 hash 值\n  * 组合: `${pkg.version}.${hash}.${env}`\n  * 例如: `1.0.0.7004c7b.prod`\n* 生成的 **备注** 规则\n  * 读取命令行中传入的环境参数: `--env`\n  * 读取命令行中传入的备注参数: `--desc`\n  * 尝试读取微信小程序项目 GIT 最后提交的日志的 message\n  * 组合: `env: ${env} ${desc || message}`\n  * 例如: `env: test 补充信息`\n\n## Installation\n\n```\nnpm install weappdevtools-cli -g\n```\n\n## Example usage\n\n### upload\n\n```\ncd /path/to/weapp-project-root-dir\nweappdevtools-cli upload --env=test\n```\n\nor\n\n```\nweappdevtools-cli upload --projectRoot=/path/to/weapp-project-root-dir --env=test\n```\n\n```\n√ Get last commit log: {\"hash\":\"7004c7bxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\"date\":\"2018-09-28 13:42:26 +0800\",\"message\":\"\",\"author_name\":\"\",\"author_email\":\"\"}\n√ Find wechatdevtools process: {\"name\":\"wechatdevtools.exe\",\"pid\":26096,\"path\":\"E:\\\\Program Files\\\\Tencent\\\\微信web开发者工具\\\\wechatdevtools.exe\"}\n--------------------------\nUse wechatdevtools cli: E:\\Program Files\\Tencent\\微信web开发者工具\\cli.bat\n--------------------------\n--------------------------\n\u003e cli.bat -u 1.0.0.7004c7b@E:\\a\\b\\c\\fe-weapp-xxx --upload-desc \"env: test\" --upload-info-output \"E:\\a\\b\\c\\fe-weapp-xxx\\upload-info.json\"\n--------------------------\nInitializing...\n\nidePortFile: C:\\Users\\xx\\AppData\\Local\\微信web开发者工具\\User Data\\Default\\.ide\n\nIDE server has started, listening on http://127.0.0.1:60233\ninitialization finished\nuploading project...\nupload success\n\n--------------------------\n┌─────────────────────┬───────────────────────┬────────────────────┬────────────┐\n│ 时间                │ 项目                   │ 版本号             │ 项目备注   │\n├─────────────────────┼───────────────────────┼────────────────────┼────────────┤\n│ 2018-12-26 11:45:26 │ E:\\a\\b\\c\\fe-weapp-xxx │ 1.0.0.7004c7b.test │ env: test  │\n└─────────────────────┴───────────────────────┴────────────────────┴────────────┘\n--------------------------\n本次上传的额外信息: {\"size\":{\"total\":408.67,\"packages\":[{\"name\":\"__FULL__\",\"size\":408.67}]}}\n```\n\n### preview\n\n```\nweappdevtools-cli preview --projectRoot=/path/to/weapp-project-root-dir\n```\n\n```\n√ Find wechatdevtools process: {\"name\":\"wechatdevtools.exe\",\"pid\":26096,\"path\":\"E:\\\\Program Files\\\\Tencent\\\\微信web开发者工具\\\\wechatdevtools.exe\"}\n--------------------------\nUse wechatdevtools cli: E:\\Program Files\\Tencent\\微信web开发者工具\\cli.bat\n--------------------------\n--------------------------\n\u003e cli.bat -p E:\\a\\b\\c\\fe-weapp-xxx --preview-info-output \"E:\\a\\b\\c\\fe-weapp-xxx\\preview-info.json\"\n--------------------------\nInitializing...\n\nidePortFile: C:\\Users\\xx\\AppData\\Local\\微信web开发者工具\\User Data\\Default\\.ide\n\nIDE server has started, listening on http://127.0.0.1:60233\n\ninitialization finished\npreparing preview...\n[qrcode]\npreview success\n\n--------------------------\n本次预览的额外信息: {\"size\":{\"total\":408.67,\"packages\":[{\"name\":\"__FULL__\",\"size\":408.67}]}}\n```\n\n## Notice\n\n* 需要将开发者工具的`设置-安全设置-服务端口`打开\n* 需要将目标项目从\"微信web开发者工具\"中删除掉一次(执行命令后会自动再加上该项目)\n* 如果你的项目的开发模式非微信小程序原生的开发模式, 例如使用了 [min](https://github.com/meili/min-cli) 或者其他(wepy/mpvue/taro/...)\n  * 需要给 `project.config.json` 添加 [`miniprogramRoot`](https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html) 参数","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fufologist%2Fweappdevtools-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fufologist%2Fweappdevtools-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fufologist%2Fweappdevtools-cli/lists"}