mirror of
https://github.com/flutter/packages.git
synced 2025-06-20 22:52:50 +08:00
Improve CONTRIBUTING.md (#107)
- Added `flutter pub` tip. - Used more consise `-am` instead of `-a -m`. - Added language annotation to code fences. - Used standard formatting.
This commit is contained in:

committed by
GitHub

parent
c6d1ba276c
commit
239631142f
@ -1,48 +1,43 @@
|
|||||||
Contributing to Flutter
|
# Contributing to Flutter
|
||||||
=======================
|
|
||||||
|
|
||||||
[](https://cirrus-ci.com/github/flutter/packages)
|
[](https://cirrus-ci.com/github/flutter/packages)
|
||||||
|
|
||||||
_See also: [Flutter's code of conduct](https://flutter.io/design-principles/#code-of-conduct)_
|
_See also: [Flutter's code of conduct](https://flutter.io/design-principles/#code-of-conduct)_
|
||||||
|
|
||||||
Things you will need
|
## Things you will need
|
||||||
--------------------
|
|
||||||
|
|
||||||
* Linux, Mac OS X, or Windows.
|
- Linux, Mac OS X, or Windows.
|
||||||
* git (used for source version control).
|
- git (used for source version control).
|
||||||
* An ssh client (used to authenticate with GitHub).
|
- An ssh client (used to authenticate with GitHub).
|
||||||
|
|
||||||
Getting the code and configuring your environment
|
## Getting the code and configuring your environment
|
||||||
-------------------------------------------------
|
|
||||||
|
|
||||||
* Ensure all the dependencies described in the previous section are installed.
|
- Ensure all the dependencies described in the previous section are installed.
|
||||||
* Fork `https://github.com/flutter/packages` into your own GitHub account. If
|
- Fork `https://github.com/flutter/packages` into your own GitHub account. If
|
||||||
you already have a fork, and are now installing a development environment on
|
you already have a fork, and are now installing a development environment on
|
||||||
a new machine, make sure you've updated your fork so that you don't use stale
|
a new machine, make sure you've updated your fork so that you don't use stale
|
||||||
configuration options from long ago.
|
configuration options from long ago.
|
||||||
* If you haven't configured your machine with an SSH key that's known to github, then
|
- If you haven't configured your machine with an SSH key that's known to github, then
|
||||||
follow [GitHub's directions](https://help.github.com/articles/generating-ssh-keys/)
|
follow [GitHub's directions](https://help.github.com/articles/generating-ssh-keys/)
|
||||||
to generate an SSH key.
|
to generate an SSH key.
|
||||||
* `git clone git@github.com:<your_name_here>/packages.git`
|
- `git clone git@github.com:<your_name_here>/packages.git`
|
||||||
* `cd packages`
|
- `cd packages`
|
||||||
* `git remote add upstream git@github.com:flutter/packages.git` (So that you
|
- `git remote add upstream git@github.com:flutter/packages.git` (So that you
|
||||||
fetch from the master repository, not your clone, when running `git fetch`
|
fetch from the master repository, not your clone, when running `git fetch`
|
||||||
et al.)
|
et al.)
|
||||||
|
|
||||||
Running the examples
|
## Running the examples
|
||||||
--------------------
|
|
||||||
|
|
||||||
To run an example with a prebuilt binary from the cloud, switch to that
|
To run an example with a prebuilt binary from the cloud, switch to that
|
||||||
example's directory, run `flutter packages get` to make sure its dependencies have been
|
example's directory, run `flutter packages get` to make sure its dependencies have been
|
||||||
downloaded, and use `flutter run`. Make sure you have a device connected over
|
downloaded, and use `flutter run`. Make sure you have a device connected over
|
||||||
USB and debugging enabled on that device. For example:
|
USB and debugging enabled on that device. For example:
|
||||||
|
|
||||||
* `cd packages/palette_generator/example`
|
- `cd packages/palette_generator/example`
|
||||||
* `flutter packages get`
|
- `flutter packages get`
|
||||||
* `flutter run`
|
- `flutter run`
|
||||||
|
|
||||||
Contributing code
|
## Contributing code
|
||||||
-----------------
|
|
||||||
|
|
||||||
We gladly accept contributions via GitHub pull requests.
|
We gladly accept contributions via GitHub pull requests.
|
||||||
|
|
||||||
@ -54,28 +49,32 @@ keep the code consistent and avoid common pitfalls.
|
|||||||
|
|
||||||
To start working on a patch:
|
To start working on a patch:
|
||||||
|
|
||||||
* `git fetch upstream`
|
- `git fetch upstream`
|
||||||
* `git checkout upstream/master -b <name_of_your_branch>`
|
- `git checkout upstream/master -b <name_of_your_branch>`
|
||||||
* Hack away.
|
- Hack away.
|
||||||
* Verify changes with [flutter_plugin_tools](https://pub.dartlang.org/packages/flutter_plugin_tools)
|
- Verify changes with [flutter_plugin_tools](https://pub.dartlang.org/packages/flutter_plugin_tools)
|
||||||
```
|
|
||||||
|
```shell
|
||||||
pub global activate flutter_plugin_tools
|
pub global activate flutter_plugin_tools
|
||||||
pub global run flutter_plugin_tools format --plugins package_name
|
pub global run flutter_plugin_tools format --plugins package_name
|
||||||
pub global run flutter_plugin_tools analyze --plugins package_name
|
pub global run flutter_plugin_tools analyze --plugins package_name
|
||||||
pub global run flutter_plugin_tools test --plugins package_name
|
pub global run flutter_plugin_tools test --plugins package_name
|
||||||
```
|
```
|
||||||
* Check that the package can be published (but don't publish it until it has landed!):
|
|
||||||
|
|
||||||
```
|
_If `pub` is not available, use `flutter pub` instead._
|
||||||
|
|
||||||
|
- Check that the package can be published (but don't publish it until it has landed!):
|
||||||
|
|
||||||
|
```shell
|
||||||
cd packages/package_name; pub publish --dry-run
|
cd packages/package_name; pub publish --dry-run
|
||||||
```
|
```
|
||||||
|
|
||||||
* `git commit -a -m "<your informative commit message>"`
|
- `git commit -am "<your informative commit message>"`
|
||||||
* `git push origin <name_of_your_branch>`
|
- `git push origin <name_of_your_branch>`
|
||||||
|
|
||||||
To send us a pull request:
|
To send us a pull request:
|
||||||
|
|
||||||
* `git pull-request` (if you are using [Hub](http://github.com/github/hub/)) or
|
- `git pull-request` (if you are using [Hub](http://github.com/github/hub/)) or
|
||||||
go to `https://github.com/flutter/packages` and click the
|
go to `https://github.com/flutter/packages` and click the
|
||||||
"Compare & pull request" button
|
"Compare & pull request" button
|
||||||
|
|
||||||
@ -85,8 +84,8 @@ Once you've gotten an LGTM from a project maintainer and once your PR has receiv
|
|||||||
the green light from all our automated testing (Travis, AppVeyor, etc), submit your
|
the green light from all our automated testing (Travis, AppVeyor, etc), submit your
|
||||||
changes to the `master` branch using one of the following methods:
|
changes to the `master` branch using one of the following methods:
|
||||||
|
|
||||||
* Wait for one of the project maintainers to submit it for you.
|
- Wait for one of the project maintainers to submit it for you.
|
||||||
* Click the green "Merge pull request" button on the GitHub UI of your pull
|
- Click the green "Merge pull request" button on the GitHub UI of your pull
|
||||||
request (requires commit access).
|
request (requires commit access).
|
||||||
|
|
||||||
You must complete the [Contributor License Agreement](https://cla.developers.google.com/clas).
|
You must complete the [Contributor License Agreement](https://cla.developers.google.com/clas).
|
||||||
|
Reference in New Issue
Block a user