Create h5p file from other h5p files

Forums: 

Hi everyone, I've four H5P packages - similar structure to the Interactive Video. Each package has it's own repository and it's own CI that uses semantic-release for automatic versioning and release generation. Furthermore I created a plugin for semantic-release that updates the library.json on each release and creates a h5p file.

Finally, I've four h5p files - one for each repository. The next way would be to install them in my H5P environment but unfortunately I cannot install them because 2 of them are depending on each other - similar to the issue described here: https://h5p.org/node/936076

So does anyone know if I can "build" a new h5p file based on the h5p files I already have, e.g.:

$ h5p pack h5p-file1.h5p h5p-file2.h5p h5p-file3.h5p h5p-file.h5p final-lib.h5p

I already tried this, but it tells me "You must specify libraries".

I know it's not best practice to have circular dependencies but my H5P packages are based on the official Interactive Video which has such circular dependencies.

otacke's picture

Hi!

The H5P cli tool works on git repositories, not on H5P files.

If you want to work with built H5P library files, all you would need to do is take the folders inside the H5P library archive (you know that this technically is a zip file, do you?) and put them into one H5P archive. So, for instance if you had ...

  1. library1.h5p containing the folder H5P.Library1-x.y and
  2. library2.h5p conraining the folder H5P.Library2-x.y and
  3. library3.h5p containing the folder H5P.Library3-x.y

you would simple put them into one archive

  • newLibrary.h5p containing all the folder H5P.Library1-x.y and H5P.Library2-x.y and H5P.Library3-x.y.

Keep in mind to use the D and the X flag for zip, so e.g.

zip -rDX newLibrary.h5p folder_with_all_the_other_folders/*

It may be more convenient, however, to clone all the repositories (e.g. library1 and library2 and library3) required into one folder and inside that folder run

h5p pack -r library1 ~/output.h5p

where library1 is the main library and the h5p-cli tool will recursively add all the dependencies defined in library1 or run

h5p pack library1 library2 library3 ~/output.h5p

if you want to name libraries explicitly.

Best,
Oliver

Thank you in advance, Oliver! That solved my issue. I know that it would be more convenient to clone all repositories. The optimal solution would be a multi-project-pipeline (in Gitlab). Unfortunately I've no premium version, so the only way would be to use the CI of one of the repositories. But I don't like this approach yet... for the first time the automatic versioning and package creation should be enought. Maybe, sometime the multi-project pipelines become available in the Gitlab Community Edition, so I can perfectly do everything automatically :-) But for now, thank you in advance!