GithubHelp home page GithubHelp logo

awattez / sensei Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zenika/sensei

0.0 0.0 0.0 2.91 MB

The compiler for our training material.

Home Page: https://hub.docker.com/r/zenika/sensei

License: Other

JavaScript 63.45% CSS 32.68% HTML 3.23% Dockerfile 0.64%

sensei's Introduction

@zenika/sensei

The compiler for our training material. Sensei is a replacement for zenika-formation-framework.

Installation

Using the published Docker image ๐Ÿณ

  • Pull the image with docker image pull zenika/sensei

  • Create an alias sensei

    alias sensei='docker container run \
      --pull always \
      --interactive \
      --tty \
      --rm \
      --volume $(pwd):/$(basename $(pwd)) \
      --workdir /$(basename $(pwd)) \
      --publish ${SENSEI_PORT:-8080}:${SENSEI_PORT:-8080} \
      --env SENSEI_PORT \
      --env SENSEI_WATCH_POLL \
      --cap-add=SYS_ADMIN \
      zenika/sensei'

โš  When running sensei inside a Docker container, the --material is limited to descendants of the working directory.

โš  If sensei fails to recompile on changes, try setting SENSEI_WATCH_POLL to true.

โš  To change SENSEI_PORT when using this alias, use the following syntax: export SENSEI_PORT=9000; sensei. See here.

Notes on running in Docker for Windows

โ„น๏ธ The following also applies to Colima on macOS.

When bind-mounting files in Docker for Windows with WSL2, the recommendation is to store files in the Linux filesystem, i.e. inside WSL2. The Linux filesystem can then be accessed from Windows through the path \\wsl$\ (or \\wsl.localhost\). When using VSCode, you can also use the WSL extension to edit files on the Linux filesystem.

Therefore it is recommended to clone the training repository in the Linux filesystem then to run the alias from WSL2.

โš  If you use the Windows filesystem, hot reload when changing training content won't work out-of-the-box, but you can set SENSEI_WATCH_POLL to true to enable it.

โš  If you use the Windows filesystem and expect to use the alias within Git Bash for Windows, prepend the --volume and --workdir options with an additional slash (i.e. --volume /$(pwd):/$(basename $(pwd)) --workdir //$(basename $(pwd)). See known issues of Git for Windows. This avoids the C:/Program Files/Git/...: no such file or directory kind of errors.

Using a Docker image built from sources ๐Ÿณ

  • Clone this repo and cd into the created folder
  • Build the image with docker image build --tag zenika/sensei ./
  • Create the same alias as for the published Docker image but without the --pull always

โš  The same warnings as for the published Docker image apply.

Using Node.js

  • Install with npm install --global https://github.com/Zenika/sensei

โš  You may use Yarn, however it's been known to have cache issues when installing packages from GitHub, resulting in failures to update sensei correctly.

โš ๏ธ On Mac M1 or M2, you need to follow special steps to enable PDF generation. You must do this before the npm install, otherwise you will have an unused version of chromium installed in ~/.cache/puppeteer.

# Install chromium without Mac OS Quarantine to allow puppeteer to launch it
brew install --cask chromium --no-quarantine
# Put these variables export in your .bashrc or .zshrc to make sure puppeteer use the right chromium
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
export PUPPETEER_EXECUTABLE_PATH=`which chromium`

Usage

Help

Run sensei --help for available commands and options.

Generating PDFs

  • cd into a training material folder (must have Slides/slides.json and Workbook/workbook.json)
  • Run sensei pdf
  • PDFs are generated inside pdf folder

Serving the slides and labs

  • cd into a training material folder (must have Slides/slides.json and Workbook/workbook.json)
  • Run sensei serve
  • Navigate to http://localhost:8080/

Material authoring

Slides

Write slides as you would usual Reveal.js slides. Refer to Reveal's documentation for features. Note that the following plugins are enabled:

  • Markdown
  • Highlight
  • Zoom
  • Notes
  • Math

Workbook

Write the workbook as you would a usual markdown document.

โ„น You may use <!-- toc --> to have a table of content inserted at that place.

Development

Running

Install dependencies (npm i) then use npm start -- to run the CLI (e.g. npm start -- serve --material=./training-material where ./training-material points to directory with training material in it). You may alternatively use npm run dev -- instead to enable restart on change (e.g. npm run dev -- serve --material=./training-material). Note that npm run dev requires Node.js 18.11 or later.

Testing

Tests are written using the built-in test module, which requires Node.js 18.3 or later.

  • Run all tests: npm test
  • Run one test file: npm test path/to/test/file.test.js

Source file structure

  • src/app: source code for the web app that embeds training material
  • src/build: source code that builds the previously mentioned web app, including the training material
  • src/pdf: source code that builds PDFs from the training material
  • src/cli: source code for the CLI

Code formating

This project uses Prettier. Don't forget to format before committing! You may use npm run prettier:write to do that.

sensei's People

Contributors

hgwood avatar zigarn avatar dependabot[bot] avatar ebriand avatar mchoraine avatar moreau-nicolas avatar fredericbarrau avatar jlandure avatar jermarchand avatar patou avatar pyaillet 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.