Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
Matchlighter committed Dec 28, 2023
1 parent 1d7ff57 commit 5caa0cb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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.
Expand Down
1 change: 1 addition & 0 deletions docker/rootfs/etc/s6-overlay/s6-rc.d/init/run
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion docker/skel/bin/mappath.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/python3
#!/usr/bin/env python3

import os
import sys
Expand Down

0 comments on commit 5caa0cb

Please sign in to comment.