Skip to content

Add Dev Container configuration #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
28 changes: 28 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/jekyll
{
"name": "Jekyll",
"image": "mcr.microsoft.com/devcontainers/jekyll:2-bookworm",
"features": {
"ghcr.io/devcontainers/features/node:1": {}
},
"forwardPorts": [4000],
"containerEnv": {
"WX_SITE_DIR": "${containerWorkspaceFolder}"
},
"postCreateCommand": {
"bootstrap": "./.devcontainer/postCreateCommand.sh",
"assets": "yarn && yarn dist",
"jekyll": "bundle exec jekyll serve"
},
"customizations": {
"vscode": {
"settings": {
"files.eol": "\n"
},
"extensions": [
"shopify.ruby-lsp"
]
}
}
}
11 changes: 11 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -ex

ruby update_release_info.rb
ruby _cron/update_download_stats.rb

git clone --depth=1 https://github.com/wxWidgets/wxWidgets.git

_cron/update_wxxrc_schema.sh
_cron/update_translation_stats.sh
1 change: 1 addition & 0 deletions .gitattributes
Copy link
Contributor

Choose a reason for hiding this comment

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

I would omit this file: we don't have any .cmd/.bat files and I don't like using text=auto. So unless we really need it, let's just use the EOLs of the files in the repository which should already be LF.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added this mainly for at least the * text=auto eol=lf part, since I ran into issues with git running inside of VS Code codespace terminals running on local Windows converting everything to CRLF for some reason.

I think it might have something to do with Dev Container support for inheriting various local environment settings into the container environments, though I'm not sure.

In any case, I want that first line at least to help prevent PRs being created that perform those conversions, even if git is configured incorrectly on the client side.

I'm fine removing the bat/cmd lines though. You're right, I doubt we ever add those to this repo.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess it should also fix the issue with just * eol=lf alone, without text=auto. I'll try just that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, doesn't work without text=auto. This results in changes to binary files.

Copy link
Contributor

Choose a reason for hiding this comment

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

Are they really converting all files by default?? This would seem to be an incredibly stupid thing to do, so I can't quite believe it, but why else would this happen?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think it's explicitly converting them. I just think it's probably checking out files as CRLF due to inheriting some local environment settings from the Windows host into the Dev Container, but then maybe new terminals or some operations don't also get those, and think the file is modified?

I'm not really certain the cause, but I believe adding this ensures that it does check out files as LF on all Windows environments as well, thus avoiding the issue entirely.

I originally found this approach from a VS Code FAQ covering Dev Containers. It seems like this is a common issue that comes up.

Copy link
Member Author

@tierra tierra Nov 26, 2023

Choose a reason for hiding this comment

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

I have actually struggled with this in the past when using my GitHub Desktop clone of the website repo on Windows for what it's worth, and I imagine this would fix that as well.

How do you normally work on this repo out of curiosity?

Copy link
Contributor

Choose a reason for hiding this comment

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

I know that this is a common issue but I think it only happens when people enable auto conversion when installing Git, i.e. enable it in the global gitconfig. I never do this (and think it's a huge mistake to do it), but if this is indeed the case, then I guess this is the right thing to do.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/_site/
/node_modules/
/vendor
/wxWidgets/
*.log

# Compiled Assets
Expand All @@ -19,3 +20,7 @@
# Download stats files
/_data/release_assets/*.json
/downloads/downloads.json

# XRC Schemas copied from wxWidgets repo
/schemas/xrc_schema_builtin_only.rnc
/schemas/xrc_schema.rnc