-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Enhance dev container #2226
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
Closed
Closed
Enhance dev container #2226
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,28 +1,69 @@ | ||||||||||||||||||
| { | ||||||||||||||||||
| "name": "Jekyll", | ||||||||||||||||||
| "image": "mcr.microsoft.com/devcontainers/jekyll:2-bullseye", | ||||||||||||||||||
| "onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", | ||||||||||||||||||
| "postCreateCommand": "bash .devcontainer/post-create.sh", | ||||||||||||||||||
|
|
||||||||||||||||||
| // Command to set Git configuration upon container creation | ||||||||||||||||||
| "onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder} && git config --global user.name 'Your Name' && git config --global user.email '[email protected]'", | ||||||||||||||||||
|
|
||||||||||||||||||
| // Command to execute after the container is created | ||||||||||||||||||
| "postCreateCommand": "bash .devcontainer/post-create.sh && gem install jekyll bundler", | ||||||||||||||||||
|
|
||||||||||||||||||
| // Customizing VSCode settings for a better developer experience | ||||||||||||||||||
| "customizations": { | ||||||||||||||||||
| "vscode": { | ||||||||||||||||||
| "settings": { | ||||||||||||||||||
| "terminal.integrated.defaultProfile.linux": "zsh" | ||||||||||||||||||
| // Set the default terminal profile to Zsh for better shell experience | ||||||||||||||||||
| "terminal.integrated.defaultProfile.linux": "zsh", | ||||||||||||||||||
|
|
||||||||||||||||||
| // Enable auto-save of files when the window focus changes | ||||||||||||||||||
| "files.autoSave": "onWindowChange", | ||||||||||||||||||
|
|
||||||||||||||||||
| // Enable auto-format on save for consistent code formatting | ||||||||||||||||||
| "editor.formatOnSave": true, | ||||||||||||||||||
|
|
||||||||||||||||||
| // Use Dark theme for the VSCode editor | ||||||||||||||||||
| "workbench.colorTheme": "Dark+ (default dark)", | ||||||||||||||||||
|
|
||||||||||||||||||
| // Ruby path for proper integration with Ruby-based tools | ||||||||||||||||||
| "ruby.rubyPath": "/usr/local/bin/ruby" | ||||||||||||||||||
| }, | ||||||||||||||||||
|
|
||||||||||||||||||
| "extensions": [ | ||||||||||||||||||
| // Liquid tags auto-complete | ||||||||||||||||||
| // Liquid tags auto-completion for Jekyll theme development | ||||||||||||||||||
| "killalau.vscode-liquid-snippets", | ||||||||||||||||||
| // Liquid syntax highlighting and formatting | ||||||||||||||||||
|
|
||||||||||||||||||
| // Shopify theme check for liquid file validation in Jekyll | ||||||||||||||||||
| "Shopify.theme-check-vscode", | ||||||||||||||||||
| // Shell | ||||||||||||||||||
|
|
||||||||||||||||||
| // Shell script linting to improve shell script quality | ||||||||||||||||||
| "timonwong.shellcheck", | ||||||||||||||||||
|
|
||||||||||||||||||
| // Shell formatting for better readability of shell scripts | ||||||||||||||||||
| "mkhl.shfmt", | ||||||||||||||||||
| // Common formatter | ||||||||||||||||||
|
|
||||||||||||||||||
| // Ensures consistent editor configuration across different environments | ||||||||||||||||||
| "EditorConfig.EditorConfig", | ||||||||||||||||||
|
|
||||||||||||||||||
| // Prettier extension for code formatting (JavaScript, CSS, HTML) | ||||||||||||||||||
| "esbenp.prettier-vscode", | ||||||||||||||||||
|
|
||||||||||||||||||
| // Linting for CSS/SCSS to enforce style guidelines | ||||||||||||||||||
| "stylelint.vscode-stylelint", | ||||||||||||||||||
|
|
||||||||||||||||||
| // Markdown support with enhanced features such as TOC and preview | ||||||||||||||||||
| "yzhang.markdown-all-in-one", | ||||||||||||||||||
| // Git | ||||||||||||||||||
| "mhutchie.git-graph" | ||||||||||||||||||
|
|
||||||||||||||||||
| // Git graph extension for easy visualization of Git commits and branches | ||||||||||||||||||
| "mhutchie.git-graph", | ||||||||||||||||||
|
|
||||||||||||||||||
| // Ruby syntax, linting, and formatting support for Jekyll development | ||||||||||||||||||
| "rebornix.ruby", | ||||||||||||||||||
|
|
||||||||||||||||||
| // YAML syntax support for better editing of _config.yml files | ||||||||||||||||||
| "redhat.vscode-yaml", | ||||||||||||||||||
|
|
||||||||||||||||||
| // Enhanced Git functionality with GitLens for better repository insights | ||||||||||||||||||
| "eamodio.gitlens" | ||||||||||||||||||
| ] | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe these extensions could be a great addition to the config that's been updated. I find these tools helpful to me while writing blogs, from an end user perspective.
Suggested change
|
||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,59 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # Ensure nvm is sourced in this script | ||
| export NVM_DIR="/usr/local/share/nvm" | ||
| [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | ||
| [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads bash_completion for nvm | ||
|
|
||
| # Check if package.json exists, indicating a Node.js project | ||
| if [ -f package.json ]; then | ||
| bash -i -c "nvm install --lts && nvm install-latest-npm" | ||
| npm i | ||
| # Install Node.js LTS version if not already installed | ||
| if ! nvm ls | grep -q "v16.0.0"; then | ||
| echo "Installing Node.js LTS..." | ||
| nvm install --lts | ||
| fi | ||
| # Install the latest npm version | ||
| nvm install-latest-npm | ||
| # Install project dependencies | ||
| npm install | ||
| # Run the build script | ||
| npm run build | ||
| fi | ||
|
|
||
| # Install dependencies for shfmt extension | ||
| curl -sS https://webi.sh/shfmt | sh &>/dev/null | ||
| # Install shfmt for shell script formatting if not already installed | ||
| echo "Installing shfmt..." | ||
| if ! command -v shfmt &>/dev/null; then | ||
| curl -sS https://webi.sh/shfmt | sh -s -- --force &>/dev/null | ||
| fi | ||
|
|
||
| # Install Oh My Zsh if not already installed | ||
| if [ ! -d "$HOME/.oh-my-zsh" ]; then | ||
| echo "Installing Oh My Zsh..." | ||
| sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended | ||
| fi | ||
|
|
||
| # Function to install Zsh plugins if missing | ||
| install_zsh_plugin() { | ||
| local plugin_url=$1 | ||
| local plugin_name=$2 | ||
| if [ ! -d "$OMZ_CUSTOM/$plugin_name" ]; then | ||
| echo "Installing plugin: $plugin_name" | ||
| git clone "$plugin_url" "$OMZ_CUSTOM/$plugin_name" | ||
| fi | ||
| } | ||
|
|
||
| # Define OMZ plugins directory | ||
| OMZ_CUSTOM="$HOME/.oh-my-zsh/custom/plugins" | ||
| mkdir -p "$OMZ_CUSTOM" | ||
|
|
||
| # Install Zsh plugins if missing | ||
| install_zsh_plugin "https://github.com/zsh-users/zsh-syntax-highlighting.git" "zsh-syntax-highlighting" | ||
| install_zsh_plugin "https://github.com/zsh-users/zsh-autosuggestions" "zsh-autosuggestions" | ||
|
|
||
| # Add OMZ plugins | ||
| git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting | ||
| git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions | ||
| # Update ~/.zshrc to enable the plugins | ||
| echo "Enabling Zsh plugins in ~/.zshrc..." | ||
| sed -i -E "s/^(plugins=\()(git)(\))/\1\2 zsh-syntax-highlighting zsh-autosuggestions\3/" ~/.zshrc | ||
|
|
||
| # Avoid git log use less | ||
| echo -e "\nunset LESS" >>~/.zshrc | ||
| # Prevent git log from using less | ||
| echo "Disabling 'less' for git log..." | ||
| grep -qxF "unset LESS" ~/.zshrc || echo "unset LESS" >>~/.zshrc |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're considering adding the previously mentioned changes, it might be better to add this config too... Using the public API enabled the
Language-Toolextension to work properly.