NDLA Editorial Frontend for producing content for NDLA
- Node.JS 20.13
- yarn v4
- Docker (optional)
What's in the box?
- React
- Express
- Vite + Babel (ES6)
All dependencies are defined in package.json
and are managed with npm/yarn. To
initially install all dependencies and when the list dependency has changed,
run yarn install
.
$ yarn install
Start node server with hot reloading middleware listening on port 3000.
$ yarn start
To use a different api set the NDLA_ENVIRONMENT
environment variable.
Test framework: Vitest with React Testing Library.
$ yarn test
Playwright is used for end to end testing.
$ yarn e2e
To circumvent api call flakiness all request are mocked when the tests are run on ci. Use the following command to record new mocks when api-calls change:
$ yarn e2e:record
Playwright tests can also be run in headless mode with mocked API calls.
$ yarn e2e:headless
tl;dr: Use prettier and eslint!
Format code with prettier to get uniform codestyle:
$ yarn format
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 yarn
:
$ yarn lint
Rules are configured in ./.eslintrc.js
and extends eslint-config-react-app. If feeling brave, try eslint --fix
.
# Create minified production ready build with vite (rollup):
$ yarn build
# Docker stuff
$ ./build.sh