diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index be773f9ba8..cb654867b5 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,7 +5,7 @@ "context": ".." }, "appPort": "8124:8123", - "postCreateCommand": "sudo apt update && sudo apt upgrade -y && sudo apt install -y libpcap-dev", + "postCreateCommand": "./.devcontainer/post_create.sh", "postStartCommand": "script/bootstrap", "containerEnv": { "DEV_CONTAINER": "1", diff --git a/.devcontainer/post_create.sh b/.devcontainer/post_create.sh new file mode 100755 index 0000000000..f71a688f30 --- /dev/null +++ b/.devcontainer/post_create.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# This script will run after the container is created + +# add github cli +(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \ + && sudo mkdir -p -m 755 /etc/apt/keyrings \ + && out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \ + && cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \ + && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null + +# Update package lists +sudo apt-get update + +sudo apt upgrade -y + +# Install necessary packages +sudo apt-get install -y libpcap-dev gh + +# Display a message +echo "Post-create script has been executed successfully." \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 676e27e6d9..401f183930 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,6 +1,42 @@ { "version": "2.0.0", "tasks": [ + { + "label": "Develop and serve Frontend", + "type": "shell", + "command": "script/develop_and_serve -c ${input:coreUrl}", + // Sync changes here to other tasks until issue resolved + // https://github.com/Microsoft/vscode/issues/61497 + "problemMatcher": { + "owner": "ha-build", + "source": "ha-build", + "fileLocation": "absolute", + "severity": "error", + "pattern": [ + { + "regexp": "(SyntaxError): (.+): (.+) \\((\\d+):(\\d+)\\)", + "severity": 1, + "file": 2, + "message": 3, + "line": 4, + "column": 5 + } + ], + "background": { + "activeOnStart": true, + "beginsPattern": "Changes detected. Starting compilation", + "endsPattern": "Build done @" + } + }, + "isBackground": true, + "group": { + "kind": "build", + "isDefault": true + }, + "runOptions": { + "instanceLimit": 1 + } + }, { "label": "Develop Frontend", "type": "gulp", @@ -241,6 +277,12 @@ "id": "supervisorToken", "type": "promptString", "description": "The token for the Remote API proxy add-on" + }, + { + "id": "coreUrl", + "type": "promptString", + "description": "The URL of the Home Assistant Core instance", + "default": "http://127.0.0.1:8123" } ] }