8000 feat(dev): support vscode dev-container (#1781) · Goder-0/goder-0.github.io@1e3d4a6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1e3d4a6

Browse files
authored
feat(dev): support vscode dev-container (cotes2020#1781)
1 parent 1c5fa08 commit 1e3d4a6

File tree

8 files changed

+59
-19
lines changed

8 files changed

+59
-19
lines changed

.devcontainer/devcontainer.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
"settings": {
9+
"terminal.integrated.defaultProfile.linux": "zsh",
10+
// Speed up extension installation
11+
"extensions.verifySignature": false
12+
},
13+
"extensions": [
14+
// Liquid tags auto-complete
15+
"killalau.vscode-liquid-snippets",
16+
// Liquid syntax highlighting and formatting
17+
"Shopify.theme-check-vscode",
18+
// Shell
19+
"timonwong.shellcheck",
20+
"mkhl.shfmt",
21+
// Common formatter
22+
"EditorConfig.EditorConfig",
23+
"esbenp.prettier-vscode",
24+
"stylelint.vscode-stylelint",
25+
"yzhang.markdown-all-in-one",
26+
// Git
27+
"mhutchie.git-graph"
28+
]
29+
}
30+
}
31+
}

.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+
if [ -f package.json ]; then
4+
bash -i -c "nvm install --lts && nvm install-latest-npm"
5+
npm i
6+
npm run build
7+
fi
8+
9+
# Install dependencies for shfmt extension
10+
curl -sS https://webi.sh/shfmt | sh &>/dev/null

.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: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
11
{
2-
"recommendations": [
3-
// Liquid tags auto-complete
4-
"killalau.vscode-liquid-snippets",
5-
// Liquid syntax highlighting and formatting
6-
"Shopify.theme-check-vscode",
7-
// Common formatter
8-
"esbenp.prettier-vscode",
9-
"foxundermoon.shell-format",
10-
"stylelint.vscode-stylelint",
11-
"yzhang.markdown-all-in-one"
12-
]
2+
"recommendations": ["ms-vscode-remote.remote-containers"]
133
}

.vscode/settings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
"editor.defaultFormatter": "Shopify.theme-check-vscode"
1616
},
1717
"[shellscript]": {
18-
"editor.defaultFormatter": "foxundermoon.shell-format"
18+
"editor.defaultFormatter": "mkhl.shfmt"
1919
},
2020
// Disable vscode built-in stylelint
2121
"css.validate": false,
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
}

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
A minimal, responsive, and feature-rich Jekyll theme for technical writing.
88

9-
[![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?color=brightgreen)][gem] 
10-
[![CI](https://github.com/cotes2020/jekyll-theme-chirpy/actions/workflows/ci.yml/badge.svg?branch=master&event=push)][ci] 
9+
[![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?&logo=RubyGems&logoColor=gainsboro&label=gem&color=brightgreen)][gem] 
10+
[![CI](https://img.shields.io/github/actions/workflow/status/cotes2020/jekyll-theme-chirpy/ci.yml?logo=github&logoColor=gainsboro)][ci] 
1111
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/4e556876a3c54d5e8f2d2857c4f43894)][codacy] 
12-
[![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg)][license] 
13-
[![996.icu](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg)](https://996.icu)
12+
[![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy)][license] 
13+
[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&logo=visualstudiocode&logoColor=gainsboro&message=Open&color=deepskyblue)][open-container]
1414

1515
[**Live Demo**][demo]
1616

@@ -72,6 +72,7 @@ This project is published under [MIT License][license].
7272
[ci]: https://github.com/cotes2020/jekyll-theme-chirpy/actions/workflows/ci.yml?query=event%3Apush+branch%3Amaster
7373
[codacy]: https://app.codacy.com/gh/cotes2020/jekyll-theme-chirpy/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade
7474
[license]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE
75+
[open-container]: https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/cotes2020/jekyll-theme-chirpy
7576
[jekyllrb]: https://jekyllrb.com/
7677
[clipartmax]: https://www.clipartmax.com/middle/m2i8b1m2K9Z5m2K9_ant-clipart-childrens-ant-cute/
7778
[demo]: https://cotes2020.github.io/chirpy-demo/

tools/run.sh

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

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

0 commit comments

Comments
 (0)
0