From 165a385844011b863d2a72e6fed743d82e168aac Mon Sep 17 00:00:00 2001 From: saddfox Date: Sat, 9 Nov 2024 11:44:58 +0100 Subject: [PATCH] add devcontainer --- .devcontainer/devcontainer.json | 31 ++++++++++++++++++++++++++++++ .devcontainer/postCreateCommand.sh | 18 +++++++++++++++++ .gitattributes | 3 +++ 3 files changed, 52 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100755 .devcontainer/postCreateCommand.sh create mode 100644 .gitattributes diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..b159f998 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,31 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu +{ + "name": "amsreader-devcontainer", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/base:jammy", + "features": { + "ghcr.io/devcontainers/features/node:1": { + "version": "16", + "pnpmVersion": "none", + "nvmVersion": "latest" + }, + "ghcr.io/devcontainers/features/python:1": { + "version": "3.9" + } + }, + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": ".devcontainer/postCreateCommand.sh", + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "platformio.platformio-ide", + "ms-vscode.cpptools", + "svelte.svelte-vscode" + ] + } + } +} diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh new file mode 100755 index 00000000..1b25fa1b --- /dev/null +++ b/.devcontainer/postCreateCommand.sh @@ -0,0 +1,18 @@ +#!/bin/bash +set -e + +# Upgrade pip +python -m pip install --upgrade pip + +# Install Python packages +pip install -U platformio css_html_js_minify + +# Navigate to the Svelte app directory +cd lib/SvelteUi/app + +# Install npm dependencies and build the app +npm ci +npm run build + +# Return to the previous directory +cd - \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..5dc46e6b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +* text=auto eol=lf +*.{cmd,[cC][mM][dD]} text eol=crlf +*.{bat,[bB][aA][tT]} text eol=crlf \ No newline at end of file