From 5caa0cb0b5c330eda853b87dc241b9982f96e2c4 Mon Sep 17 00:00:00 2001 From: Ethan Knapp Date: Thu, 28 Dec 2023 14:59:54 -0700 Subject: [PATCH] misc --- README.md | 18 ++++++++++++++---- docker/rootfs/etc/s6-overlay/s6-rc.d/init/run | 1 + docker/skel/bin/mappath.py | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ce2027c..87ef520 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,12 @@ # TypeDaemon -Typescript-based application environment for Home Assistant. Similar in principle to AppDAemon, but swaps Python for Javascript/Typescript. +Typescript-based application environment for Home Assistant. Similar in principle to AppDaemon, but swaps Python for Javascript/Typescript. Aims to "include the batteries", providing simple, clean APIs for writing automations. ## Installation -Recommended installation is via Hassio: - +### Hassio (Recommended) 1. Add the https://github.com/Matchlighter/typedaemon-hassio repository by: 1. Navigating to Home Assistant Settings > Addons > Add-on Store 2. Access the kebab menu in the upper right, and select "Repositories" @@ -16,12 +15,23 @@ Recommended installation is via Hassio: 3. Find the TypeDaemon section and select the TypeDaemon addon 4. Install it +### Docker/Compose +Installation outside of Hassio is technically possible, but I've chosen not to allocate time figuring it out and writing docs. If you're going to go this direction, you should have an intermediate understanding of Linux and Docker, and be willing to spend some time digging and throwing stuff at the wall. + +I'm happy to entertain a PR that fills in this section more. + ## Getting Started Upon startup, TypeDaemon will create a template configuration (at `/config/typedaemon` for Hassio, or in the directory mounted to `/config` for Docker/Compose). +Presently, the only API documentation that TypeDaemon provides is via Typescript and JSDoc comments, so it is highly recommended to use VS Code / Studio Code Server when writing TypeDaemon apps. All APIs and utilities provided by TypeDaemon can be imported from `@td`. Check out the example app templates to get a feel for things. + ### CLI Basics -TypeDaemon has a smiple CLI for doing some basic tasks. Execution will very depending on installation method, but for Hassio installs, you can run `bin/td` from the `typedaemon` config directory. +TypeDaemon has a simple CLI for doing some basic tasks. For Hassio installs, you can run `./td --help` from the `typedaemon` config directory. + +TypeDaemon runs completely in Docker, but apps/config are expected to be edited outside of Docker. This split would normally require you to be highly aware of where you're executing commands, with some commands only working if you properly enter the Docker container before execution. The TypeDaemon CLI tries to simplify this and work some magic to automatically enter the container and map paths when necessarry. + +You can execute an arbitrary command in-container with `./td exec CMD`. You can easily gain an in-container shell with `./td shell`. ### Syncing the Dev Environment TypeDaemon tries to abstract the need for you to learn how JS packaging and NPM work. It does this by generating the appropriate configs and automagically downloading appropriate typings and support files. diff --git a/docker/rootfs/etc/s6-overlay/s6-rc.d/init/run b/docker/rootfs/etc/s6-overlay/s6-rc.d/init/run index e0a18d0..7fdedaa 100755 --- a/docker/rootfs/etc/s6-overlay/s6-rc.d/init/run +++ b/docker/rootfs/etc/s6-overlay/s6-rc.d/init/run @@ -1,6 +1,7 @@ #!/command/with-contenv sh # Copy/update binaries +mkdir -p "$TYPEDAEMON_CONFIG/.typedaemon/bin" cp -r -t "$TYPEDAEMON_CONFIG/.typedaemon/bin" "$TYPEDAEMON_MODULE"/skel/bin/* rm "$TYPEDAEMON_CONFIG/td" diff --git a/docker/skel/bin/mappath.py b/docker/skel/bin/mappath.py index 951be1e..d4dcbf4 100755 --- a/docker/skel/bin/mappath.py +++ b/docker/skel/bin/mappath.py @@ -1,4 +1,4 @@ -#!/bin/python3 +#!/usr/bin/env python3 import os import sys