diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..1c745f852d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,3 @@ +# Contributing to Lens + +See [Contributing to Lens](https://docs.k8slens.dev/latest/contributing/) documentation. diff --git a/Makefile b/Makefile index a1970bee5d..b37e05b708 100644 --- a/Makefile +++ b/Makefile @@ -99,6 +99,10 @@ publish-npm: build-npm npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" cd src/extensions/npm/extensions && npm publish --access=public +.PHONY: docs +docs: + yarn mkdocs-serve-local + .PHONY: clean-extensions clean-extensions: ifeq "$(DETECTED_OS)" "Windows" diff --git a/README.md b/README.md index 8d09dc4a3d..012ba90df6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Lens | The Kubernetes IDE [![Build Status](https://dev.azure.com/lensapp/lensapp/_apis/build/status/lensapp.lens?branchName=master)](https://dev.azure.com/lensapp/lensapp/_build/latest?definitionId=1&branchName=master) -[![Releases](https://img.shields.io/github/downloads/lensapp/lens/total.svg)](https://github.com/lensapp/lens/releases) +[![Releases](https://img.shields.io/github/downloads/lensapp/lens/total.svg)](https://github.com/lensapp/lens/releases?label=Downloads) [![Chat on Slack](https://img.shields.io/badge/chat-on%20slack-blue.svg?logo=slack&longCache=true&style=flat)](https://join.slack.com/t/k8slens/shared_invite/enQtOTc5NjAyNjYyOTk4LWU1NDQ0ZGFkOWJkNTRhYTc2YjVmZDdkM2FkNGM5MjhiYTRhMDU2NDQ1MzIyMDA4ZGZlNmExOTc0N2JmY2M3ZGI) World’s most popular Kubernetes IDE provides a simplified, consistent entry point for developers, testers, integrators, and DevOps, to ship code faster at scale. Lens is the only IDE you’ll ever need to take control of your Kubernetes clusters. It is a standalone application for MacOS, Windows and Linux operating systems. Lens is an open source project and free! @@ -25,49 +25,8 @@ World’s most popular Kubernetes IDE provides a simplified, consistent entry po ## Installation -Download a pre-built package from the [releases](https://github.com/lensapp/lens/releases) page. Lens can be also installed via [snapcraft](https://snapcraft.io/kontena-lens) (Linux only). - -Alternatively on Mac: -``` -brew cask install lens -``` - -## Development - -> Prerequisites: Nodejs v12, make, yarn - -* `make dev` - builds and starts the app -* `make test` - run tests - -## Development (advanced) - -Allows for faster separate re-runs of some of the more involved processes: - -1. `yarn dev:main` compiles electron's main process app part -1. `yarn dev:renderer` compiles electron's renderer app part -1. `yarn dev:extension-types` compile declaration types for `@k8slens/extensions` -1. `yarn dev-run` runs app in dev-mode and auto-restart when main process file has changed - -## Development (documentation) - -Run a local instance of `mkdocs serve` in a docker container for developing the Lens Documentation. - -> Prerequisites: docker, yarn - -* `yarn mkdocs-serve-local` - local build and serve of mkdocs with auto update enabled - -Go to [localhost:8000](http://127.0.0.1:8000) - -## Developer's ~~RTFM~~ recommended list: - -- [TypeScript](https://www.typescriptlang.org/docs/home.html) (front-end/back-end) -- [ReactJS](https://reactjs.org/docs/getting-started.html) (front-end, ui) -- [MobX](https://mobx.js.org/) (app-state-management, back-end/front-end) -- [ElectronJS](https://www.electronjs.org/docs) (chrome/node) -- [NodeJS](https://nodejs.org/dist/latest-v12.x/docs/api/) (api docs) - - +See [Getting Started](https://docs.k8slens.dev/latest/getting-started/) page. ## Contributing -Bug reports and pull requests are welcome on GitHub at https://github.com/lensapp/lens. \ No newline at end of file +See [Contributing](https://docs.k8slens.dev/latest/contributing/) page. diff --git a/docs/contributing/development.md b/docs/contributing/development.md index 8e5633cda9..b92edd319e 100644 --- a/docs/contributing/development.md +++ b/docs/contributing/development.md @@ -1,3 +1,40 @@ # Development -TBD +Thank you for taking the time to make a contribution to Lens. The following document is a set of guidelines and instructions for contributing to Lens. + +When contributing to this repository, please consider first discussing the change you wish to make by opening an issue. + +## Recommended Reading: + +- [TypeScript](https://www.typescriptlang.org/docs/home.html) (front-end/back-end) +- [ReactJS](https://reactjs.org/docs/getting-started.html) (front-end, ui) +- [MobX](https://mobx.js.org/) (app-state-management, back-end/front-end) +- [ElectronJS](https://www.electronjs.org/docs) (chrome/node) +- [NodeJS](https://nodejs.org/dist/latest-v12.x/docs/api/) (api docs) + +## Local Development Environment + +> Prerequisites: Nodejs v12, make, yarn + +* `make dev` - builds and starts the app +* `make clean` - cleanup local environment build artifacts + + +## Github Workflow + +We Use [Github Flow](https://guides.github.com/introduction/flow/index.html), so all code changes are tracked via Pull Requests. +A detailed guide on the recommended workflow can be found below: + +* [Github Workflow](./github_workflow.md) + +## Code Testing + +All submitted PRs go through a set of tests and reviews. You can run most of these tests *before* a PR is submitted. +In fact, we recommend it, because it will save on many possible review iterations and automated tests. +The testing guidelines can be found here: + +* [Contributor's Guide to Testing](./testing.md) + +## License + +By contributing, you agree that your contributions will be licensed as described in [LICENSE](https://github.com/lensapp/lens/blob/master/LICENSE). diff --git a/docs/contributing/documentation.md b/docs/contributing/documentation.md index 2157a1b1d4..501c57779f 100644 --- a/docs/contributing/documentation.md +++ b/docs/contributing/documentation.md @@ -20,3 +20,14 @@ When you create a new pull request, we expect some requirements to be met. * When updating documentation, add `Update Documentation:` before the title. E.g. `Update Documentation: Getting Started` * If your Pull Request closes an issue, you must write `Closes #ISSUE_NUMBER` where the ISSUE_NUMBER is the number in the end of the link url or the relevent issue. This will link your pull request to the issue, and when it is merged, the issue will close. * For each pull request made, we run tests to check if there are any broken links, the markdown formatting is valid, and the linter is passing. + + +## Testing Documentation Site Locally + +Run a local instance of `mkdocs` in a docker container for developing the Lens Documentation. + +> Prerequisites: docker, yarn + +* `make docs` - local build and serve of mkdocs with auto update enabled + +Go to [localhost:8000](http://127.0.0.1:8000). diff --git a/docs/contributing/github_workflow.md b/docs/contributing/github_workflow.md new file mode 100644 index 0000000000..5e75a65ad2 --- /dev/null +++ b/docs/contributing/github_workflow.md @@ -0,0 +1,148 @@ +# Github Workflow + + +- [Fork The Project](#fork-the-project) +- [Adding the Forked Remote](#adding-the-forked-remote) +- [Create & Rebase Your Feature Branch](#create--rebase-your-feature-branch) +- [Commit & Push](#commit--push) +- [Open a Pull Request](#open-a-pull-request) + - [Get a code review](#get-a-code-review) + - [Squash commits](#squash-commits) + - [Push Your Final Changes](#push-your-final-changes) + + +This guide assumes you have already cloned the upstream repo to your system via git clone. + +## Fork The Project + +1. Go to [http://github.com/lensapp/lens](http://github.com/lensapp/lens) +2. On the top, right-hand side, click on "fork" and select your username for the fork destination. + +## Adding the Forked Remote + +``` +export GITHUB_USER={ your github's username } + +cd $WORKDIR/lens +git remote add $GITHUB_USER git@github.com:${GITHUB_USER}/lens.git + +# Prevent push to Upstream +git remote set-url --push origin no_push + +# Set your fork remote as a default push target +git push --set-upstream $GITHUB_USER main +``` + +Your remotes should look something like this: + +``` +➜ git remote -v +origin https://github.com/lensapp/lens (fetch) +origin no_push (push) +my_fork git@github.com:{ github_username }/lens.git (fetch) +my_fork git@github.com:{ github_username }/lens.git (push) +``` + +## Create & Rebase Your Feature Branch + +Create a feature branch: + +``` +git branch -b my_feature_branch +``` + +Rebase your branch: + +``` +git fetch origin + +git rebase origin/main +Current branch my_feature_branch is up to date. +``` + +Please don't use `git pull` instead of the above `fetch / rebase`. `git pull` does a merge, which leaves merge commits. These make the commit history messy and violate the principle that commits ought to be individually understandable and useful. + +## Commit & Push + +Commit and sign your changes: + +``` +git commit -m "my commit title" --signoff +``` + +You can go back and edit/build/test some more, then `commit --amend` in a few cycles. + +When ready, push your changes to your fork's repository: + +``` +git push --set-upstream my_fork my_feature_branch +``` + +## Open a Pull Request + +See [Github Docs](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork). + +### Get a code review + +Once your pull request has been opened it will be assigned to one or more reviewers, and will go through a series of smoke tests. + +Commit changes made in response to review comments should be added to the same branch on your fork. + +Very small PRs are easy to review. Very large PRs are very difficult to review. + +### Squashing Commits +Commits on your branch should represent meaningful milestones or units of work. +Small commits that contain typo fixes, rebases, review feedbacks, etc should be squashed. + +To do that, it's best to perform an [interactive rebase](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History): + +#### Example +If you PR has 3 commits, count backwards from your last commit using `HEAD~3`: +``` +git rebase -i HEAD~3 +``` +Output would be similar to this: +``` +pick f7f3f6d Changed some code +pick 310154e fixed some typos +pick a5f4a0d made some review changes + +# Rebase 710f0f8..a5f4a0d onto 710f0f8 +# +# Commands: +# p, pick = use commit +# r, reword = use commit, but edit the commit message +# e, edit = use commit, but stop for amending +# s, squash = use commit, but meld into previous commit +# f, fixup = like "squash", but discard this commit's log message +# x, exec = run command (the rest of the line) using shell +# b, break = stop here (continue rebase later with 'git rebase --continue') +# d, drop = remove commit +# l, label