2019-08-28 19:00:04 +03:00
|
|
|
## Introduction
|
|
|
|
|
2019-08-28 19:10:50 +03:00
|
|
|
Thanks for your interest in contributing to the Urbit interface. This section
|
2019-08-28 19:00:04 +03:00
|
|
|
specifically focuses on Landscape development. Landscape lets you integrate your
|
|
|
|
ship with front-end web applications accessed through the browser. It has a core
|
|
|
|
set of applications that accept contributions.
|
|
|
|
|
|
|
|
Related to Landscape is [Gall][gall], the Arvo vane that controls userspace
|
|
|
|
applications. Landscape applications will usually make good use of Gall, but
|
|
|
|
it's not strictly required if a Landscape application is not interacting with
|
|
|
|
ships directly.
|
|
|
|
|
2020-09-29 04:58:17 +03:00
|
|
|
## Starting the dev environment
|
2019-08-28 19:00:04 +03:00
|
|
|
|
2020-09-29 04:58:17 +03:00
|
|
|
From this directory, go to the config folder and copy `urbitrc-sample` to
|
|
|
|
`urbitrc`.
|
|
|
|
|
|
|
|
You should see the following:
|
2020-07-16 18:40:35 +03:00
|
|
|
|
|
|
|
```
|
|
|
|
module.exports = {
|
|
|
|
URBIT_PIERS: [
|
|
|
|
"/Users/user/ships/zod/home",
|
|
|
|
],
|
|
|
|
herb: false,
|
|
|
|
URL: 'http://localhost:80'
|
|
|
|
};
|
|
|
|
```
|
|
|
|
|
2020-09-29 04:58:17 +03:00
|
|
|
Change the URL to your livenet ship (if making front-end changes) or keep it the
|
|
|
|
same (if [developing on a local development ship][local]). Then, from
|
|
|
|
'pkg/interface':
|
2020-07-16 18:40:35 +03:00
|
|
|
|
|
|
|
```
|
|
|
|
npm install
|
|
|
|
npm run start
|
|
|
|
```
|
|
|
|
|
2020-09-29 04:58:17 +03:00
|
|
|
The dev server will start at `http://localhost:9000`. Sign in as you would
|
|
|
|
normally. Landscape will refresh automatically as you make changes.
|
2019-08-28 19:00:04 +03:00
|
|
|
|
2020-10-13 08:04:46 +03:00
|
|
|
#### Multi ship environments
|
|
|
|
|
|
|
|
If you are testing across multiple ships at once, and you would like to be able
|
|
|
|
to run the development server against all of the ships simulataneously, then do
|
|
|
|
the following.
|
|
|
|
|
|
|
|
Add an object under the `FLEET` key to your urbitrc.
|
|
|
|
```javascript
|
|
|
|
module.exports = {
|
|
|
|
URL: 'http://localhost:80',
|
|
|
|
FLEET: {
|
|
|
|
'zod': 'http://localhost:8080',
|
|
|
|
'bus': 'http://localhost:8081',
|
|
|
|
'nus': 'http://localhost:8082'
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
The dev environment will attempt to match the subdomain against the keys of this
|
|
|
|
object, and if matched will proxy to the corresponding URL. For example, the
|
|
|
|
above config will proxy `zod.localhost:9000` to `http://localhost:8080`,
|
|
|
|
`bus.localhost:9000` to `http://localhost:8081` and so on and so forth. If no
|
|
|
|
match is found, then it will fallback to the `URL` property.
|
|
|
|
|
2020-04-09 13:08:23 +03:00
|
|
|
## Linting
|
|
|
|
|
|
|
|
The Urbit interface uses Eslint to lint the JavaScript code. To install the
|
|
|
|
linter and for usage through the command, do the following:
|
2020-07-16 18:40:35 +03:00
|
|
|
|
2020-04-09 13:08:23 +03:00
|
|
|
```bash
|
|
|
|
$ cd ./pkg/interface
|
|
|
|
$ npm install
|
|
|
|
$ npm run lint
|
|
|
|
```
|
|
|
|
|
|
|
|
To use the linter, run npm scripts
|
2020-07-16 18:40:35 +03:00
|
|
|
|
2020-04-09 13:08:23 +03:00
|
|
|
```bash
|
|
|
|
$ npm run lint # lints all files in `interface`
|
2020-06-18 00:41:12 +03:00
|
|
|
$ npm run lint-file ./src/apps/chat/**/*.js # lints all .js files in `interface/chat`
|
|
|
|
$ npm run lint-file ./src/chat/app.js # lints a single chosen file
|
2020-04-09 13:08:23 +03:00
|
|
|
```
|
|
|
|
|
2019-08-28 19:00:04 +03:00
|
|
|
## Creating your own applications
|
|
|
|
|
|
|
|
If you'd like to create your own application for Landscape, the easiest way to
|
|
|
|
get started is using the [create-landscape-app][cla] repository template. It
|
|
|
|
provides a brief wizard when you run it with `npm start`, and has good
|
|
|
|
documentation for its everyday use -- just create a repo [using its
|
|
|
|
template][template], install and then start it, and you'll soon be up and
|
|
|
|
running.
|
|
|
|
|
2020-07-16 18:40:35 +03:00
|
|
|
[cla]: https://github.com/urbit/create-landscape-app
|
|
|
|
[template]: https://github.com/urbit/create-landscape-app/generate
|
|
|
|
[gall]:https://urbit.org/docs/learn/arvo/gall/
|
2020-10-13 08:04:46 +03:00
|
|
|
[local]: /CONTRIBUTING.md#fake-ships
|