{"id":13671360,"url":"https://github.com/jd-cyb/cyb-cli","last_synced_at":"2025-04-27T18:31:08.339Z","repository":{"id":177521321,"uuid":"142947302","full_name":"jd-cyb/cyb-cli","owner":"jd-cyb","description":"塞伯坦（CYB）是面向前端模块化工程的构建工具。主要目的是帮助开发者统一前端开发模式和项目开发结构，提高功能扩展和降低维护成本，自动化前端工作流，提高开发效率和开发质量。","archived":false,"fork":false,"pushed_at":"2025-04-12T21:47:14.000Z","size":11146,"stargazers_count":75,"open_issues_count":12,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-23T02:02:08.653Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://jd-cyb.github.io/cyb-cli","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jd-cyb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-07-31T01:40:31.000Z","updated_at":"2025-04-12T21:47:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"1ed4331a-8716-46c9-b078-df1ec6877318","html_url":"https://github.com/jd-cyb/cyb-cli","commit_stats":{"total_commits":139,"total_committers":3,"mean_commits":"46.333333333333336","dds":"0.043165467625899234","last_synced_commit":"7fab4fd1e531052328ee81acca5d6c5b46026ad1"},"previous_names":["jd-cyb/cyb-cli"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jd-cyb%2Fcyb-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jd-cyb%2Fcyb-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jd-cyb%2Fcyb-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jd-cyb%2Fcyb-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jd-cyb","download_url":"https://codeload.github.com/jd-cyb/cyb-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251187062,"owners_count":21549576,"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-08-02T09:01:07.379Z","updated_at":"2025-04-27T18:31:08.323Z","avatar_url":"https://github.com/jd-cyb.png","language":"JavaScript","readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://jd-cyb.github.io/cyb-cli/\" target=\"_blank\"\u003e\n    \u003cimg width=\"200\" src=\"./.cyb/lib/cyb-logo.png\"\u003e\n  \u003c/a\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n  \u003ca href=\"https://www.npmjs.com/package/cyb-cli\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/v/cyb-cli.svg\" alt=\"npm-version\"\u003e\u003c/a\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n  \u003cimg src=\"https://img.shields.io/npm/dm/cyb-cli.svg\" alt=\"download-num\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/node-%3E=6.11.5-brightgreen.svg\" alt=\"node\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/l/cyb-cli.svg\" alt=\"license\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/platform-MacOS%7CLinux%7CWindows-lightgrey.svg\" alt=\"platform\"\u003e\n  \u003cbr\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003e塞伯坦前端模块化工程构建工具\u003c/h1\u003e\n塞伯坦CYB是面向前端模块化工程的构建工具。主要目的是帮助开发者统一前端开发模式和项目开发结构，提高功能扩展和降低维护成本，自动化前端工作流，提高开发效率和开发质量。\n\n\u003ch2 align=\"center\"\u003e安装和使用\u003c/h2\u003e\n\n- Mac系统推荐使用 [iterm2](http://iterm2.com/) 及 [oh my zsh](http://ohmyz.sh/)。\n- 类 Unix 系统，请打开任意终端输入命令执行。\n- Windows 用户请先安装 [git](http://git-scm.com/)，然后在 [Git Bash](http://git-for-windows.github.io/) 下执行命令。\n- [https://github.com/jd-cyb/cyb-cli/wiki](https://github.com/jd-cyb/cyb-cli/wiki)\n\n### 安装\n\n**1. 安装 Node 和 NPM**\n\n- 官网下载安装Node: [https://nodejs.org](https://nodejs.org)。\n- 需要Node \u003e= 6.11.5，建议使用最新稳定版(LTS)。\n- Ubuntu 用户使用 `apt-get` 安装 node 后，安装的程序名叫 `nodejs`，需要软链成 `node`。\n- Windows 用户安装完成后需要在 CMD 下确认是否能执行 node 和 npm。\n\n\u003e 设置 `npm config set loglevel=http` 可以查看npm包的下载和安装进度。\n\n**2. 全局安装 CYB-CLI**\n\n使用npm安装\n\n``` bash\nnpm install -g cyb-cli\n```\n\n使用yarn安装\n\n``` bash\nyarn global add cyb-cli\n```\n\n\u003e 某些window系统若不能正常安装CYB，请使用管理员身份先安装[windows-build-tools](https://github.com/felixrieseberg/windows-build-tools)。\n\n### 使用\n\n**1. 新建项目**\n\n```bash\ncyb init\n```\n\n根据提示输入项目目录名，比如：demo-cyb，根据提示完成配置项。\n\n```bash\ndemo-cyb\n├── cyb.config.js            /／ CYB功能配置文件\n├── package.json             /／ 项目npm配置文件\n├── .babelrc                 /／ babel配置文件\n├── .editorconfig            /／ 编码风格配置文件\n├── .eslintrc.js             /／ eslint配置文件（可选）\n├── webpack.config.js        /／ webpack配置文件（可选）\n└── src                      /／ 源码目录\n    ├── static               /／ 静态资源目录\n    │   ├── fonts            /／ 字体目录\n    │   ├── images           /／ 图片目录\n    │   └── styles           /／ 样式目录\n    │       └── index.scss   /／ 首页样式文件\n    └── views                /／ 业务逻辑存放目录\n        └── index            /／ 首页目录\n            ├── index.html   /／ 首页Html文件\n            ├── index.js     /／ 首页业务逻辑脚本文件\n            └── module       /／ 首页模块目录 (可自行定义)\n```\n\n\u003e CYB会帮助我们创建统一的项目结构，并且支持自行规划详细的模块级别的目录结构。创建项目会默认创建`index`页面。\n\n**2. 运行及开发项目**\n\n进入 `demo-cyb` 项目目录 执行\n\n```bash\ncyb dev\n```\n\n\u003e CYB 会自动打开默认浏览器进入研发环境，项目任意文件的更改都会自动更新浏览器页面，请尽情享用CYB为你带来高效、愉悦的开发体验！\n\n\u003ch2 align=\"center\"\u003e命令说明\u003c/h2\u003e\n\n- **创建新项目**\n\n```bash\ncyb init\n```\n\n\u003e 快速创建统一结构化项目，包括默认创建首页html模板、统一规划JS脚本、样式文件、图片/字体等静态资源的存放目录。创建项目时可以选择Vue、React、jQuery技术平台。\n\n- **创建新页面**\n\n```bash\ncyb page\n```\n\n\u003e 快速创建统一结构化页面，包括创建页面的html模板，对应的脚本文件和样式文件。支持传统的页面资源部署，或者一切皆模块的组件化部署，更加方便的开发多页面应用。\n\n- **研发环境**\n\n```bash\ncyb dev\n```\n\n\u003e 在本地构建Node开发服务器，脱离nginx、apache等后台服务的依赖，实时编译前端的各种资源，并且在开发过程中任何文件的更改，都会自动更新浏览器界面，实时查看修改效果。\n\n- **生产发布**\n\n```bash\ncyb dist\n```\n\n\u003e 编译和处理源码目录中的所有源文件，通过智能提取、合并压缩、添加CDN前缀、生成md5版本号等自动化流程，并将编译成功后的所有上线文件发布到dist目录。\n\n- **本地测试dist目录**\n\n```bash\ncyb test\n```\n\n\u003e 在本地构建Node测试服务器，读取dist目录中的代码，借助前后端分离的API请求模式，无需发布上线，即可在本地打开浏览器测试上线代码和所有业务逻辑。\n\n- **打包压缩dist目录**\n\n```bash\ncyb zip\n```\n\n\u003e 读取dist目录中所有的代码，在项目根目录下打包压缩成dist.zip文件，用于通过其它途径、或流程工具将代码发布到线上服务器，或发送给客户、领导、合作伙伴验收。\n\n- **特殊字体解决方案**\n\n```bash\ncyb fontmin\n```\n\n\u003e 根据设置的文本抽取大文件TTF的字体信息，转换为eot/woff/ttf等格式的网页字体，告别特殊字体做成图片的lower，帮助我们开发完美个性化的官方网站、活动专题等项目。\n\n- **图片深度无损压缩解决方案**\n\n```bash\ncyb imagemin\n```\n\n\u003e 对整站或单个图片深度无损压缩，整合业界前沿的程序算法，压缩率达50%以上，并且几乎看不出质量差别，极致的图片性能优化，帮助我们开发拥有极致用户体验的产品。\n\n- **SSH上线部署或部署静态资源**\n\n```bash\ncyb sftp\n```\n\n\u003e 快速部署上线代码，根据配置的SSH服务器信息，读取dist目录中的所有代码，通过SFTP快速发布代码到线上服务器或测试服务器，可以配置仅部署静态资源到CDN服务器。\n\n\u003ch2 align=\"center\"\u003e升级\u003c/h2\u003e\n\n- **使用npm升级**\n\n```bash\nnpm update -g cyb-cli\n```\n\n- **使用yarn升级**\n\n```bash\nyarn global upgrade cyb-cli\n```\n\n\u003ch2 align=\"center\"\u003e资源链接\u003c/h2\u003e\n\n使用文档：[https://jd-cyb.github.io/cyb-cli/docs/](https://jd-cyb.github.io/cyb-cli/docs/)\n\n官方网站：[https://jd-cyb.github.io/cyb-cli/](https://jd-cyb.github.io/cyb-cli/)\n\nCYBMOCK：[https://jd-cyb.github.io/cybmock/](https://jd-cyb.github.io/cybmock/)\n\n\u003ch2 align=\"center\"\u003eLicense\u003c/h2\u003e\n\n[MIT](http://opensource.org/licenses/MIT)\n\nCopyright (c) 2018, [塞伯坦前端架构组](https://github.com/jd-cyb)\n\n\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjd-cyb%2Fcyb-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjd-cyb%2Fcyb-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjd-cyb%2Fcyb-cli/lists"}