{"id":16347021,"url":"https://github.com/ospoon/zg-cli-template","last_synced_at":"2025-10-10T13:08:55.090Z","repository":{"id":57405771,"uuid":"315685490","full_name":"OSpoon/zg-cli-template","owner":"OSpoon","description":"前端脚手架搭建","archived":false,"fork":false,"pushed_at":"2020-11-25T08:26:32.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T09:45:54.877Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/OSpoon.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}},"created_at":"2020-11-24T16:10:58.000Z","updated_at":"2020-12-09T05:57:54.000Z","dependencies_parsed_at":"2022-09-11T23:51:25.818Z","dependency_job_id":null,"html_url":"https://github.com/OSpoon/zg-cli-template","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/OSpoon%2Fzg-cli-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSpoon%2Fzg-cli-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSpoon%2Fzg-cli-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSpoon%2Fzg-cli-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OSpoon","download_url":"https://codeload.github.com/OSpoon/zg-cli-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239565664,"owners_count":19660158,"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-11T00:39:14.030Z","updated_at":"2025-10-10T13:08:50.067Z","avatar_url":"https://github.com/OSpoon.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### 前端脚手架搭建\n\n\u003e 1. 本项目为演示项目: 通过拉取 Github 上配置好的模板项目,快速启动新项目开发,使得项目开发规范统一。\n\u003e 2. 后续会补充常用的一些操作函数等。\n\n#### 初始化目录\n\n`npm init -y`\n\n#### 安装依赖\n\n`npm i commander download-git-repo ora figlet clear chalk update-notifier inquirer compressing -s`\n\n#### 初始化目录\n\n1. bin\n   - zg-cli.js 配置操作命令\n2. lib\n   - init.js 初始化项目命令对应的处理过程\n   - init-process.js 初始化项目流程函数封装\n   - utils.js 通用工具函数\n\n#### 配置 package.json\n\n1. bin 配置\n2. downloadRepoConfig: 模板路径配置\n\n```json\n{\n  \"bin\": {\n    \"zg-cli\": \"./bin/zg-cli.js\"\n  },\n  \"downloadRepoConfig\": {\n    \"url\": \"github:OSpoon/vue-cli-vant-starter\"\n  }\n}\n```\n\n#### 脚手架发布\n\n\u003e 提前注册[npmjs](https://www.npmjs.com/)`账号 执行命令`bash publish.sh`\n\n```sh\n#!/usr/bin/env bash\nnpm config get registry # 检查仓库镜像库\nnpm config set registry=http://registry.npmjs.org\necho '请进行登录相关操作：'\nnpm login # 登陆\necho \"-------publishing-------\"\nnpm publish # 发布\nnpm config set registry=https://registry.npm.taobao.org # 设置为淘宝镜像\necho \"发布完成\"\nexit\n```\n\n#### 将 npm 模块链接到对应的运行项目中去\n\n`npm link` or 反注册 `npm unlink`\n\n#### 删除的情况\n\n`ls C:\\Users\\DELL\\AppData\\Roaming\\npm\\`\n`rm C:\\Users\\DELL\\AppData\\Roaming\\npm\\zg`\n\n#### 功能\n\n1. 拉取模板: `zg init`\n2. 压缩文件: `zg zip`\n3. 生成二维码: `zg qrcode`\n\n#### 常用依赖整理\n\n1. 复制文件: [ncp](https://www.npmjs.com/package/ncp)\n2. fs 扩展: [fs-extra](https://www.npmjs.com/package/fs-extra)\n3. 文件压缩: [compressing](https://www.npmjs.com/package/compressing)\n4. 执行 Shell[shelljs](https://www.npmjs.com/package/shelljs)\n5. Promise library [bluebird](https://www.npmjs.com/package/bluebird)\n6. 命令交互 [inquirer](https://www.npmjs.com/package/inquirer)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fospoon%2Fzg-cli-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fospoon%2Fzg-cli-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fospoon%2Fzg-cli-template/lists"}