Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add contributing doc #57

Merged
merged 1 commit into from
Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Contributing

## Getting Started

### Some Ways to Contribute

* Report potential bugs.
* Suggest app enhancements.
* Increase our test coverage.
* Fix a [bug](https://github.com/cooklang/CookCLI/labels/bug).
* Implement a requested [enhancement](https://github.com/cooklang/CookCLI/labels/enhancement).
* Improve our documentation.
* Respond to questions about usage on the issue tracker or [Discord Server](https://discord.gg/fUVVvUzEEK).

### Reporting an Issue

> Note: Issues on GitHub for `CookCLI` are intended to be related to bugs or feature requests.
> Questions should be directed to [Discord Server](https://discord.gg/fUVVvUzEEK) or [Spec Discussions](https://github.com/cooklang/spec/discussions).

* Check existing issues (both open and closed) to make sure it has not been
reported previously.

* Provide a reproducible test case. If a contributor can't reproduce an issue,
then it dramatically lowers the chances it'll get fixed.

* Aim to respond promptly to any questions made by the `CookCLI` team on your
issue. Stale issues will be closed.

### Issue Lifecycle

1. The issue is reported.

2. The issue is verified and categorized by a `CookCLI` maintainer.
Categorization is done via tags. For example, bugs are tagged as "bug".

3. Unless it is critical, the issue is left for a period of time (sometimes many
weeks), giving outside contributors a chance to address the issue.

4. The issue is addressed in a pull request or commit. The issue will be
referenced in the commit message so that the code that fixes it is clearly
linked. Any change a `CookCLI` user might need to know about will include a
changelog entry in the PR.

5. The issue is closed.

## Making Changes to `CookCLI`

### Prerequisites

If you wish to work on `CookCLI` itself, you'll first need to:
- install [Swift](https://www.swift.org/download/#releases) for macOS, Linux. Windows isn't supported yet (https://github.com/cooklang/CookCLI/issues/56).
- (optional, only if you plan to change web-server) install [NodeJS](https://nodejs.org/en/download/package-manager/).
- [fork the `CookCLI` repo](../Docs/Forking.md)

### Building `CookCLI`

To build `CookCLI`, run `make dev` or `swift test`. In a few moments, you'll have a working `cook` executable in `.build/debug`.

>Note: `make dev` will build for your local machine's os/architecture.

#### Building server frontend

To apply changes in Single Page Application used in `cook server` run `make inject_frontend`. This will compile JavaScript code and inline it into Swift variables. After that compiled binary will have updated server code.

It's possible to start server in development mode without inlining it into binary with `make dev_server`.

### Testing

Examples (run from the repository root):
- `swift test` will run all tests (not many at the moment 😿).

All available options for skipping and filtering tests available via `swift test --help`.

When a pull request is opened CI will run all tests to verify the change.

### Submitting a Pull Request

Before writing any code, we recommend:
- Create a Github issue if none already exists for the code change you'd like to make.
- Write a comment on the Github issue indicating you're interested in contributing so
maintainers can provide their perspective if needed.

Keep your pull requests (PRs) small and open them early so you can get feedback on
approach from maintainers before investing your time in larger changes.

When you're ready to submit a pull request:
1. Include evidence that your changes work as intended (e.g., add/modify unit tests;
describe manual tests you ran, in what environment,
and the results including screenshots or terminal output).
2. Open the PR from your fork against base repository `cooklang/CookCLI` and branch `main`.
- [Link the PR to its associated issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue).
3. Include any specific questions that you have for the reviewer in the PR description
or as a PR comment in Github.
- If there's anything you find the need to explain or clarify in the PR, consider
whether that explanation should be added in the source code as comments.
- You can submit a [draft PR](https://github.blog/2019-02-14-introducing-draft-pull-requests/)
if your changes aren't finalized but would benefit from in-process feedback.
6. After you submit, the `CookCLI` maintainers team needs time to carefully review your
contribution and ensure it is production-ready, considering factors such as: correctness,
backwards-compatibility, potential regressions, etc.
7. After you address `CookCLI` maintainer feedback and the PR is approved, a `CookCLI` maintainer
will merge it. Your contribution will be available from the next minor release.
19 changes: 19 additions & 0 deletions Docs/Forking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Forking CookCLI

Community members wishing to contribute code to `CookCLI` must fork the `CookCLI` project
(`your-github-username/CookCLI`). Branches pushed to that fork can then be submitted
as pull requests to the upstream project (`cooklang/CookCLI`).

To locally clone the repo so that you can pull the latest from the upstream project
(`cooklang/CookCLI`) and push changes to your own fork (`your-github-username/CookCLI`):

1. [Create the forked repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo#forking-a-repository) (`your-github-username/CookCLI`)
2. Clone the `cooklang/CookCLI` repository and `cd` into the folder
3. Make `cooklang/CookCLI` the `upstream` remote rather than `origin`:
`git remote rename origin upstream`.
4. Add your fork as the `origin` remote. For example:
`git remote add origin https://github.com/myusername/CookCLI`
5. Checkout a feature branch: `git checkout -t -b new-feature`
6. [Make changes](../CONTRIBUTING.md#prerequisites).
7. Push changes to the fork when ready to [submit a PR](../CONTRIBUTING.md#submitting-a-pull-request):
`git push -u origin new-feature`
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ CURRENT_PATH=$(shell pwd)

all: release

dev: swift build

dev_server:
swift run cook server ./seed &
bash -c "trap 'pkill cook' EXIT; cd ./Sources/Server/Frontend && npm run dev"

test: swift test

release: prepare release_linux release_macos

prepare: update_version inject_seed inject_frontend
Expand Down
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"repositoryURL": "https://github.com/weichsel/ZIPFoundation.git",
"state": {
"branch": null,
"revision": "7254c74b49cec2cb81520523ba993c671f71b066",
"version": "0.9.14"
"revision": "cf10bbff6ac3b873e97b36b9784c79866a051a8e",
"version": "0.9.12"
}
}
]
Expand Down
Loading