Fix administration and development docs

This commit is contained in:
Sean King
2020-08-30 13:43:40 -06:00
parent 55fe6eb179
commit d7bfe3305b
8 changed files with 6 additions and 53 deletions

View File

@ -0,0 +1,8 @@
# How it works
Soapbox FE is a [single-page application (SPA)](https://en.wikipedia.org/wiki/Single-page_application) that runs entirely in the browser with JavaScript.
It has a single HTML file, `index.html`, responsible only for loading the required JavaScript and CSS.
It interacts with the backend through [XMLHttpRequest (XHR)](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest).
It incorporates much of the [Mastodon API](https://docs.joinmastodon.org/methods/) used by Pleroma and Mastodon, but requires many [Pleroma-specific features](https://docs-develop.pleroma.social/backend/API/differences_in_mastoapi_responses/) in order to function.

View File

@ -0,0 +1,20 @@
# Developing against a live backend
You can also run Soapbox FE locally with a live production server as the backend.
> **Note:** Whether or not this works depends on your production server. It does not seem to work with Cloudflare or VanwaNet.
To do so, just copy the env file:
```
cp .env.example .env
```
And edit `.env`, setting the configuration like this:
```
BACKEND_URL="https://pleroma.example.com"
PROXY_HTTPS_INSECURE=true
```
You will need to restart the local development server for the changes to take effect.

View File

@ -0,0 +1,32 @@
# Local Dev Configuration
The following configuration variables are supported supported in local development.
Edit `.env` to set them.
All configuration is optional, except `NODE_ENV`.
## `NODE_ENV`
The Node environment.
Soapbox FE checks for the following options:
- `development` - What you should use while developing Soapbox FE.
- `production` - Use when compiling to deploy to a live server.
- `test` - Use when running automated tests.
## `BACKEND_URL`
URL to the backend server.
Can be http or https, and can include a port.
For https, be sure to also set `PROXY_HTTPS_INSECURE=true`.
**Default:** `http://localhost:4000`
## `PROXY_HTTPS_INSECURE`
Allows using an HTTPS backend if set to `true`.
This is needed if `BACKEND_URL` is set to an `https://` value.
[More info](https://stackoverflow.com/a/48624590/8811886).
**Default:** `false`

View File

@ -0,0 +1,38 @@
# Running locally
To get it running, just clone the repo:
```
git clone https://gitlab.com/soapbox-pub/soapbox-fe.git
cd soapbox-fe
```
Ensure that Node.js and Yarn are installed, then install dependencies:
```
yarn
```
Finally, run the dev server:
```
yarn dev
```
**That's it!** 🎉
It will serve at `http://localhost:3036` by default.
It will proxy requests to the backend for you.
For Pleroma running on `localhost:4000` (the default) no other changes are required, just start a local Pleroma server and it should begin working.
## Troubleshooting: `ERROR: NODE_ENV must be set`
Create a `.env` file if you haven't already.
```
cp .env.example .env
```
And ensure that it contains `NODE_ENV=development`.
Try again.

View File

@ -0,0 +1,29 @@
# Yarn Commands
The following commands are supported.
You must set `NODE_ENV` to use these commands.
To do so, you can add the following line to your `.env` file:
```
NODE_ENV=development
```
## Local dev server
- `yarn dev` - Run the local dev server.
## Building
- `yarn build` - Compile without a dev server, into `/static` directory.
## Translations
- `yarn manage:translations` - Normalizes translation files. Should always be run after editing i18n strings.
## Tests
- `yarn test` - Runs all tests.
- `yarn test:lint` - Runs all linter tests.
- `yarn test:lint:js` - Runs only JavaScript linter.
- `yarn test:lint:sass` - Runs only SASS linter.
- `yarn test:jest` - Frontend unit tests.