命令行接口 (CLI)
🌐 Command Line Interface (CLI)
Page summary:
CLI 命令处理登录、项目部署、关联、列出和注销,无需远程存储库。
Strapi Cloud 配备了一个命令行接口(CLI),允许你登录和登出,并在不需要将本地项目托管在远程 git 仓库的情况下进行部署。CLI 支持 yarn 和 npm 两种包管理器。
🌐 Strapi Cloud comes with a Command Line Interface (CLI) which allows you to log in and out, and to deploy a local project without it having to be hosted on a remote git repository. The CLI works with both the yarn and npm package managers.
建议仅在本地安装 Strapi,这需要在所有以下 strapi 命令前加上用于项目设置的包管理器(例如 npm run strapi help 或 yarn strapi help)或专用的 node 包执行器(例如 npx strapi help)。
🌐 It is recommended to install Strapi locally only, which requires prefixing all of the following strapi commands with the package manager used for the project setup (e.g npm run strapi help or yarn strapi help) or a dedicated node package executor (e.g. npx strapi help).
Strapi 登录
🌐 strapi login
别名: strapi cloud:login
登录 Strapi 云。
🌐 Log in Strapi Cloud.
strapi login
此命令会自动打开一个浏览器窗口,首先要求你确认浏览器窗口和终端中显示的代码是否相同。然后,你将能够通过 Google、GitHub 或 GitLab 登录 Strapi Cloud。一旦浏览器窗口确认登录成功,就可以安全关闭。
🌐 This command automatically opens a browser window to first ask you to confirm that the codes displayed in both the browser window and the terminal are the same. Then you will be able to log into Strapi Cloud via Google, GitHub or GitLab. Once the browser window confirms successful login, it can be safely closed.
如果浏览器窗口没有自动打开,终端将显示一个可点击的链接以及可手动输入的代码。
🌐 If the browser window doesn't automatically open, the terminal will display a clickable link as well as the code to enter manually.
strapi 部署
🌐 strapi deploy
别名: strapi cloud:deploy
在 Strapi Cloud 中部署一个新的本地项目(< 100MB)。
🌐 Deploy a new local project (< 100MB) in Strapi Cloud.
strapi deploy
此命令必须在 login 命令之后使用。它可以将本地 Strapi 项目部署到 Strapi Cloud,而无需事先将其托管在远程 git 仓库中。终端将在项目成功部署到 Strapi Cloud 时通知你。
🌐 This command must be used after the login one. It deploys a local Strapi project on Strapi Cloud, without having to host it on a remote git repository beforehand. The terminal will inform you when the project is successfully deployed on Strapi Cloud.
通过 CLI 部署 Strapi 项目会在免费计划上创建一个项目。
🌐 Deploying a Strapi project through the CLI creates a project on the Free plan.
一旦项目首次通过 CLI 部署到 Strapi Cloud,deploy 命令可以被重复使用以触发同一项目的新部署。
🌐 Once the project is first deployed on Strapi Cloud with the CLI, the deploy command can be reused to trigger a new deployment of the same project.
一旦你部署了你的项目,如果你访问 Strapi Cloud 仪表板,你可能会看到 一些限制,以及由于创建了一个不在远程仓库中的 Strapi Cloud 项目并通过 CLI 部署而产生的影响。
🌐 Once you deployed your project, if you visit the Strapi Cloud dashboard, you may see some limitations as well as impacts due to creating a Strapi Cloud project that is not in a remote repository and which was deployed with the CLI.
- 仪表板中通常用于显示关于 Git 提供者信息的某些区域将会是空白的。
- 某些按钮,例如 触发部署 按钮,将会是灰色且无法点击,因为除非你已经将 Git 仓库连接到你的 Strapi 云项目。
strapi 链接 NewThis content is new.
🌐 strapi link NewThis content is new.
别名: strapi cloud:link
将当前文件夹中的项目链接到 Strapi Cloud 中的现有项目。
🌐 Links project in the current folder to an existing project in Strapi Cloud.
strapi link
此命令将你当前目录中的本地项目与你 Strapi Cloud 账户上的现有项目连接。系统将提示你从 Strapi Cloud 上托管的可用项目列表中选择你希望链接的项目。
🌐 This command connects your local project in the current directory with an existing project on your Strapi Cloud account. You will be prompted to select the project you wish to link from a list of available projects hosted on Strapi Cloud.
strapi 项目 NewThis content is new.
🌐 strapi projects NewThis content is new.
别名: strapi cloud:projects
列出与你的账户关联的所有 Strapi Cloud 项目。
🌐 Lists all Strapi Cloud projects associated with your account.
strapi projects
此命令检索并显示托管在你的 Strapi Cloud 账户上的所有项目的列表。
🌐 This command retrieves and displays a list of all projects hosted on your Strapi Cloud account.
strapi 登出
🌐 strapi logout
别名: strapi cloud:logout
退出 Strapi Cloud。
🌐 Log out of Strapi Cloud.
strapi logout
此命令会将你从 Strapi Cloud 登出。一旦运行 logout 命令,浏览器页面将会打开,终端将显示你已成功登出的确认信息。你将无法再使用 deploy 命令。
🌐 This command logs you out of Strapi Cloud. Once the logout command is run, a browser page will open and the terminal will display a confirmation message that you were successfully logged out. You will not be able to use the deploy command anymore.