Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we make it use .nvmrc version? so I don't have to remember update this. Each Electron version is with specific node version so best to keep it in sync.


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/*
44 changes: 44 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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\")\"' {} \\;",
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this doing?

"forwardPorts": [
9222
],
"customizations": {
"vscode": {
"extensions": [
"dbaeumer.vscode-eslint",
"vitest.explorer"
],
"settings": {
"eslint.validate": [
"javascript"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}
}
}
}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand Down Expand Up @@ -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).

Expand Down
30 changes: 0 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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=*",
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--remote-allow-origins=* is broad; --remote-allow-origins=http://localhost:9223 would be safer?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, is there reason to use 9223?

"postinstall": "electron-builder install-app-deps",
"pack": "electron-builder build --dir",
"dist": "electron-builder build",
Expand Down
Loading