{"id":16469682,"url":"https://github.com/imfly/js2uml","last_synced_at":"2025-05-09T01:43:59.133Z","repository":{"id":10684512,"uuid":"66504125","full_name":"imfly/js2uml","owner":"imfly","description":"Convert JS to UML class diagrams","archived":false,"fork":false,"pushed_at":"2022-07-08T05:25:15.000Z","size":341,"stargazers_count":124,"open_issues_count":6,"forks_count":27,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-31T20:45:25.330Z","etag":null,"topics":[],"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/imfly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-24T22:23:10.000Z","updated_at":"2025-03-31T01:41:51.000Z","dependencies_parsed_at":"2022-08-07T06:00:20.136Z","dependency_job_id":null,"html_url":"https://github.com/imfly/js2uml","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imfly%2Fjs2uml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imfly%2Fjs2uml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imfly%2Fjs2uml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imfly%2Fjs2uml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imfly","download_url":"https://codeload.github.com/imfly/js2uml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253176439,"owners_count":21866141,"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":[],"created_at":"2024-10-11T12:08:31.832Z","updated_at":"2025-05-09T01:43:58.898Z","avatar_url":"https://github.com/imfly.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# 说明\n本项目计划整合进**正在维护的** [DDN区块链] \u003chttps://github.com/ddnlink/ddn\u003e 项目，作为区块链的一个Dapp，喜欢区块链的小伙伴，欢迎关注收藏。\n\n**配套书籍和视频**: [《Nodejs区块链开发2》](https://github.com/imfly/blockchain-on-nodejs), [旧版电子书](https://github.com/imfly/bitcoin-on-nodejs), [旧版纸质书籍](https://item.jd.com/12206128.html), [旧版代码](https://github.com/ebookcoin/ebookcoin)\n\n# 关于js2uml（About）\nA CLI for converting JS to UML class diagrams.\n\n通过js文件产生Uml类图的命令行工具。详细开发文档：\u003chttps://github.com/imfly/bitcoin-on-nodejs/blob/master/4-开发实践/7-方法论/6-轻松从Js文件生成UML类图.md\u003e\n\n备注：**这里主要生产的是UML类图，对面向对象编程的语言或代码，可以方便地查看类之间的关系。因为js代码特别是灵活，如果你的代码是非常简单的函数式文件，而非类文件，使用本工具没有价值，也无法生成你需要的东西**。\n\n[《Nodejs区块链开发》][] 系列文章里用到的大量js类图，都来自于这个小工具。比如：\n\n![dapps.png](./test/dapps.png)\n\n## 说明(Description)\n\n[《Nodejs区块链开发》][] 系列文章里用到了大量的js类图，有的小伙伴很奇怪怎么来的。说实话，一开始是我个人手工整理的，后来感觉在浪费生命了，就写了正则表达式版的（v0.1.0），因为不够灵活，不适合其他场合，就没有单独放出来。现在引入了抽象语法树，顺带使用函数式编程进行了重构。\n\n本工具，主要使用了如下技能：\n\n* **抽象语法树（AST）的处理**。抽象语法树有很多用途，大部分人可能很少直接在代码里使用，但是几乎每个人也都在用，比如：编辑器的自动提示、自动完成等功能，使用Nodejs的小伙伴，最后都要对代码进行混淆、压缩等处理，那些工具也都要用到；\n* **函数式编程**。原来的版本（V0.1.0)，是完全面向对象的编程方式，也没有使用AST，所以代码长，功能有限。这个版本，进行了优化，使用函数式编程，大大缩减了代码，可以直接导出.png/.svg/.pu等各种格式;\n* **学习plantuml**。这是使用代码处理Uml的最好方式，直接使用dot语言（生成的.pu文件就是），像编写程序一样画Uml图，真的只有程序猿才能体会的畅快。\n\n## 安装（Install)\n\n```\n$ npm install -g js2uml\n```\n\n或者\n\n```\n$ yarn global add js2uml\n```\n\n**注意（Note)**: 如果想直接导出图片格式，如：png,svg等，需要首先安装 [Graphviz][] ，在win系统里，可能还要专门设置环境变量。\n\n## 使用（Usage)\n\n**注意（Note)**:输入输出文件是一定要提供的，不然会提示错误。\n\n```\n$ js2uml -s ./test/dapps.js -o ./test/dapps.png\n```\n\n输出文件后缀格式支持`.png`、`.svg`等[Graphviz][]支持的格式，以及dot格式的`.pu`或`.puml`文件，直接在文件名里提供就是了。\n\n您还可以对生成的图片标题、背景颜色、版本信息等进行定制，详细信息，请查看帮助：\n\n```\n$ js2uml --help\n```\n\n## 计划（Todo）\n\n* 添加测试；\n* 处理变量；\n* 优化布局；\n\n## 关于(About)\n\nDDN区块链：面向企业的区块链系统\n\n网址：\u003chttps://github.com/ddnlink/ddn\u003e\n\n## 协议（License)\n\nMIT License 2016 @imfly\n\n[《Nodejs区块链开发》]: https://github.com/imfly/bitcoin-on-nodejs\n[Graphviz]: http://www.graphviz.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimfly%2Fjs2uml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimfly%2Fjs2uml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimfly%2Fjs2uml/lists"}