Make sure you have git, node
>= 20, and npm installed. There might be
problems if you use yarn as it doesn't use the package-lock.json file and
you might get incorrect and untested dependencies.
Important: If you use Windows, you must use Bash (comes with Git for windows) as a command shell (otherwise scripts won't run).
git clone https://github.com/lumieducation/h5p-nodejs-library
cd h5p-nodejs-library
npm install
npm run setup
This will install all dependencies in all packages, linking all cross-dependencies and downloads test dependencies such as the h5p core and editor library as well as content types.
This repository is a NPM
workspaces monorepo. A
monorepo is one repository for several packages, which can be found in the
packages/ folder. Each subfolder is its own package, published via
npm. Packages are mostly self contained except for the
following cases:
package.json
and node_module folder. For example, the jest testing
framework and typescript are used in every package - therefore these are
made accessible in every package.test/data. Data used for only single packages is
located in the respective package/<name>/test/data folder.You must transpile the TypeScript files to ES5 for the project to work (the
TypeScript transpiler will be installed automatically if you run npm install):
npm run build
To start the server-side-rendering example run
npm start
and open http://localhost:8080 in your browser.
The library emits log messages with
debug. To see those messages you have to
set the environment variable DEBUG to h5p:*. There are several log levels.
By default you'll only see the messages sent with the level info. To get the
verbose log, set the environment variable LOG_LEVEL to debug (mind the
capitalization).
Example (for Linux):
DEBUG=h5p:* LOG_LEVEL=debug node script.js
Check out the many other npm scripts in package.json for other development
functionality.