diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..8c01268d6 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,16 @@ +FROM mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm + +RUN apt-get update \ + && export DEBIAN_FRONTEND=noninteractive \ + && apt-get install -y --no-install-recommends \ + libasound2 \ + libatk-bridge2.0-0 \ + libgbm1 \ + libgtk-3-0 \ + libinput-dev \ + libnss3 \ + libudev-dev \ + libxshmfence1 \ + xvfb \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..7e58a2435 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,44 @@ +{ + "name": "Stretchly Dev", + "build": { + "dockerfile": "Dockerfile", + "context": ".." + }, + "workspaceFolder": "/workspaces/stretchly", + "remoteUser": "node", + "updateRemoteUserUID": true, + "runArgs": [ + "--init", + "--network=host" + ], + "mounts": [ + "source=stretchly-node-modules,target=/workspaces/stretchly/node_modules,type=volume", + "source=${localEnv:HOME}/.ssh,target=/home/node/.ssh,type=bind,readonly", + "source=${localEnv:HOME}/.gitconfig,target=/home/node/.gitconfig,type=bind,readonly", + "source=${localEnv:HOME}/.npmrc,target=/home/node/.npmrc,type=bind,readonly" + ], + "features": { + "ghcr.io/devcontainers/features/git:1": {} + }, + "initializeCommand": "touch ~/.gitconfig ~/.npmrc", + "postCreateCommand": "sudo mkdir -p /workspaces/stretchly/node_modules && sudo chown -R node:node /workspaces/stretchly/node_modules && npm install && find node_modules/.bin -maxdepth 1 -type l -exec sh -c 'chmod u+x \"$(readlink -f \"$0\")\"' {} \\;", + "forwardPorts": [ + 9222 + ], + "customizations": { + "vscode": { + "extensions": [ + "dbaeumer.vscode-eslint", + "vitest.explorer" + ], + "settings": { + "eslint.validate": [ + "javascript" + ], + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit" + } + } + } + } +} diff --git a/CHANGELOG.md b/CHANGELOG.md index f5d39a071..9b0be874e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] ### Added - advanced option for Break Health Mode +- VS Code Dev Container for zero-config contributor setup ### Fixed - fix focus mode detection on macOS Tahoe diff --git a/README.md b/README.md index 5ed6699c4..298a2edf0 100644 --- a/README.md +++ b/README.md @@ -545,6 +545,29 @@ Now you can clone the repo with `git clone https://github.com/hovancik/stretchly Read on. +### Dev Container + +This repository includes a [VS Code Dev Container](https://code.visualstudio.com/docs/devcontainers/containers) in `.devcontainer/` so you can work in a consistent Linux environment without manually installing all dependencies on your host. + +To use it: +- Install [Docker](https://www.docker.com/) and the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) +- Open the repository in VS Code +- Run **Dev Containers: Reopen in Container** + +The container installs dependencies with `npm install` on first creation and includes Electron runtime libraries required for development commands and tests. + +It also maps common developer identity settings from your host: +- SSH agent forwarding (`SSH_AUTH_SOCK`) for Git over SSH without copying private keys +- Read-only mount of `~/.ssh` +- Read-only mount of `~/.gitconfig` +- Read-only mount of `~/.npmrc` + +Common commands inside the container: +- `npm run lint` +- `npm test` +- `npm run dev` +- `npm run dev:container` (use this in dev containers if Electron sandboxing is restricted) + ### Debugging You can use Stretchly's built-in debug shortcut by pressing `Ctrl/Cmd + D` in the About section to show information such as: @@ -553,7 +576,7 @@ You can use Stretchly's built-in debug shortcut by pressing `Ctrl/Cmd + D` in th You can copy debug information to the clipboard. -If you start *Stretchly* in development mode with the `npm run dev` command, it makes it possible to debug the application in your browser on `http://localhost:9222`. +If you start *Stretchly* in development mode with the `npm run dev` command (or `npm run dev:container` when running inside a dev container), it makes it possible to debug the application in your browser on `http://localhost:9222`. ### Logging @@ -655,6 +678,7 @@ You can help to translate Stretchly on [Weblate](https://hosted.weblate.org/enga - Philip Wintersteiner, [@Wikiwix](https://github.com/wikiwix) - Steven Cai, [@stevencaiOR](https://github.com/stevencaiOR) - Zhekai Jiang, [@zhekai-jiang](https://github.com/zhekai-jiang) +- Navid Malekghaini, [@navidpadid](https://github.com/navidpadid) Also see Github's list of [contributors](https://github.com/hovancik/stretchly/graphs/contributors). diff --git a/package-lock.json b/package-lock.json index 287e086d6..853745a72 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1694,9 +1694,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1714,9 +1711,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1734,9 +1728,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1754,9 +1745,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1774,9 +1762,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1794,9 +1779,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -7288,9 +7270,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -7312,9 +7291,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -7336,9 +7312,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -7360,9 +7333,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ diff --git a/package.json b/package.json index 991364ef4..69b7b492b 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "scripts": { "start": "electron .", "dev": "cross-env NODE_ENV=development electron . --trace-warnings --trace-deprecation --enable-logging --remote-debugging-port=9222", + "dev:container": "cross-env NODE_ENV=development electron . --no-sandbox --trace-warnings --trace-deprecation --enable-logging --remote-debugging-port=9223 --remote-allow-origins=*", "postinstall": "electron-builder install-app-deps", "pack": "electron-builder build --dir", "dist": "electron-builder build",