mix kotoba.build (Kotoba v0.5.0)

Copy Markdown View Source

Builds the Kotoba editor into priv/static.

$ mix kotoba.build

This task is for work on Kotoba itself. An application that uses Kotoba gets the built files in the Hex package and does not run this task: in any project but Kotoba, the task stops with an error before it changes a file.

The task:

  1. Runs npm ci in assets/ when assets/node_modules is missing or assets/package-lock.json changed since the last install.
  2. Empties priv/static, so that it holds only the files of this build.
  3. Runs esbuild (the esbuild Mix package) with the :kotoba_esm and :kotoba_cjs profiles for the core editor, and :kotoba_collab_esm and :kotoba_collab_cjs for the optional collaboration bundles.
  4. Copies assets/css/kotoba.css and assets/css/kotoba-sumi.css to priv/static/.

After the task, priv/static holds exactly these six files, which are the files of the Hex package.

It needs npm on the path and the :esbuild dependency, which is available in the :dev environment.