diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 46a616e..2b14363 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,12 +2,12 @@ "name": "Mini Graph Card Development", "image": "ghcr.io/ludeeus/devcontainer/generic:latest", "context": "..", - // "remoteUser": "vscode", + "remoteUser": "vscode", "appPort": [ "8123:8123", "5000:5000", ], - "postCreateCommand": "npm install && container install", + "postCreateCommand": "npm install && sudo container install", "extensions": [ "github.vscode-pull-request-github", "eamodio.gitlens", diff --git a/.vscode/launch.json b/.vscode/launch.json index 8a3bebe..d447ed0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,9 @@ "name": "Launch Chrome against localhost", "url": "http://localhost:8123", "webRoot": "${workspaceFolder}/dist", - "sourceMaps": true + "sourceMaps": true, + "preLaunchTask": "debug", + "postDebugTask": "devcontainer: stop debug" } ] } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..70cd2cd --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,76 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "npm", + "script": "watch", + "group": "test", + "label": "npm: watch", + "detail": "rollup -c --watch", + "isBackground": true, + "problemMatcher": { + "pattern": [ + { + "regexp": ".", + "file": 1, + "location": 2, + "message": 3 + } + ], + "background": { + "activeOnStart": true, + "beginsPattern": "^bundles\\s", + "endsPattern": "^.*waiting for changes\\.\\.\\." + } + } + }, + { + "type": "shell", + "label": "devcontainer: Start HA", + "command": "sh -c 'sudo --preserve-env=PATH container start'", + "problemMatcher": { + "pattern": [ + { + "regexp": ".", + "file": 1, + "location": 2, + "message": 3 + } + ], + "background": { + "activeOnStart": true, + "beginsPattern": ".", + "endsPattern": "^Start Home Assistant$" + } + }, + "group": "test", + "isBackground": true + }, + { + "label": "debug", + "group": "test", + "dependsOn": [ + "devcontainer: Start HA", + "npm: watch" + ], + "problemMatcher": [] + }, + { + "label": "devcontainer: stop debug", + "group": "test", + "command": "sh", + "presentation": { + "echo": true, + "reveal": "never", + "focus": false, + "panel": "shared", + "showReuseMessage": true, + "clear": false + }, + "args": [ + "-c", + "sudo killall hass; sudo kill $(ps au | grep 'node.*rollup' | grep -v grep | awk {'print $2'}); exit 0;", + ] + } + ] +} \ No newline at end of file