返回介绍

Distribution

发布于 2024-06-22 20:04:58 字数 3829 浏览 0 评论 0 收藏 0

You've written a great extension — and now you want the whole world to be able to use it. This document will take you through the process of distribution, from setting up a Git repository for your extension, to publishing it on Packagist.

Setting Up Git

The first thing you'll need to do is set up a version control system (VCS). The most popular VCS is Git. In this guide we'll be using Git, so make sure you have it installed before continuing. If you don't have much Git knowledge, you may want to check out these learning resources.

After you have installed Git, you'll need to initialize your repository. You can use git init on the command line if you're comfortable, or use a GUI tool like SourceTree or GitKraken.

Then, you'll need an account in a Git hosting server, the most popular being GitHub and GitLab. These will instruct you on how to hook up your local repository with the online "remote" repository.

Tagging a Release

As you are going to be publishing this extension, you'll want to make sure that the information is up to date. Take a minute to revisit composer.json and make sure package name, description, and Flarum extension information are all correct. It is recommended to have a README.md file in your repository to explain what the extension is, so create one if you haven't already.

When you're ready to release, commit your extension's files to the repo and tag your first version:

git tag v0.1.0
git push && git push --tags

Publishing on Packagist

Composer packages are published to a Composer repository, usually Packagist. You will need an account to proceed.

If this is the first release you are publishing of your extension, you will need to submit your package using its public repository URL. If your extension is located on GitHub, this URL will look something like https://github.com/AUTHOR/NAME.git.

Future Releases

You can set up Packagist to auto-update packages. Then for future releases, all you will need to do with Git is commit, tag, and push it to the remote server.

Promoting Your Extension

You will most likely want to create a discussion on the Flarum Community in the Extensions tag. Other people can install your extension using the following command:

composer require vendor/package

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文