Giter Club home page Giter Club logo

epub-dev-env's Introduction

A small development environment for compiling EPUB 3.3 packages

2024-01-03 No version number yet!

Confguration

A few files need to be modified to adapt the environment to the project's needs.

.env

Defines environment variables common across the containers. This file contains some default values that need to be modified according to your project's requirements:

  • GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL are used by Git.

  • CONTAINER_USER is the name of the user account in the containers and also the name of the user's home directory.

  • REPOSITORY is the name of the folder where the repository is located, within the home directory: /home/$USER/$REPOSITORY.

credentials/

This directory should contain a private and public key for authentication to the repository. The credentials are only exposed to the Git container to ensure that no malicious code in the development or testing containers can steal them.

scripts/build.sh

A script that watches the source directory, expected to be located at /home/$USER/$REPOSITORY/src/ for changes and runs a sequence of commands intended to compile the package and place it in the /home/$USER/$REPOSITORY/dist/ directory. Note: The actual build sequence is not yet implemented.

Getting started

The environment defines three separate containers that need to be created by running the following command once in the project's root directory:

docker-compose build

Git container

To clone an existing repository, or create a new one, start a shell in the Git contaner:

docker-compose run git

To ensure the security of the credentials, the Git container must only contain software from trusted sources. This container should be used to push changes, and if your project resides in a private repository, also to fetch changes.

Caution: Do not run untrusted scripts or executables in the Git container.

Dev container

The Dev container is configured to run as a Docker service and is started with:

docker-compose up -d dev

It runs in the background and automatically triggers the build sequence when it detects changes in any of the source files.

The build script expects that the source code of the EPUB package is located in the /src directory. And the test script expects that the build artefact is placed in the /dist directory. If your project is layed out differently, update the scripts accordingly.

The Dev container should be responsible for setting up third party dependencies and is assumed to run potentially unsafe code.

As a convenience for Visual Studio Code users, the code.sh script starts the Dev container and runs Code in remote development mode towards it. Since the container has Git installed, code changes can be committed from within. However, to push the changes to the repository, the Git container needs to be used.

Test container

The Test container executes the script at scripts/test.sh, which monitors the /dist directory for updates and runs the EPUBChecker tool from W3C against the built aretefact. Currenly, it is hardcoded as book.epub. You may need to adjust the expected file name in the script accordingly.

To verify the EPUB package's conformance to the specification:

docker-compose run test

Conclusion

While this development environment is publicly accessible, it is primarily designed as a personal tool and may not be universally suitable for all use cases. Users are advised to carefully assess its compatibility with their specific requirements and update it accordingly.

The software is released in the public domain under the MIT No Attribution License. For more information see LICENSE.

The author assumes no responsibility for any issues or discrepancies that may arise from the use of this software.

Please, also note that this project is currently a work in progress and many features are not, and may never be, fully implemented. The author welcomes and appreciates any forms of contributions, suggestions, and pull requests. If you identify areas for improvement, encounter issues, or have ideas to enhance the environment's functionality, please consider sharing your insights.

Thank you for your support and understanding.

epub-dev-env's People

Watchers

Zmei Zelen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.