Skip to content

Commit fd17bb7

Browse files
authored
Sync quickstart projects (#16)
1 parent 329697a commit fd17bb7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2368
-2252
lines changed

.cspell.json

-9
This file was deleted.

.env.dist .env.template

File renamed without changes.

.eslintrc.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module.exports = {
2+
parser: "@typescript-eslint/parser",
3+
parserOptions: {
4+
project: "tsconfig.json",
5+
tsconfigRootDir: __dirname,
6+
sourceType: "module",
7+
},
8+
plugins: ["@typescript-eslint", "import", "prettier", "unicorn"],
9+
extends: [
10+
"plugin:@typescript-eslint/recommended",
11+
"plugin:unicorn/recommended",
12+
"plugin:prettier/recommended",
13+
],
14+
root: true,
15+
env: {
16+
node: true,
17+
jest: true,
18+
},
19+
ignorePatterns: [".eslintrc.js"],
20+
rules: {
21+
"@typescript-eslint/interface-name-prefix": "off",
22+
"@typescript-eslint/explicit-function-return-type": "off",
23+
"@typescript-eslint/explicit-module-boundary-types": "off",
24+
"@typescript-eslint/no-explicit-any": "off",
25+
"@typescript-eslint/no-namespace": "off",
26+
"unicorn/prefer-top-level-await": "off",
27+
"unicorn/import-style": "off",
28+
"unicorn/prefer-module": "off",
29+
"unicorn/no-null": "off",
30+
"unicorn/prevent-abbreviations": "off",
31+
},
32+
};

.eslintrc.json

-89
This file was deleted.

.github/FUNDING.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# These are supported funding model platforms
22

33
# Note: This is an override for this repository specifically
4-
github: webbertakken
4+
github: [webbertakken, zoe-codez]
55
patreon: # Replace with a single Patreon username
66
open_collective: # replace with a single OpenCollective username
77
ko_fi: # Replace with a single Ko-fi username

.github/workflows/main.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
uses: actions/setup-node@v4
2121
with:
2222
node-version-file: package.json
23-
cache: 'yarn'
23+
cache: "yarn"
2424

2525
- name: Install deps
2626
run: yarn install --frozen-lockfile --immutable

.github/workflows/pull-request.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ jobs:
2020
uses: actions/setup-node@v4
2121
with:
2222
node-version-file: package.json
23-
cache: 'yarn'
23+
cache: "yarn"
2424

2525
- name: Install deps
2626
run: yarn install --frozen-lockfile --immutable
2727

2828
- name: Tests
29-
run: yarn coverage
29+
run: yarn test:coverage
3030

3131
- name: Upload coverage reports to Codecov
3232
uses: codecov/[email protected]

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
/node_modules
55
/deploy
66
/previous_deploy.tar.gz
7+
/synapse_storage.db
78
/.yarn
89
/.idea
910
/.vscode
1011
/.env*
1112
!/.env*.dist
13+
!/.env*.template

.husky/pre-commit

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
# If tty is available, apply fix from https://github.com/typicode/husky/issues/968#issuecomment-1176848345
55
if sh -c ": >/dev/tty" >/dev/null 2>/dev/null; then exec >/dev/tty 2>&1; fi
66

7-
# Heavy checks should only be done on staged files123
8-
bun run lint-staged
7+
# Heavy checks should only be done on staged files
8+
yarn lint-staged

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20

.prettierrc.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"semi": false,
3-
"singleQuote": true,
4-
"printWidth": 100,
2+
"singleQuote": false,
53
"trailingComma": "all",
6-
"proseWrap": "always"
4+
"jsxSingleQuote": false,
5+
"printWidth": 100,
6+
"arrowParens": "avoid"
77
}

.stignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

Dockerfile

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
## ##
55
###########################################################
66

7-
# see all versions at https://hub.docker.com/r/oven/bun/tags
8-
ARG BUN_VERSION="1"
9-
107
# see all versions at https://hub.docker.com/r/bitnami/node/tags
118
ARG NODE_VERSION="20"
129

@@ -38,7 +35,7 @@ ENV VOLTA_HOME "/root/.volta"
3835
ENV PATH "$VOLTA_HOME/bin:$PATH"
3936

4037
# Copy only relevant files
41-
COPY package.json yarn.lock .yarnrc.yml tsconfig.json vitest.config.ts .prettier* .eslint* .cspell.json /app/
38+
COPY package.json yarn.lock .yarnrc.yml tsconfig.json vitest.config.ts .prettier* .eslint* /app/
4239
COPY src/ /app/src/
4340

4441
# Build and pre-flight checks
@@ -90,6 +87,9 @@ WORKDIR /app
9087
# Copy the distributable files and production specific dependencies
9188
COPY --from=builder /app/dist /app/package.json ./
9289

90+
# match port in app
91+
ENV PORT 3000
92+
9393
# Run the app
94-
EXPOSE 3000
94+
EXPOSE $PORT
9595
CMD ["./server"]

README.md

+24-60
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,82 @@
1-
# Automation Standalone 🏡💻🐳
1+
## Automation Standalone 🏡💻🐳
22

33
Welcome to the Digital Alchemy standalone automation repository!
44

5-
## Purpose
6-
75
This repository is designed to work both locally and deployed as a docker container. The container
86
will interact with the HomeAssistant websocket to fulfill its automation goals.
97

10-
## Community
11-
128
- 📚 [Documentation](https://docs.digital-alchemy.app/)
139
- 🗣️ [Discord](https://discord.gg/JkZ35Gv97Y)
1410

15-
## Setup
11+
## 🏗️ Setup
1612

1713
### Prerequisites
1814

19-
These tools need to be installed on your machine:
15+
Digital Alchemy targets `node20`, which is the only required system dependency. Recommended workspace tools:
2016

2117
- [Volta](https://volta.sh/) - Autonomously manages Node and Yarn versions
2218
- [Docker desktop](https://www.docker.com/products/docker-desktop/) - For packaging the application
2319

2420
### Clone
2521

26-
Clone the repository to your local machine:
22+
Clone the repository to your local machine and change directory to thew new repo:
2723

2824
```bash
2925
git clone [email protected]/Digital-Alchemy-TS/automation-standalone.git
30-
```
31-
32-
### Change directory
3326

34-
Change directory to the repository root:
35-
36-
```bash
3727
cd automation-standalone
3828
```
3929

40-
### Install
30+
### Install Dependencies
4131

4232
Install dependencies using Yarn:
4333

4434
```bash
45-
yarn
35+
# (optional) enable yarn for setups without Volta
36+
corepack enable
37+
38+
# install node_modules
39+
yarn install
4640
```
4741

4842
### Configure
4943

50-
Create a `.env` file from the `.env.dist` example file.
44+
Create a `.env` file from the `.env.template` example file. <sup>[docs](https://docs.digital-alchemy.app/docs/core/configuration)</sup>
5145

5246
```bash
53-
cp .env.dist .env
47+
cp .env.template .env
5448
```
5549

5650
Then, configure each variable in `.env` so that the application can connect to your HA instance.
5751

58-
## Usage
52+
## 🪄 Workspace Usage
5953

60-
### Sync
54+
### Management
6155

62-
Synchronize the latest DA packages and write types based on your HA instance
63-
64-
```bash
65-
yarn sync
66-
```
67-
68-
### Run
69-
70-
Run your automations locally
56+
Upgrade the version of `@digital-alchemy` libraries to latest.
7157

7258
```bash
73-
yarn dev
59+
yarn upgrade
7460
```
7561

76-
## Testing
77-
78-
#### Unit tests and integration tests
79-
80-
Run all your tests
62+
Update the library type definitions based on current Home Assistant state. <sup>[docs](https://docs.digital-alchemy.app/docs/home-automation/type-writer/)</sup>
8163

8264
```bash
83-
yarn test
65+
yarn type-writer
8466
```
8567

86-
#### End-to-end tests
87-
88-
See [./playground](./playground/README.md) folder readme.
89-
90-
## Publication
91-
92-
### Build
68+
### Run
9369

94-
Build the application
70+
Run your automations locally
9571

9672
```bash
97-
yarn build
98-
```
99-
100-
### Publish
73+
# normal start
74+
yarn start
10175

102-
Build and publish your application to a docker registry
103-
104-
```bash
105-
yarn publish
76+
# automatic reload when code changes
77+
yarn start:watch
10678
```
10779

108-
### Deploy
109-
110-
For now, this will be considered a manual step. Basically all you have to do is pull the image that
111-
you've just pushed.
112-
113-
> _**Note:** make sure that the same variables from `.env.dist` are passed into the container at
114-
> runtime._
115-
11680
## 📄 License
11781

11882
This project is licensed under the MIT License, as detailed in the [LICENSE](./LICENSE) file.

0 commit comments

Comments
 (0)