Skip to content

Commit add1a53

Browse files
committed
feat(dev): support vscode devcontainer
1 parent 1c5fa08 commit add1a53

File tree

7 files changed

+47
-4
lines changed

7 files changed

+47
-4
lines changed

.devcontainer/devcontainer.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "Jekyll",
3+
"image": "mcr.microsoft.com/devcontainers/jekyll:2-bullseye",
4+
"onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
5+
"postCreateCommand": "bash .devcontainer/post-create.sh",
6+
"customizations": {
7+
"vscode": {
8+
"extensions": [
9+
"EditorConfig.EditorConfig",
10+
"esbenp.prettier-vscode",
11+
"foxundermoon.shell-format",
12+
"killalau.vscode-liquid-snippets",
13+
"mhutchie.git-graph",
14+
"Shopify.theme-check-vscode",
15+
"stylelint.vscode-stylelint",
16+
"yzhang.markdown-all-in-one"
17+
]
18+
}
19+
}
20+
}

.devcontainer/post-create.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
npm_buid() {
4+
bash -i -c "nvm install --lts"
5+
npm i && npm run build
6+
}
7+
8+
[[ -d _sass/dist && -d assets/js/dist ]] || npm_buid
9+
10+
exec zsh

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ updates:
2323
- "major"
2424
schedule:
2525
interval: "weekly"
26+
- package-ecosystem: "devcontainers"
27+
directory: "/"
28+
schedule:
29+
interval: weekly

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ package-lock.json
1717

1818
# IDE configurations
1919
.idea
20-
.vscode
20+
.vscode/*
2121
!.vscode/settings.json
2222
!.vscode/extensions.json
2323

.vscode/extensions.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
// Liquid syntax highlighting and formatting
66
"Shopify.theme-check-vscode",
77
// Common formatter
8+
"EditorConfig.EditorConfig",
89
"esbenp.prettier-vscode",
910
"foxundermoon.shell-format",
1011
"stylelint.vscode-stylelint",
11-
"yzhang.markdown-all-in-one"
12+
"yzhang.markdown-all-in-one",
13+
// DevContainer
14+
"ms-vscode-remote.remote-containers"
1215
]
1316
}

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
"scss.validate": false,
2323
"less.validate": false,
2424
// Stylint extension settings
25-
"stylelint.snippet": ["css", "less", "postcss", "scss"],
26-
"stylelint.validate": ["css", "less", "postcss", "scss"]
25+
"stylelint.snippet": ["css", "scss"],
26+
"stylelint.validate": ["css", "scss"]
2727
}

tools/run.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,11 @@ if $prod; then
4646
command="JEKYLL_ENV=production $command"
4747
fi
4848

49+
if [ -e /proc/1/cgroup ]; then
50+
if grep -q docker /proc/1/cgroup; then
51+
command="$command --force_polling"
52+
fi
53+
fi
54+
4955
echo -e "\n> $command\n"
5056
eval "$command"

0 commit comments

Comments
 (0)