{"id":19606300,"url":"https://github.com/fujia-cli/stage","last_synced_at":"2025-04-05T06:02:13.288Z","repository":{"id":37858789,"uuid":"433816370","full_name":"fujia-cli/stage","owner":"fujia-cli","description":"An awesome CLI toolkits.","archived":false,"fork":false,"pushed_at":"2025-01-18T08:39:27.000Z","size":2283,"stargazers_count":86,"open_issues_count":0,"forks_count":13,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-29T05:01:43.309Z","etag":null,"topics":["cli","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/fujia-cli.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-01T12:23:50.000Z","updated_at":"2025-01-17T16:07:04.000Z","dependencies_parsed_at":"2025-02-05T04:42:51.064Z","dependency_job_id":null,"html_url":"https://github.com/fujia-cli/stage","commit_stats":{"total_commits":182,"total_committers":1,"mean_commits":182.0,"dds":0.0,"last_synced_commit":"f782ec519be000aad5b9b0a1bbddf8a161902eea"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fujia-cli%2Fstage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fujia-cli%2Fstage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fujia-cli%2Fstage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fujia-cli%2Fstage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fujia-cli","download_url":"https://codeload.github.com/fujia-cli/stage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294514,"owners_count":20915340,"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","typescript"],"created_at":"2024-11-11T10:04:35.368Z","updated_at":"2025-04-05T06:02:13.248Z","avatar_url":"https://github.com/fujia-cli.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/fujia-cli/stage\" target=\"_blank\"\u003e\n    \u003cimg alt=\"stage logo\" width=\"200\" src=\"https://images-1254102905.file.myqcloud.com/assets/stage.svg\"/\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003e@fujia/stage\u003c/h1\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\nA CLI tool makes application development simple and powerful.\n\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\nEnglish | [简体中文](./README.zh-CN.md)\n\n\u003c/div\u003e\n\n## Introduction\n\nstage are open source and aim at helping to develop, build and deploy various of applications quickly for individual developers or freelancer cli tools.\nIt built in many default templates which can resolve general requests and are improving and extending. what's more, it's supported by customized templates.\n\n## Getting started\n\n1. installation:\n\n```sh\nnpm install -g @fujia/cli-core\n```\n\n## Features\n\n- Initializing a project and launching it quickly by using a template, some common best practices are added in the template.\n- Abundant default templates and customizable support.\n- Initializing git repo automatically.\n- Releasing a npm package simply and correctly.\n- Efficiently build a docker image locally then push to container mirror repository and you own servers automatically.\n- Easily deploy or update an application(service) based on docker swarm or PM2.\n- Friendly to individual developers.\n\n## Usage\n\n\u003ca id=\"help\"\u003e🔗\u003c/a\u003e view all commands and options：\n\n```sh\n\nstage -h\n\n# Usage: stage \u003ccommand\u003e [options]\n#\n# Options:\n#   -v, --version                 Print the version number\n#   -d, --debug                   Enable debug model (default: false)\n#   -lp, --localPath \u003clocalPath\u003e  Specify the local debug file path (default: \"\")\n#   -h, --help                    Show command help\n#\n# Commands:\n#   init [options] [projectName]  Quickly initialize a universal project\n#   publish [options]             Publish a project\n#   release [options]             Release an npm package\n#   docker [options]              To build a docker image and update  the corresponding service\n#   service                       Deploy or update a service\n#   clean [cacheFileName]         Clean the caches\n#   help [command]                Show command help\n```\n\n### Environments Description\n\n1. The command of \"stage docker\" and \"stage service\" are dependent on docker environment, make sure the related commands are run correctly, you need to configure the docker in local host and the server. How to install docker? please consult: https://docs.docker.com/get-docker/.\n\n2. Running the command of \"stage service\", if you selected the PM2 to manage your services(applications), you have to configure node environment and install package of PM2 globally in the server. we recommend to manage node version by using NVM. How to install nvm? please consult: https://github.com/nvm-sh/nvm.\n\nInstal PM2 globally:\n\n```sh\n\nnpm install -g pm2\n\n```\n\nGo to the PM2 docs(https://pm2.keymetrics.io/docs/usage/quick-start/).\n\n3. Before running any commands, stage will check the user home directory of the local host. If it doesn't exist, it will throw exceptions and terminate the process.\n\n4. when some commands are executed, stage will create a directory which named \".stage-cli\" in the user's home directory.\n\n### Options\n\n#### -v,--version：view stage version\n\nType the following command：\n\n```sh\nstage -v\n# 1.3.6\n```\n\n#### -d, --debug：enable debug mode, by default：false\n\nYou can enable debug mode if you want to check the details of execution or development. When enabled, it will print the execution flows and key parameter information in the internal.\n\nTake the clean command as an example：\n\n```sh\nstage -d clean\n\n# [stage] verb [cli-exec]\n# [stage] verb [cli-exec]     localPath: undefined,\n# [stage] verb [cli-exec]     pkgName: @fujia/cli-clean,\n# [stage] verb [cli-exec]     cmdName: clean\n# [stage] verb [cli-exec]\n# [stage] verb localPath /Users/sunny/.stage-cli/caches\n# [stage] verb storeDir /Users/sunny/.stage-cli/caches/node_modules\n# [stage] verb [cli-package]\n# [stage] verb [cli-package]       localPath: /Users/sunny/.stage-cli/caches\n# [stage] verb [cli-package]       pkgName: @fujia/cli-clean\n# [stage] verb [cli-package]       pkgVersion: latest\n# [stage] verb [cli-package]       storeDir: /Users/sunny/.stage-cli/caches/node_modules\n# [stage] verb [cli-package]\n# [stage] verb [cli-package]\n# [stage] verb [cli-package] The version of the installing package is: 1.3.6\n# [stage] verb [cli-package] Starting install @fujia/cli-clean...\n# ...\n```\n\n#### -lp, --localPath \u003clocalPath\u003e：specify local path of the command when in development or debug mode\n\nIn development or debug mode, you can add the parameter: --localPath \u003clocalPath\u003e, then it will use local npm package to execute the corresponding command.\n\nfor example：\n\n```sh\nstage -d -lp [workDir]/stage/commands/cli-clean clean\n\n# [stage] verb [cli-exec]\n# [stage] verb [cli-exec]     localPath: undefined,\n# [stage] verb [cli-exec]     pkgName: @fujia/cli-clean,\n# [stage] verb [cli-exec]     cmdName: clean\n# ...\n\n```\n\n#### -h, --help：views help information\n\nseeing [above](#help).\n\n### Commands\n\nYou can initialize, deploy and update an application(service) by series of commands.\n\n#### init [options] [projectName]：to initialize a general project quickly\n\n1. view init command:\n\n```sh\nstage help init\n\n# Usage: stage init [options] [projectName]\n#\n# initializing an universal project quickly\n#\n# Options:\n#   -f, --force  force to init project\n#   -h, --help   display help for command\n```\n\n2. -f, --force, by default: false\n\nwhen you passed this parameter, it'll force to initialize a project even if the work directory is not empty.\n\nNote: this is a very **dangerous operation** of remove one folder. so \"stage\" will confirm again and check the removed folder name before remove.\n\n3. projectName\n\n- optional, if don't pass or invalid, you have to re-enter and \"stage\" will verify it. Note that the name follow the same rules as npm package name and strongly recommended don't use special characters.\n\n4. select a template type, support the following:\n\n- default: built in template, maintained by \"stage\" terms.\n- custom: use your own templates\n\n5. the available default templates, as follows:\n\n\u003e tips: most of templates are in the stage of development, we will improve them as soon as possible.\n\nweb:\n\n- vue: base on [vue.js](https://github.com/vuejs/vue)\n- vue-next: base on [vue-next](https://github.com/vuejs/vue-next)\n- nuxtjs: base on nuxt.js\n- vue-admin: base on [vue-element-admin](https://panjiachen.github.io/vue-element-admin-site/zh/guide/)\n- react: base on react.js\n\napp:\n\n- react-native: base on React Native\n- electron-rect: combine ui-puzzles@rect with Electron\n- electron-antd: combine Antd with Electron\n\nlibrary:\n\n- rollup: base on the Rollup\n- webpack: base on the webpack\n\nmini-program:\n\n- wechat：wechat's mini program\n- alipay：alipay's mini program\n\nIn the templates, we will add some common best practices, as: husky, Dockerfile and hot update of electron etc. of cause, you can remove them as your like. we hope that you can pay more attention to the business and ideas, producing the product of MVP1.0 quickly.\n\n6. **we also provide a way to initial project which more simple, as follows:**\n\n```sh\nnpm init stage@latest demos\n```\n\nThat all, enjoy your works.\n\n#### publish [options]：push your project to the github or gitee\n\n\u003e this functionality is not perfect and we are planing to refactor it.\n\n1. views the command：\n\n```sh\n\nstage help publish\n\n# Usage: stage publish [options]\n#\n# publish a project\n#\n# Options:\n#   --refreshRepo   force to update the remote Git repository\n#   --refreshToken  force to update the token of remote repository\n#   --refreshOwner  force to update the type of remote repository\n#   -h, --help      display help for command\n\n```\n\n2. options: --refreshRepo、--refreshToken、--refreshOwner\n\n- --refreshRepo：force to update remote git repo\n- --refreshToken：force to refresh remote git token\n- --refreshOwner：force to update remote repository type(individual or organization)\n\n3. input git repo token\n\nrunning the command first, you need to enter Git token, and stage will store the token in .stage-cli folder.\n\nHow to set token?\n\n- Github - seeing：https://github.com/settings/tokens\n- Gitee - seeing：https://gitee.com/profile/personal_access_tokens\n\n4. if the token is right, stage will finish the following operations automatically:\n\n- initialize git and add default .gitignore file(Note: this .gitignore file only adjust to npm projects)\n- add remote git url and create a main branch\n- commit the initial template code to main branch, then check out the feature/0.1.0 branch\n\nNote: stage will make some checks before running the command, as: check if the project is a valid npm project.\n\n#### release [options]：publish a npm package easily\n\nYou only need to select a sematic version and publish it to npm registry quickly.\n\n1. view the command:\n\n```sh\n\nstage help release\n\n# Usage: stage release [options]\n#\n# release a npm package\n#\n# Options:\n#   -a, --access \u003cpublishAccess\u003e  set publish access is true (default: \"public\")\n#   -h, --help                    display help for command\n\n```\n\n2. to ensure that the project is completely and correctly published to the npm, the following checks are done before publishing:\n\n- check if is a npm project\n- check for the existence of a files field in package.json or a .gitignore file in the project root, if they are not exist, stage will throw exceptions then end the process\n- check the npm registry, if you have used the other registry mirror as: taobao, stage will force to switch to official registry by executing \"npx nrm use npm\"\n- check if you are logged in to npm, if not, you'll be prompted to do so\n\n3. at last, select a sematic version and start publishing.\n\nthat all, we published a npm package simply and correctly.\n\n#### docker [options]：to build a docker image locally and push to container mirror repository\n\n1. view the command:\n\n```sh\n\nstage help docker\n\n\n# Usage: stage docker [options]\n#\n# to build a docker image and update corresponding service\n#\n# Options:\n#   -b, --build                        build a docker image (default: false)\n#   -u, --updateService [serviceName]  update a service\n#   -h, --help                         display help for command\n\n```\n\n2. the options: -b, --build and -u, --updateService [serviceName]\n\n- -b,--build：build a docker image locally and push to the container mirror repository if build successful, then stage will log in to the server by ssh and pull the latest built image\n- -u, --updateService [serviceName]：it's optional, but if you set the parameter, stage will update the corresponding service when the remote server pull the latest image.\n\n3. stage will check the following items before build:\n\n- check docker environment. **Note: stage don't install the docker automatically and only prompt that**\n  - check if exist Dockerfile file in the project root\n  - check if exist .dockerignore file in the project root\n- check the current branch name is \"main\" or \"master\", **Note: stage only you build a docker image in main or master branch**\n- check the git stash of current project is empty\n\n4. enter the server information, includes: username, port, ip.\n\nthe server information will store to the server-info.json file in the .stage-cli folder. the purpose of this is to void entering the same things repetitively. **Note: this information is sensitive, please keep it safe!**\n\n5. enter the container mirror repo information, the details includes:\n\n- owner: username\n- userPwd: password\n- repoZone: repo zone\n- repoNamespace: namespace\n- mirrorName: mirror name(repo name)\n- mirrorVersion?: mirror version\n\nwe recommend to use the free container mirror service provide by aliyun or tencent.\n\n#### service：deploy or update a service(application)\n\n1. view the command:\n\n```sh\n\nstage help service\n\n# Usage: stage service [options] [command]\n#\n# deploy or update a service\n#\n# Options:\n#   -h, --help                    display help for command\n#\n# Commands:\n#   deploy [stackName] [workDir]  deploy a service via docker image or PM2\n#   update [serviceName]          update a service via docker image\n#   help [command]                display help for command\n\n```\n\n2. deploy a service via docker swarm\n\n\u003e stage assumes you have configured docker swarm in the server. seeing here: https://docs.docker.com/engine/swarm/stack-deploy/.\n\nuse the following command:\n\n```sh\n\ndocker service deploy stack-name\n\n```\n\n3. deploy or manage a service via PM2\n\n\u003e stage assumes you have installed the PM2 globally, seeing here: https://pm2.keymetrics.io/docs/usage/quick-start/.\n\n```sh\n\ndocker service deploy\n\n```\n\n#### clean [cacheFileName]：clean up caches\n\nYou can clean up the cached npm packages manually.\n\n1. view the command:\n\n```sh\n\nstage help clean\n\n# Usage: stage clean [options] [cacheFileName]\n#\n# clean caches\n#\n# Options:\n#   -h, --help  display help for command\n\n```\n\n2. examples:\n\n```sh\n\nstage clean\n\n\n# ✔ Installed 1 packages\n# ✔ Linked 34 latest versions\n# ✔ Run 0 scripts\n# ✔ All packages installed (34 packages installed from npm registry, used 5s(network 5s), speed 299.45KB/# s, json 34(1.57MB), tarball 0B)\n# [stage] info starting to clean cached directories: /Users/sunny/.stage-cli/caches, /Users/sunny/.# stage-cli/templates\n# [stage] info process exited!\n\n```\n\n#### help [command]：view the usage of one command.\n\n## Examples\n\nwe have provided a complete example to demonstrate how to create a web application so that you can quickly understand the entire process. [go to](./examples/README.md).\n\n## Questions\n\nstage is available now, but still under rapid development, so there are many problems, please believe that we will actively work on them!\n\n### Testing\n\nunit tests, to ensure the high availability, stability and maintainability of the application, we must ensure sufficient unit testing.\n\n## Plans\n\n### Template Ecological Construction\n\n1. to refine the default templates.\n\n2. to determine the development direction of custom templates.\n\n### More useful features\n\n1. support chinese.\n\n2. commands plugged in, which is the focus of the next big release.\n\n3. cloud build.\n\n### Combining the power of third-party developers\n\nthis is the focus and direction of the future development of the stage.\n\n## Supporting Stage\n\nif the project is helpful to you, please click a star on [github](https://github.com/fujia-cli/stage), thanks so much.\n\n## References\n\n1. Gitee OpenAPI - https://gitee.com/api/v5/swagger#/getV5ReposOwnerRepoStargazers?ex=no.\n\n2. docker docs - https://docs.docker.com/get-docker/.\n\n3. nvm - https://github.com/nvm-sh/nvm.\n\n4. pm2 - https://pm2.keymetrics.io/docs/usage/quick-start/.\n\n5. vue-element-admin - (https://panjiachen.github.io/vue-element-admin-site/zh/guide/).\n\n6. Container mirror service of aliyun(ACR) - https://help.aliyun.com/document_detail/257112.html\n\n7. Container mirror service of tencent - https://cloud.tencent.com/document/product/1141.\n\n8. node.js - https://nodejs.org/en/docs/.\n\n9. npm docs - https://docs.npmjs.com/.\n\n10. imooc-cli - https://github.com/imooc-lego/imooc-cli.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffujia-cli%2Fstage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffujia-cli%2Fstage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffujia-cli%2Fstage/lists"}