This document describes
- how to build and run Slate locally, and
- how to make it publicly accessible by deploying to Netlify or Heroku.
- Install the following software:
- Git
- Microsoft Visual Studio Code
- Node.js
- Google Chrome or Chromium
- React Developer Tools
- Make sure the programs
git
,code
, andnpm
can be started from the command line, i.e. are accessible via thePATH
environment variable. - In a terminal, in a directory of your choice, run
git clone --recursive https://github.com/SReichelt/slate.git cd slate npm install npm run build
Rerun npm install
and npm run build
after a pulling a new version from the repository.
- First, follow the steps for 'Building Slate' above, except for
npm run build
. - Start Visual Studio Code, and open the workspace
Slate.code-workspace
. - Now you should be able to execute the app via the run configuration "Launch with Chrome" or "Launch with Firefox".
- If the app does not start, check all output/console/terminal windows of Visual Studio Code for errors.
- Optional: To debug GitHub support, set up an OAuth application at https://github.com/settings/developers.
- Enter http://localhost:3000/ for the callback URL.
- After creating the application, add environment variables
GITHUB_CLIENT_ID
andGITHUB_CLIENT_SECRET
to your local machine, according to the values reported by GitHub.
- First, follow the steps for 'Building Slate' above. (Note that in contrast to the first item under "Running Slate locally", the embedded webview of the VSCode extension will actually use the output of
npm run build
.) - Open the separate workspace
Slate-vscode.code-workspace
. - Click "Run / Start debugging" (F5).
When developing Slate, you will probably want to install the locally built version of the VSCode extension instead of the published version.
- First build Slate as described above.
- Open a terminal in the VSCode extensions folder.
- Create a symbolic link to the
src/vscode
subdirectory of Slate:- On Linux, use
ln -s <path>/src/vscode slate
- On Windows, use
mklink
with the/d
option, orNew-Item
in PowerShell.
- On Linux, use
Creating a new public installation of Slate is very simple, and should work out of the box on Netlify. There is a provider-specific part and some provider-independent configuration.
Netlify is recommended because its serverless architecture reduces costs and is potentially faster. However, this means that the site runs differently from what you can reproduce locally.
- Log in with your GitHub account at https://www.netlify.com/.
- Follow the steps to create a new site based on the GitHub repository. Leave all settings empty because they are already configured in
netlify.toml
.
- Create an account at https://www.heroku.com/.
- Create a new Node.js app.
- Either configure the app to track your GitHub repository, or add Heroku as a Git remote and push to it (see https://devcenter.heroku.com/articles/git).
The steps above should be sufficient to create a read-only installation of Slate. Verify that the Netlify/Heroku build was successful and that the website can be accessed.
- To allow users to submit modifications, some environment variables (called "Config Vars" in Heroku) need to be set up in the app settings. For anonymous contributions, add the following variables:
MAIL_HOST
: Hostname of an SMTP provider of your choice.MAIL_USER
,MAIL_PASSWORD
: Login for the SMTP provider.MAIL_FROM
,MAIL_TO
: Email headers for submission mails.
- To let users submit GitHub pull requests, you need to set up your OAuth application at https://github.com/settings/developers. For the callback URL, enter the public URL of the app. Then add the following environment variables:
GITHUB_CLIENT_ID
: The client ID generated by GitHub.GITHUB_CLIENT_SECRET
: The GitHub secret generated by GitHub.GITHUB_REDIRECT_URL
(optional but recommended): The exact redirect URL as expected by GitHub. In particular, you may run into problems with HTTP vs. HTTPS if you don't specify this.
On Netlify, you need to manually trigger a new deployment after changing variables.
Unless configured differently, the new installation behaves like the official installation in that it will load library data from https://github.com/SReichelt/slate-hlm.git and also submit pull requests to that repository. Currently, the easiest way to set up a custom library would be to edit data/libraries/libraries.json
.