Skip to content

Commit

Permalink
3.0.0 migrate to nodejs
Browse files Browse the repository at this point in the history
  • Loading branch information
wendevlin committed Aug 23, 2024
1 parent 3dfb5d9 commit aa54e73
Show file tree
Hide file tree
Showing 32 changed files with 4,118 additions and 365 deletions.
3 changes: 1 addition & 2 deletions homedocs/.mise.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[tools]
node = "20"
bun = "1.1.12"
node = "22"
4 changes: 4 additions & 0 deletions homedocs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<!-- https://developers.home-assistant.io/docs/add-ons/presentation#keeping-a-changelog -->

## 3.0.0

- migration to nodejs 22 with hono server

## 2.0.6

- fix run command for bun server
Expand Down
9 changes: 3 additions & 6 deletions homedocs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@ ARG BUILD_FROM
FROM $BUILD_FROM

# install dependencies
RUN apt-get update && apt-get install -y unzip

# Install Bun
RUN curl -fsSL https://bun.sh/install | bash -s "bun-v1.1.24"
RUN apk add nodejs-current npm

# Copy server into image
COPY server /server
WORKDIR /server

RUN ~/.bun/bin/bun install
RUN ~/.bun/bin/bun run build
RUN npm install
RUN npm run build

# copy and setup run script
COPY run.sh /
Expand Down
10 changes: 5 additions & 5 deletions homedocs/build.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-dockerfile
build_from:
aarch64: "ghcr.io/home-assistant/aarch64-base-debian:bookworm"
amd64: "ghcr.io/home-assistant/amd64-base-debian:bookworm"
# armhf: "ghcr.io/home-assistant/armhf-base:3.19"
# armv7: "ghcr.io/home-assistant/armv7-base:3.19"
# i386: "ghcr.io/home-assistant/i386-base:3.19"
aarch64: "ghcr.io/home-assistant/aarch64-base:3.20"
amd64: "ghcr.io/home-assistant/amd64-base:3.20"
armhf: "ghcr.io/home-assistant/armhf-base:3.20"
armv7: "ghcr.io/home-assistant/armv7-base:3.20"
i386: "ghcr.io/home-assistant/i386-base:3.20"
labels:
org.opencontainers.image.title: "Homedocs (Beta)"
org.opencontainers.image.description: "Document stuff with Markdown"
Expand Down
8 changes: 4 additions & 4 deletions homedocs/config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: Homedocs (Beta)

Check warning on line 1 in homedocs/config.yaml

View workflow job for this annotation

GitHub Actions / Lint add-on homedocs

'map' contains the 'config' folder, which has been replaced by 'homeassistant_config'. See: https://developers.home-assistant.io/blog/2023/11/06/public-addon-config
description: Document stuff with Markdown
version: "2.0.6"
version: "3.0.0"
slug: homedocs_beta
init: false
url: https://github.com/wendevlin/homeassistant-addons/tree/beta/homedocs
arch:
- aarch64
- amd64
# - armhf
# - armv7
# - i386
- armhf
- armv7
- i386
startup: services
map:
- config:rw
Expand Down
2 changes: 1 addition & 1 deletion homedocs/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ fi
# BUILD_TIMEOUT_IN_SECONDS=$(bashio::config 'buildTimeoutInSeconds')

# start the webserver
DOCS_BASE_PATH=/config/homedocs ~/.bun/bin/bun run start:production
DOCS_BASE_PATH=/config/homedocs node dist/index.cjs
64 changes: 25 additions & 39 deletions homedocs/server/.gitignore
Original file line number Diff line number Diff line change
@@ -1,44 +1,30 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
# dev
.yarn/
!.yarn/releases
.vscode/*
!.vscode/launch.json
!.vscode/*.code-snippets
.idea/workspace.xml
.idea/usage.statistics.xml
.idea/shelf

# deps
node_modules/

# env
.env
.env.production

# logs
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel

**/*.trace
**/*.zip
**/*.tar.gz
**/*.tgz
**/*.log
package-lock.json
**/*.bun
# misc
.DS_Store

dist
dist
1 change: 1 addition & 0 deletions homedocs/server/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact=true
17 changes: 5 additions & 12 deletions homedocs/server/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
# Elysia with Bun runtime

## Getting Started
To get started with this template, simply paste this command into your terminal:
```bash
bun create elysia ./elysia-example
```

## Development
To start the development server run:
```bash
bun run dev
npm install
npm run dev
```

Open http://localhost:3000/ with your browser to see the result.
```
open http://localhost:3000
```
51 changes: 27 additions & 24 deletions homedocs/server/biome.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
{
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"noUselessElse": "off",
"noNonNullAssertion": "off"
},
"correctness": {
"useJsxKeyInIterable": "off"
}
}
},
"javascript": {
"formatter": {
"semicolons": "asNeeded",
"quoteStyle": "single",
"trailingComma": "all"
}
}
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"noUselessElse": "off",
"noNonNullAssertion": "off"
},
"correctness": {
"useJsxKeyInIterable": "off"
},
"security": {
"noDangerouslySetInnerHtml": "off"
}
}
},
"javascript": {
"formatter": {
"semicolons": "asNeeded",
"quoteStyle": "single",
"trailingCommas": "all"
}
}
}
Binary file removed homedocs/server/bun.lockb
Binary file not shown.
9 changes: 0 additions & 9 deletions homedocs/server/bunfig.toml

This file was deleted.

Loading

0 comments on commit aa54e73

Please sign in to comment.