Skip to content

Commit

Permalink
feat(dev): support vscode devcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
cotes2020 committed May 31, 2024
1 parent 1c5fa08 commit add1a53
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 4 deletions.
20 changes: 20 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "Jekyll",
"image": "mcr.microsoft.com/devcontainers/jekyll:2-bullseye",
"onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
"postCreateCommand": "bash .devcontainer/post-create.sh",
"customizations": {
"vscode": {
"extensions": [
"EditorConfig.EditorConfig",
"esbenp.prettier-vscode",
"foxundermoon.shell-format",
"killalau.vscode-liquid-snippets",
"mhutchie.git-graph",
"Shopify.theme-check-vscode",
"stylelint.vscode-stylelint",
"yzhang.markdown-all-in-one"
]
}
}
}
10 changes: 10 additions & 0 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

npm_buid() {
bash -i -c "nvm install --lts"
npm i && npm run build
}

[[ -d _sass/dist && -d assets/js/dist ]] || npm_buid

exec zsh
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ updates:
- "major"
schedule:
interval: "weekly"
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package-lock.json

# IDE configurations
.idea
.vscode
.vscode/*
!.vscode/settings.json
!.vscode/extensions.json

Expand Down
5 changes: 4 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
// Liquid syntax highlighting and formatting
"Shopify.theme-check-vscode",
// Common formatter
"EditorConfig.EditorConfig",
"esbenp.prettier-vscode",
"foxundermoon.shell-format",
"stylelint.vscode-stylelint",
"yzhang.markdown-all-in-one"
"yzhang.markdown-all-in-one",
// DevContainer
"ms-vscode-remote.remote-containers"
]
}
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
"scss.validate": false,
"less.validate": false,
// Stylint extension settings
"stylelint.snippet": ["css", "less", "postcss", "scss"],
"stylelint.validate": ["css", "less", "postcss", "scss"]
"stylelint.snippet": ["css", "scss"],
"stylelint.validate": ["css", "scss"]
}
6 changes: 6 additions & 0 deletions tools/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,11 @@ if $prod; then
command="JEKYLL_ENV=production $command"
fi

if [ -e /proc/1/cgroup ]; then
if grep -q docker /proc/1/cgroup; then
command="$command --force_polling"
fi
fi

echo -e "\n> $command\n"
eval "$command"

0 comments on commit add1a53

Please sign in to comment.