Skip to content

Commit eb03fda

Browse files
authored
docs(*): update Desktop onboarding documentation
1 parent f3fb958 commit eb03fda

File tree

2 files changed

+108
-60
lines changed

2 files changed

+108
-60
lines changed

DEVELOPER.md

+107-59
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,44 @@
11
# Developing Qri
22

3-
* [Development Setup](#setup)
4-
* [Coding Rules](#rules)
5-
* [Commit Message Guidelines](#commits)
6-
* [Writing Documentation](#documentation)
7-
* [Running Storybook](#storybook)
3+
- [Development Setup](#setup)
4+
- [Coding Rules](#rules)
5+
- [Commit Message Guidelines](#commits)
6+
- [Connecting to the Qri backend](#backend)
7+
- [Running Storybook](#storybook)
8+
- [Advanced: Managing Different Qri Repos](#repo)
89

9-
## <a name="setup"></a> Development Setup
10+
## <a name="setup"></a> Development Setup
1011

1112
This document describes how to set up your development environment to build and test Qri, and
1213
explains the basic mechanics of using `git` and `yarn`.
1314

1415
### Installing Dependencies
1516

16-
Before you can build Qri, you must install and configure the following dependencies on your
17+
Before you can build Qri Desktop, you must install and configure the following dependencies on your
1718
machine:
1819

19-
* [Git](http://git-scm.com/): The [Github Guide to
20+
- [Git](http://git-scm.com/): The [Github Guide to
2021
Installing Git][git-setup] is a good source of information.
2122

22-
* [Node.js v8.6.X (LTS)](http://nodejs.org):
23-
* If you don't have node installed, we recommend using [homebrew][homebrew] to manage your package of node.
23+
- [Node.js v12.9.X (LTS)](http://nodejs.org):
2424

25-
```shell
26-
# Install Homebrew by running this script and following the prompts (pulled straight from the homebrew homepage)
27-
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
25+
- If you don't have node installed, we recommend using [homebrew][homebrew] to manage your package of node.
2826

29-
# install node
30-
brew install node
31-
```
27+
```shell
28+
# Install Homebrew by running this script and following the prompts (pulled straight from the homebrew homepage)
29+
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
3230

33-
* [Yarn](https://yarnpkg.com): We use Yarn to install our dependencies
31+
# install node
32+
brew install node
33+
```
34+
35+
- [Yarn](https://yarnpkg.com): We use Yarn to install our dependencies
3436
(rather than using npm). See the detailed [installation instructions][yarn-install].
3537

38+
- [Qri backend](#backend): The core functionality for working with Qri.
39+
40+
- [temp_registry_server](https://github.com/qri-io/temp_registry_server): This is a package we developed for use in Desktop end-to-end (e2e) testing. For more info about running the tests, see the project [README](https://github.com/qri-io/desktop/blob/master/README.md)
41+
3642
### Forking Qri on Github
3743

3844
To contribute code to Qri, you must have a GitHub account so you can push code to your own
@@ -42,7 +48,6 @@ First, [create a Github account](https://github.com/signup/free).
4248
Afterwards, go ahead and
4349
[fork the Qri desktop repository](https://github.com/qri-io/desktop/fork) ([Learn more about forking](http://help.github.com/forking)).
4450

45-
4651
### Building Qri
4752

4853
To build Qri, you clone the source code repository and use Yarn to run the electron app:
@@ -78,36 +83,38 @@ The `yarn dev` command will launch a development version of the Qri electron app
7883
To get access to Chrome Developer Tools, use the keyboard shortcut Command-Shift-C.
7984

8085
## Release process:
86+
8187
This will only work if you are internal to Qri and have the correct keys
8288

83-
1) change the frontend and backend version numbers in:
84-
`/package.json`
85-
`/app/package.json`
86-
`version.js`
87-
2) run `make update-changelog` to update the changelog
88-
3) write release notes
89-
4) build the correct version of the qri backend binary
90-
5) ensure it is executable (chmod +x qri)
91-
6) move the executable binary to the `/backend` directory
92-
7) run `yarn dist`
93-
8) ensure the Qri Desktop app running correctly and has all the correct version numbers
94-
9) submit a pr, once approved merge
95-
10) run `yarn dist --publish always` to create a release
96-
11) Because notarizing the mac.zip file is broken in electron-builder right now (as per https://snippets.cacher.io/snippet/354a3eb7b0dcbe711383 & https://github.com/electron-userland/electron-builder/issues/4299):
97-
- compress the app file that exists in `/release/mac`
98-
- rename it to match the current mac.zip file in the `/release` directory
99-
- replace the old zip file with the new one
100-
- run `./node_modules/app-builder-bin/mac/app-builder blockmap -i release/FILENAME.zip -o release/throwaway.zip`
101-
- app-builder is modifying the contents of the zip, which is messing up the notarization. The -o flag indicates an output file that app-builder can futz with without ruining the integrity of the original app
102-
- take the updated file into from size, sha512 and blockMapSize
103-
- update the `/release/latest-mac.yml` with that info
104-
- replace `FILENAME.zip` to the release page
89+
1. change the frontend and backend version numbers in:
90+
`/package.json`
91+
`/app/package.json`
92+
`version.js`
93+
2. run `make update-changelog` to update the changelog
94+
3. write release notes
95+
4. build the correct version of the qri backend binary
96+
5. ensure it is executable (chmod +x qri)
97+
6. move the executable binary to the `/backend` directory
98+
7. run `yarn dist`
99+
8. ensure the Qri Desktop app running correctly and has all the correct version numbers
100+
9. submit a pr, once approved merge
101+
10. run `yarn dist --publish always` to create a release
102+
11. Because notarizing the mac.zip file is broken in electron-builder right now (as per https://snippets.cacher.io/snippet/354a3eb7b0dcbe711383 & https://github.com/electron-userland/electron-builder/issues/4299):
103+
104+
- compress the app file that exists in `/release/mac`
105+
- rename it to match the current mac.zip file in the `/release` directory
106+
- replace the old zip file with the new one
107+
- run `./node_modules/app-builder-bin/mac/app-builder blockmap -i release/FILENAME.zip -o release/throwaway.zip`
108+
- app-builder is modifying the contents of the zip, which is messing up the notarization. The -o flag indicates an output file that app-builder can futz with without ruining the integrity of the original app
109+
- take the updated file into from size, sha512 and blockMapSize
110+
- update the `/release/latest-mac.yml` with that info
111+
- replace `FILENAME.zip` to the release page
105112

106113
## <a name="rules"></a> Coding Rules
107114

108115
To ensure consistency throughout the source code, keep these rules in mind as you are working:
109116

110-
* We use [eslint](style) coding style, please use standard to lint any changes before committing:
117+
- We use [eslint](style) coding style, please use standard to lint any changes before committing:
111118

112119
```shell
113120
# Use eslint to lint files
@@ -118,12 +125,13 @@ The output will point you to which files/lines need to be changed in order to me
118125

119126
## <a name="commits"></a> Git Commit Guidelines
120127

121-
We have very precise rules over how our git commit messages can be formatted. This leads to **more
122-
readable messages** that are easy to follow when looking through the **project history**. But also,
128+
We have very precise rules over how our git commit messages can be formatted. This leads to **more
129+
readable messages** that are easy to follow when looking through the **project history**. But also,
123130
we use the git commit messages to **generate the Qri change log**.
124131

125132
### Commit Message Format
126-
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
133+
134+
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
127135
format that includes a **type**, a **scope** and a **subject**:
128136

129137
```
@@ -140,43 +148,49 @@ Any line of the commit message cannot be longer 100 characters! This allows the
140148
to read on GitHub as well as in various git tools.
141149

142150
### Revert
143-
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header
151+
152+
If the commit reverts a previous commit, it should begin with `revert:`, followed by the header
144153
of the reverted commit.
145154
In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit
146155
being reverted.
147156
A commit with this format is automatically created by the [`git revert`][git-revert] command.
148157

149158
### Type
159+
150160
Must be one of the following:
151161

152-
* **feat**: A new feature
153-
* **fix**: A bug fix
154-
* **docs**: Documentation only changes
155-
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing
162+
- **feat**: A new feature
163+
- **fix**: A bug fix
164+
- **docs**: Documentation only changes
165+
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing
156166
semi-colons, etc)
157-
* **refactor**: A code change that neither fixes a bug nor adds a feature
158-
* **perf**: A code change that improves performance
159-
* **test**: Adding missing or correcting existing tests
160-
* **chore**: Changes to the build process or auxiliary tools and libraries such as documentation
167+
- **refactor**: A code change that neither fixes a bug nor adds a feature
168+
- **perf**: A code change that improves performance
169+
- **test**: Adding missing or correcting existing tests
170+
- **chore**: Changes to the build process or auxiliary tools and libraries such as documentation
161171
generation
162172

163173
### Scope
174+
164175
The scope could be anything specifying place of the commit change. For example **NEED TO MAKE DECISION ABOUT THIS** , etc...
165176

166177
You can use `*` when the change affects more than a single scope.
167178

168179
### Subject
180+
169181
The subject contains succinct description of the change:
170182

171-
* use the imperative, present tense: "change" not "changed" nor "changes"
172-
* don't capitalize first letter
173-
* no dot (.) at the end
183+
- use the imperative, present tense: "change" not "changed" nor "changes"
184+
- don't capitalize first letter
185+
- no dot (.) at the end
174186

175187
### Body
188+
176189
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
177190
The body should include the motivation for the change and contrast this with previous behavior.
178191

179192
### Footer
193+
180194
The footer should contain any information about **Breaking Changes** and is also the place to
181195
[reference GitHub issues that this commit closes][closing-issues].
182196

@@ -185,19 +199,30 @@ The rest of the commit message is then used for this.
185199

186200
A detailed explanation can be found in this [document][commit-message-format].
187201

188-
189202
[closing-issues]: https://help.github.com/articles/closing-issues-via-commit-messages/
190203
[commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
191204
[git-revert]: https://git-scm.com/docs/git-revert
192205
[git-setup]: https://help.github.com/articles/set-up-git
193206
[github]: https://github.com/qri-io/desktop
194207
[style]: https://eslint.org/
208+
[homebrew]: https://brew.sh/
195209
[yarn-install]: https://yarnpkg.com/en/docs/install
196210

197-
198211
###### This documentation has been adapted from the [Data Together](https://github.com/datatogether/datatogether), [Hyper](https://github.com/zeit/hyper), and [AngularJS](https://github.com/angular/angularJS) documentation.
199212

200-
## <a name="setup"></a>Running Storybook
213+
## <a name="backend"></a>Connecting to the Qri backend
214+
215+
This Qri Desktop application is a Graphical User Interface (GUI) client of our [Qri backend](https://github.com/qri-io/qri). The backend provides an API that this Desktop app utilizes to give our users all the great features Qri has to offer like creating datasets, viewing dataset commit history and pushing datasets to [Qri cloud](https://qri.cloud/)!
216+
217+
As such, developing on this Qri Desktop project relies on a connection to the Qri backend. To install the Qri backend on your machine, follow the instructions of your choice [here](https://qri.io/docs/reference/installing-qri-cli) and ensure that wherever the qri binary was installed has been [added to your PATH](https://qri.io/docs/reference/installing-qri-cli#configuring-your-path). This will allow you to type `qri` command line commands (e.g. `qri connect`) at your terminal.
218+
219+
When this Qri Desktop app is running, it will look for the Qri backend in a few places in this order:
220+
221+
1. Is there a qri node already running on your machine? This would happen if you've run `qri connect` in a different terminal window. If so, Qri Desktop will use this existing node.
222+
2. Is there a qri binary already installed on your PATH? If yes, use that binary to spin up a qri node.
223+
3. Is there qri binary internal to this Desktop app (at `/desktop/backend/qri`)? If so, use that. This Desktop app comes packaged with qri binary when a user [downloads](https://qri.io/download) the app and will look here as a last resort. For most Desktop users this is the only version of the Qri backend they may have. If you as a developer have forked this project and not downloaded the app, you will not have this internal binary and need to download it separately.
224+
225+
## <a name="storybook"></a>Running Storybook
201226

202227
When developing new components for Qri Desktop, our team first builds them in [Storybook](https://storybook.js.org/docs/basics/introduction/). Storybook is a tool which allows us to build and showcase components in an isolated environment from our app.
203228

@@ -208,5 +233,28 @@ When rendering Storybook stories which rely on fetched information from our [`qr
208233
1. Set 'http://localhost:6006' as an entry under `allowedorigins` in the `config.yaml` file of your local qri repo. (Note: your local qri repo is _not_ a refence to [`qri` backend](https://github.com/qri-io/qri) code. It is rather where your qri configuration, peer information, datasets, and other metadata are stored at your `QRI_PATH`.) You can make this change by either using the `qri` command line and running `qri config set` or by directly editing the `config.yaml` located at your `QRI_PATH`.
209234
2. Ensure the `qri` backend is running to receive your request by running `qri connect` in your terminal.
210235

236+
## <a name="repo"></a>Advanced: Managing Different Qri Repos
237+
238+
_Note_: the knowledge and management of different local qri repos is not necessary for developing on Qri Desktop. It is useful however for testing and development purposes to have one or more repos outside of your default qri repo; you can play around with these and delete them easily if something breaks without worrying about the consequences. It is also useful to have a test repo set up when developing on a version of the [Qri backend](https://github.com/qri-io/qri) that requires a migration and would otherwise alter the configuration of your default qri repo.
239+
240+
### What is a qri repo?
241+
242+
A qri repo is a storage location where Qri stores its local information (e.g. configuration, peer information, IPFS data, Logbooks, etc). This term is not to be confused with the location of the [Qri backend](https://github.com/qri-io/qri) source code that you may have downloaded on your machine.
243+
244+
A qri repo is configured for a Qri user when they [set up a qri instance](https://qri.io/docs/getting-started/qri-cli-quickstart#setup-your-qri-instance). This can happen in one of two ways:
245+
1. When a CLI user runs `qri setup` at the command line after having [installed](https://qri.io/docs/reference/installing-qri-cli#installing-the-qri-binary) the qri binary
246+
2. When a user opens the Desktop app for the first time
247+
248+
Qri uses your os home directory (`~/.qri` on macOS and Linux, or `HOME\.qri` on Windows) to store your qri repo unless you override the default by setting the `QRI_PATH` env var.
249+
250+
### How do I create another qri repo?
211251

252+
Let's imagine that we're working on a Desktop feature which relies on a dev version of the Qri backend that requires a migration. Instead of migrating our current default qri repo, we want to make a test one for this purpose. We need to build the Qri backend binary of the dev version and point to a new qri repo that we create.
212253

254+
1. **Build the binary**: clone the version of the Qri backend that you'd like locally to a destination of your choice (e.g. `~/qri-dev`). Then `cd` into the `qri` directory and build this from source by running `go build`. Running `go build` creates a version of qri binary in the same directory in which you ran the command, meaning this binary will be separate from the default one on your PATH and will only be referenced when you directly call it. We just need to make sure we make this binary executable before running it. Do this by running `chmod +x qri` and then you'll be able run it (`./qri`).
255+
2. **Set QRI_PATH**: set the `QRI_PATH` env var to a location you create (e.g. `export QRI_PATH=~/qri-dev/test-repo/qri`).
256+
3. **Set up new Qri instance**: now that `QRI_PATH` is pointed to your new location, `cd` into the folder where your local `qri` binary resides (`~/qri-dev/qri` in our example) and use your new local `qri` executable to set up a new qri instance (`./qri setup`). Note: if you were just creating a new qri instance without using a different version of the Qri backend, you could simply run `qri setup` using the default qri binary on your PATH.
257+
4. **Spin up a new Qri node**: run `./qri connect` in your terminal to spin up a qri node using this new Qri backend.
258+
5. **Start up the Desktop app**: start up Desktop in a different terminal window (`yarn dev`).
259+
260+
To switch back to the default qri backend, kill the currently running node (`killall -v qri`). To switch back to the default qri repo, delete `QRI_PATH` (`unset QRI_PATH`). It's recommended that you use the default qri backend when interacting with your default qri repo.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Run normally (no developer features):
7676

7777
Run end to end tests:
7878

79-
- `go get temp_registry_server`
79+
- You'll need our `temp_registry_server` package to run e2e tests. You can either use the `go get` command (`go get github.com/qri-io/temp_registry_server`) or you can build it yourself by cloning the `temp_registry_server` [repo](https://github.com/qri-io/temp_registry_server), `cd` into the repo at the command line, running `go install` which will compile the binary for you (and likely put it in `~/go/bin`) and then [add that directory to your PATH](https://qri.io/docs/reference/installing-qri-cli#configuring-your-path). You'll know this was successful if you run the `which temp_registry_server` command and see the path to the binary.
8080
- For macOS users run with `yarn test-e2e` which will also trigger a build, or run `yarn test-e2e-no-build` if you already have a build to test against
8181
- For Windows users run `yarn test-win-e2e` or `yarn test-win-e2e-no-build`
8282

0 commit comments

Comments
 (0)