Skip to content

astropy/learn-astropy

Astropy Learn

This repository hosts the homepage of the Astropy Learn project, https://learn.astropy.org and serves the content from the astropy-tutorials repository. The site itself is built with Gatsby and the Algolia search service. Records for the Algolia database are curated and formatted by the learn-astropy-librarian app.

Developer guide

Initial set up

Create a fork on https://github.com/astropy/learn.

npm install

Run a development server

You can run a development server that will serve the site and reload as you develop the app:

npm run develop

By default the app is hosted at http://localhost:8000. You can also interact with the GraphQL data layer by browsing

Build for production

npm run build

Preview the built site by running:

npm run serve

Linting and autoformatting

This app uses ESLint to lint JavaScript, which in turn runs Prettier to format JavaScript. The configuration is based on wesbos/eslint-config-wesbos.

A Git pre-commit hooks runs both ESLint and Prettier and automatically lints and reformats code before every commit. These hooks are run by husky and should already be installed when you ran npm install.

To manually lint the code base:

npm run lint

To also fix issues and format the code base:

npm run lint:fix

Ideally your editor will also apply eslint/prettier on save, though these commands are handy as a fallback.

About the node version

This project is intended to be built with a Node.js version that's encoded in the .nvmrc file. To adopt this Node version, we recommend installing and using the node version manager.

Then you can use the preferred node version by running nvm from the project root:

nvm use

Additional resources for developers

Learn more about Gatsby:

Learn more about Algolia: