From 640369644039d2d0cd2f7512eb60844521f84b26 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Thu, 18 Apr 2024 13:50:17 +1200 Subject: [PATCH 1/6] Add CI workflow (#74) --- .github/workflows/ci.yaml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..c62a5bc --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,32 @@ +name: CI + +on: + push: + branches: + - main + - dev + pull_request: + +jobs: + build: + name: Build ${{ matrix.name }} + runs-on: ubuntu-latest + strategy: + matrix: + include: + - name: Captive Portal + directory: captive-portal + - name: Webserver v2 + directory: packages/v2 + - name: Webserver v3 + directory: packages/v3 + steps: + - name: Clone the repo + uses: actions/checkout@v4.1.1 + - name: Set up Node.JS + uses: actions/setup-node@v4.0.2 + - name: Install dependencies + run: npm install + - name: Build ${{ matrix.name }} + run: npm run build + working-directory: ${{ matrix.directory }} From 9b20d754d0e0faff105b84b84ff94f48cafb313a Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Thu, 18 Apr 2024 14:28:24 +1200 Subject: [PATCH 2/6] Add missing comma in v3/vite.config.ts (#77) --- packages/v3/vite.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/v3/vite.config.ts b/packages/v3/vite.config.ts index 48e3519..7a203f0 100644 --- a/packages/v3/vite.config.ts +++ b/packages/v3/vite.config.ts @@ -53,7 +53,7 @@ export default defineConfig({ ...gzipPlugin({ filter: /\.(js|css|html|svg)$/ }), enforce: "post", apply: "build", - } + }, ], build: { brotliSize: false, From c0fc5f679a1c7cef416265ac7101c7c684a1f72a Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Thu, 18 Apr 2024 14:28:40 +1200 Subject: [PATCH 3/6] Fix indentation in make_header.sh script and remove ls command (#76) --- scripts/make_header.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/make_header.sh b/scripts/make_header.sh index 4018760..4d92c7b 100755 --- a/scripts/make_header.sh +++ b/scripts/make_header.sh @@ -1,5 +1,5 @@ #!/bin/bash -cat < ./$1/$2 +cat <./$1/$2 #pragma once // Generated from https://github.com/esphome/esphome-webserver #include "esphome/core/hal.h" @@ -8,11 +8,10 @@ namespace esphome { namespace $3 { EOT -echo "const uint8_t INDEX_GZ[] PROGMEM = {" >> ./$1/$2 -xxd -cols 19 -i $1/index.html.gz | sed -e '2,$!d' -e 's/^/ /' -e '$d' | sed -e '$d' | sed -e '$s/$/};/' >> ./$1/$2 -cat <> ./$1/$2 +echo "const uint8_t INDEX_GZ[] PROGMEM = {" >>./$1/$2 +xxd -cols 19 -i $1/index.html.gz | sed -e '2,$!d' -e 's/^/ /' -e '$d' | sed -e '$d' | sed -e '$s/$/};/' >>./$1/$2 +cat <>./$1/$2 } // namespace $3 } // namespace esphome EOT -ls -l ./$1/$2 From 256cab015b9144ed95d36be0ed432bad6f25c22e Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Thu, 18 Apr 2024 14:30:29 +1200 Subject: [PATCH 4/6] Move captive portal into workspace/packages (#75) --- .github/workflows/ci.yaml | 6 +- captive-portal/dist/captive_index.h | 107 ------------------ .../captive-portal}/README.md | 0 .../captive-portal}/index.html | 0 .../captive-portal}/package.json | 4 +- .../captive-portal}/public/config.json | 0 .../captive-portal}/src/icon/lock.svg | 0 .../captive-portal}/src/icon/wifi.svg | 0 .../captive-portal}/src/main.ts | 0 .../captive-portal}/src/stylesheet.css | 0 .../captive-portal}/vite.config.ts | 16 +-- 11 files changed, 13 insertions(+), 120 deletions(-) delete mode 100644 captive-portal/dist/captive_index.h rename {captive-portal => packages/captive-portal}/README.md (100%) rename {captive-portal => packages/captive-portal}/index.html (100%) rename {captive-portal => packages/captive-portal}/package.json (79%) rename {captive-portal => packages/captive-portal}/public/config.json (100%) rename {captive-portal => packages/captive-portal}/src/icon/lock.svg (100%) rename {captive-portal => packages/captive-portal}/src/icon/wifi.svg (100%) rename {captive-portal => packages/captive-portal}/src/main.ts (100%) rename {captive-portal => packages/captive-portal}/src/stylesheet.css (100%) rename {captive-portal => packages/captive-portal}/vite.config.ts (75%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c62a5bc..7628b18 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,9 +17,9 @@ jobs: - name: Captive Portal directory: captive-portal - name: Webserver v2 - directory: packages/v2 + directory: v2 - name: Webserver v3 - directory: packages/v3 + directory: v3 steps: - name: Clone the repo uses: actions/checkout@v4.1.1 @@ -29,4 +29,4 @@ jobs: run: npm install - name: Build ${{ matrix.name }} run: npm run build - working-directory: ${{ matrix.directory }} + working-directory: packages/${{ matrix.directory }} diff --git a/captive-portal/dist/captive_index.h b/captive-portal/dist/captive_index.h deleted file mode 100644 index d262a89..0000000 --- a/captive-portal/dist/captive_index.h +++ /dev/null @@ -1,107 +0,0 @@ -#pragma once -// Generated from https://github.com/esphome/esphome-webserver -#include "esphome/core/hal.h" -namespace esphome { - -namespace captive_portal { - -const uint8_t INDEX_GZ[] PROGMEM = { - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xdd, 0x58, 0x69, 0x6f, 0xdc, 0x36, 0x1a, 0xfe, 0xde, - 0x5f, 0xc1, 0x2a, 0x49, 0x47, 0xd3, 0x58, 0xd4, 0x35, 0x9a, 0x53, 0x9a, 0xc2, 0xf1, 0xa6, 0x68, 0x81, 0xa4, 0x0d, - 0x60, 0xb7, 0xfd, 0x10, 0x04, 0x30, 0x47, 0xa2, 0x46, 0x8c, 0x25, 0x4a, 0x2b, 0x72, 0xae, 0x0c, 0x66, 0x7f, 0xfb, - 0xbe, 0x24, 0x35, 0xe3, 0xb1, 0x37, 0x5e, 0x6c, 0x8a, 0x2d, 0x8a, 0xd6, 0x71, 0x68, 0x1e, 0xef, 0xf9, 0x88, 0xef, - 0x21, 0xc5, 0x5f, 0x67, 0x75, 0x2a, 0x77, 0x0d, 0x45, 0x85, 0xac, 0xca, 0x79, 0xac, 0x46, 0x54, 0x12, 0xbe, 0x4c, - 0x28, 0x87, 0x15, 0x25, 0xd9, 0x3c, 0xae, 0xa8, 0x24, 0x28, 0x2d, 0x48, 0x2b, 0xa8, 0x4c, 0x7e, 0xb9, 0xf9, 0xde, - 0x19, 0x23, 0x77, 0x1e, 0x97, 0x8c, 0xdf, 0xa1, 0x96, 0x96, 0x09, 0x4b, 0x6b, 0x8e, 0x8a, 0x96, 0xe6, 0x49, 0x46, - 0x24, 0x99, 0xb2, 0x8a, 0x2c, 0xa9, 0x22, 0xd0, 0x6c, 0x9c, 0x54, 0x34, 0x59, 0x33, 0xba, 0x69, 0xea, 0x56, 0x22, - 0xa0, 0x94, 0x94, 0xcb, 0xc4, 0xda, 0xb0, 0x4c, 0x16, 0x49, 0x46, 0xd7, 0x2c, 0xa5, 0x8e, 0x5e, 0x5c, 0x30, 0xce, - 0x24, 0x23, 0xa5, 0x23, 0x52, 0x52, 0xd2, 0xc4, 0xbf, 0x58, 0x09, 0xda, 0xea, 0x05, 0x59, 0xc0, 0x9a, 0xd7, 0x16, - 0x88, 0x14, 0x69, 0xcb, 0x1a, 0x89, 0x94, 0xbd, 0x49, 0x55, 0x67, 0xab, 0x92, 0xce, 0x5d, 0x97, 0x08, 0xb0, 0x4b, - 0xb8, 0x8c, 0x67, 0x74, 0x8b, 0x87, 0x61, 0x98, 0x06, 0x64, 0x94, 0xe3, 0x8f, 0xe2, 0x2b, 0xf0, 0x6c, 0x55, 0x81, - 0x3a, 0x5c, 0xd6, 0x29, 0x91, 0xac, 0xe6, 0x58, 0x50, 0xd2, 0xa6, 0x45, 0x92, 0x24, 0xd6, 0x77, 0x82, 0xac,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0x40, 0x81, 0x8f, 0xa3, - 0x37, 0x41, 0x88, 0x87, 0x11, 0x50, 0x05, 0x1e, 0x0e, 0x03, 0x64, 0x68, 0x87, 0x38, 0x00, 0x71, 0x8a, 0x24, 0xac, - 0x00, 0xe8, 0x34, 0xc4, 0xde, 0x08, 0xc4, 0x0d, 0xb1, 0x37, 0xc1, 0xe3, 0x21, 0x1a, 0xe3, 0x11, 0x40, 0x87, 0x07, - 0x51, 0xe9, 0x44, 0xd8, 0x87, 0xed, 0x70, 0x48, 0xc6, 0x78, 0x10, 0x22, 0x3d, 0x18, 0x38, 0x46, 0x20, 0xc2, 0xc1, - 0x9e, 0xff, 0x26, 0xc4, 0xc1, 0x08, 0xf4, 0x0e, 0x06, 0x97, 0x20, 0x76, 0x32, 0x40, 0x66, 0x34, 0xf0, 0x82, 0x82, - 0xe8, 0x29, 0xd0, 0x82, 0xbf, 0x2f, 0x68, 0x00, 0x89, 0x8f, 0x42, 0x3c, 0x81, 0xd8, 0xf5, 0x15, 0xbf, 0x19, 0x0d, - 0x6e, 0xbe, 0x8f, 0xbc, 0xdf, 0x8d, 0x59, 0xf8, 0xf7, 0xc5, 0xcc, 0x57, 0x08, 0xc0, 0x14, 0x74, 0x83, 0x1c, 0xa4, - 0x07, 0xa3, 0x1b, 0x98, 0xc7, 0x57, 0x13, 0x34, 0x06, 0xae, 0xe1, 0x18, 0x4d, 0x50, 0xa4, 0xd0, 0x05, 0xf6, 0x81, - 0x61, 0x72, 0x80, 0xe9, 0x0b, 0x61, 0x1c, 0xfc, 0x85, 0x61, 0x7c, 0xca, 0xa7, 0xbf, 0xb0, 0x4b, 0x7f, 0x46, 0x0a, - 0x82, 0x76, 0x4c, 0xb7, 0x61, 0xb1, 0x6b, 0x3e, 0x0f, 0xa8, 0x2e, 0x0a, 0xde, 0xf6, 0xa1, 0x1b, 0x99, 0xc7, 0x85, - 0x8f, 0x58, 0x96, 0x40, 0x57, 0x3f, 0x3f, 0x6b, 0xf5, 0x81, 0xd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7e, 0x0d, 0x06, 0xc6, 0xae, 0x39, 0x00, 0xe7, 0x94, 0x03, 0x86, 0xb6, 0xe8, 0x78, 0x00, - 0xec, 0x9f, 0x6f, 0x2e, 0xd1, 0x2f, 0x0d, 0x5c, 0x6e, 0x6a, 0xb0, 0xd7, 0x5e, 0x56, 0x54, 0x16, 0x75, 0x96, 0xbc, - 0xfb, 0xf9, 0xfa, 0xe6, 0xe4, 0xf1, 0x4a, 0x13, 0x21, 0xca, 0x53, 0xf3, 0xbd, 0x65, 0x55, 0x4a, 0xd6, 0x90, 0x56, - 0x6a, 0xb1, 0x8e, 0x8a, 0x8e, 0xa3, 0x47, 0xfa, 0x3c, 0x67, 0x25, 0x35, 0x4e, 0x75, 0x8c, 0xee, 0x1c, 0x7d, 0xce, - 0xc6, 0xa3, 0xee, 0x47, 0x56, 0xba, 0xe6, 0x02, 0xb9, 0xe6, 0x36, 0xb9, 0xfa, 0x6b, 0xd4, 0xbf, 0x01, 0x14, 0xee, - 0xbc, 0x64, 0x9d, 0x12, 0x00, 0x00}; - -} // namespace captive_portal -} // namespace esphome diff --git a/captive-portal/README.md b/packages/captive-portal/README.md similarity index 100% rename from captive-portal/README.md rename to packages/captive-portal/README.md diff --git a/captive-portal/index.html b/packages/captive-portal/index.html similarity index 100% rename from captive-portal/index.html rename to packages/captive-portal/index.html diff --git a/captive-portal/package.json b/packages/captive-portal/package.json similarity index 79% rename from captive-portal/package.json rename to packages/captive-portal/package.json index fce694e..9cfabb0 100644 --- a/captive-portal/package.json +++ b/packages/captive-portal/package.json @@ -1,5 +1,5 @@ { - "name": "esphome-captive_portal", + "name": "@esphome-webserver/captive-portal", "version": "2.0.0", "main": "main.ts", "license": "MIT", @@ -8,7 +8,7 @@ "dev": "vite", "build": "vite build && npm run deploy", "serve": "vite preview", - "deploy": "bash -c '../scripts/make_header.sh dist captive_index.h captive_portal'" + "deploy": "bash -c '../../scripts/make_header.sh ../../_static/captive_portal captive_index.h captive_portal'" }, "dependencies": { "rollup-plugin-generate-html-template": "^1.7.0", diff --git a/captive-portal/public/config.json b/packages/captive-portal/public/config.json similarity index 100% rename from captive-portal/public/config.json rename to packages/captive-portal/public/config.json diff --git a/captive-portal/src/icon/lock.svg b/packages/captive-portal/src/icon/lock.svg similarity index 100% rename from captive-portal/src/icon/lock.svg rename to packages/captive-portal/src/icon/lock.svg diff --git a/captive-portal/src/icon/wifi.svg b/packages/captive-portal/src/icon/wifi.svg similarity index 100% rename from captive-portal/src/icon/wifi.svg rename to packages/captive-portal/src/icon/wifi.svg diff --git a/captive-portal/src/main.ts b/packages/captive-portal/src/main.ts similarity index 100% rename from captive-portal/src/main.ts rename to packages/captive-portal/src/main.ts diff --git a/captive-portal/src/stylesheet.css b/packages/captive-portal/src/stylesheet.css similarity index 100% rename from captive-portal/src/stylesheet.css rename to packages/captive-portal/src/stylesheet.css diff --git a/captive-portal/vite.config.ts b/packages/captive-portal/vite.config.ts similarity index 75% rename from captive-portal/vite.config.ts rename to packages/captive-portal/vite.config.ts index 6719e3d..642ec99 100644 --- a/captive-portal/vite.config.ts +++ b/packages/captive-portal/vite.config.ts @@ -1,6 +1,6 @@ import { defineConfig } from "vite"; import gzipPlugin from "rollup-plugin-gzip"; -import { viteSingleFile } from 'vite-plugin-singlefile' +import { viteSingleFile } from "vite-plugin-singlefile"; import minifyHTML from "rollup-plugin-minify-html-template-literals"; import { minifyHtml as ViteMinifyHtml } from "vite-plugin-html"; @@ -13,19 +13,19 @@ export default defineConfig({ ViteMinifyHtml(), { ...gzipPlugin({ filter: /\.(html)$/ }), - enforce: "post", - apply: "build", - }, + enforce: "post", + apply: "build", + }, ], css: { - postcss: { - }, -}, + postcss: {}, + }, build: { brotliSize: false, cssCodeSplit: false, + outDir: "../../_static/captive_portal", assetsInlineLimit: 100000000, - polyfillModulePreload: false + polyfillModulePreload: false, }, server: { open: "/", // auto open browser From 422ef35aa6e88193bbf6d6c767cdbf6ef4fc37ae Mon Sep 17 00:00:00 2001 From: Peter Zich Date: Wed, 17 Apr 2024 20:05:11 -0700 Subject: [PATCH 5/6] Add version check to make_header.sh (#73) --- packages/v2/package.json | 2 +- packages/v3/package.json | 2 +- scripts/make_header.sh | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/v2/package.json b/packages/v2/package.json index 2e28b8e..9d7408d 100644 --- a/packages/v2/package.json +++ b/packages/v2/package.json @@ -7,7 +7,7 @@ "xbuild": "vite build --emptyOutDir", "build": "vite build --emptyOutDir && npm run deploy", "serve": "vite preview", - "deploy": "bash -c '../../scripts/make_header.sh ../../_static/v2 server_index.h web_server'" + "deploy": "bash -c '../../scripts/make_header.sh ../../_static/v2 server_index_v2.h web_server 2'" }, "dependencies": { "http-proxy-middleware": "^2.0.1", diff --git a/packages/v3/package.json b/packages/v3/package.json index e42a213..05b92bf 100644 --- a/packages/v3/package.json +++ b/packages/v3/package.json @@ -7,7 +7,7 @@ "xbuild": "vite build --emptyOutDir", "build": "vite build --emptyOutDir && npm run deploy", "serve": "vite preview", - "deploy": "bash -c '../../scripts/make_header.sh ../../_static/v3 server_index.h web_server'" + "deploy": "bash -c '../../scripts/make_header.sh ../../_static/v3 server_index_v3.h web_server 3'" }, "dependencies": { "chart.js": "^4.4.1", diff --git a/scripts/make_header.sh b/scripts/make_header.sh index 4d92c7b..b88d28e 100755 --- a/scripts/make_header.sh +++ b/scripts/make_header.sh @@ -2,6 +2,7 @@ cat <./$1/$2 #pragma once // Generated from https://github.com/esphome/esphome-webserver +$(if [ -n "$4" ]; then echo "#if USE_WEBSERVER_VERSION == $4"; fi) #include "esphome/core/hal.h" namespace esphome { @@ -14,4 +15,5 @@ cat <>./$1/$2 } // namespace $3 } // namespace esphome +$(if [ -n "$4" ]; then echo "#endif"; fi) EOT From 60e7a92e1d1f9754a6a73c979434414feff927c0 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Thu, 18 Apr 2024 16:04:39 +1200 Subject: [PATCH 6/6] Create release workflow (#78) --- .github/workflows/release.yaml | 69 ++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..b648b96 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,69 @@ +name: Release + +on: + push: + branches: + - main + +jobs: + build: + name: Build ${{ matrix.name }} + runs-on: ubuntu-latest + strategy: + matrix: + include: + - name: Captive Portal + directory: captive-portal + - name: Webserver v2 + directory: v2 + - name: Webserver v3 + directory: v3 + steps: + - name: Clone the repo + uses: actions/checkout@v4.1.1 + + - name: Set up Node.JS + uses: actions/setup-node@v4.0.2 + + - name: Install dependencies + run: npm install + + - name: Build ${{ matrix.name }} + run: npm run build + working-directory: packages/${{ matrix.directory }} + + - uses: actions/upload-artifact@v4.3.1 + with: + name: ${{ matrix.name }} + path: _static/**/*.h + + release: + name: Tag and Release + runs-on: ubuntu-latest + needs: build + steps: + # Checkout repo, create new git tag, and git release with artifacts + - name: Checkout the repo + uses: actions/checkout@v4.1.1 + + - name: Create a new tag + id: create_tag + run: echo tag=$(date +'%Y%m%d-%H%M%S') >> $GITHUB_OUTPUT + + - name: Download Artifacts + uses: actions/download-artifact@v4.1.4 + with: + path: headers + merge-multiple: true + + - name: List files + run: ls -R headers + + - name: Create a release + id: create_release + uses: softprops/action-gh-release@v2.0.4 + with: + tag_name: ${{ steps.create_tag.outputs.tag }} + name: Release ${{ steps.create_tag.outputs.tag }} + files: headers/**/*.h + generate_release_notes: true