defmodule Lain.CLI do @certpath Path.join([ Mix.Project.build_path(), "lib", "castore", "priv", "cacerts.pem" ]) @external_resource @certpath @cacerts File.read!(@certpath) def main([command, path]) do Application.put_env( :tree_sitter, :cacerts_path, Path.join([File.cwd!(), "_build", "castore.pem"]) ) Application.put_env( :tailwind, :cacerts_path, Path.join([File.cwd!(), "_build", "castore.pem"]) ) Application.ensure_all_started([:castore, :inets, :ssl, :tailwind]) args = [ "--config=#{Path.join(Path.expand(path), "tailwind.config.js")}", "--input=#{Path.join(Path.expand(path), "assets/app.css")}", "--output=#{Path.join(Path.expand(path), "build/assets/app.css")}", "--minify" ] File.write!(Path.join("_build", "castore.pem"), @cacerts) Tailwind.install_and_run(:default, args) case command do "build" -> Lain.run(path) "clean" -> Lain.clean(path) end end end