Skip to content

NDLANO/listing-frontend

Repository files navigation

CI

NDLA Listing frontend

Requirements

  • Node.JS > 20.13.1
  • yarn ~1.15.0
  • Docker (optional)

Getting started

What's in the box?

  • React
  • Redux
  • Express
  • Webpack + Babel (ES6)

Dependencies

All dependencies are defined in package.json and are managed with npm. To initially install all dependencies and when the list dependency has changed, run npm install.

$ yarn install

Start development server

Start node server with hot reloading middleware listening on port 3000.

$ yarn start

To use a different api set the NDLA_API_URL environment variable.

Unit tests

Test framework: Jest with enzyme.

$ yarn test

Code style

tl;dr: Use eslint! Rules: [Airbnb Styleguide]https://github.com/airbnb/javascript.

Lint code with eslint, including eslint react plugin, eslint-plugin-import, eslint-plugin-jsx-a11y. Beside linting with globally installed eslint, eslint can be invoked with npm:

$ yarn run lint

Rules are configured in ./.eslintrc.js and extends eslint-config-airbnb. If feeling brave, try eslint --fix.

Gql schema

The eslint-plugin-graphql is used to check the queries against the GraphQL schema. Make sure you have an running instance of the GraphQL enpoint with your latest changes

yarn get-gql-schema-local

TypeScript

GraphQL code generator is used to generate TypeScript types from the local GraphQL schema and queries.

yarn generate-gql-types

The configuration is found in codegen.yml.

Other scripts

# Create minified production ready build with webpack:
$ yarn run build
# Docker stuff
$ ./build.sh