diff --git a/.devcontainer/.gitignore b/.devcontainer/.gitignore new file mode 100644 index 000000000..1e9dcf40e --- /dev/null +++ b/.devcontainer/.gitignore @@ -0,0 +1,2 @@ +# Ignore changes to customisation files as intended to be user modifiable without pushing changes to repo +customisation diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..6d2093c4c --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,4 @@ +FROM atomlearning/devcontainer-base:latest + +### Reset user to ensure non-privileged user downstream +USER user diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..df3f8e088 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,68 @@ +{ + "name": "components", + "build": { + "dockerfile": "Dockerfile", + "options": ["--pull"], + "args": { + "INSTALL_JS_STACK": "yes", + "JS_STACK_N_VERSION": "v9.2.0", + "JS_STACK_NODE_VERSION": "20.11" + } + }, + + "forwardPorts": [], + "portsAttributes": {}, + "runArgs": ["--add-host=kubernetes:host-gateway"], + + "remoteUser": "user", + "containerUser": "root", + "updateRemoteUserUID": false, + "userEnvProbe": "loginInteractiveShell", + "containerEnv": {}, + "remoteEnv": { + "ATOM_REMOTE_DEV_IS_MK2": "yes", + // Make VS Code the default editor in terminals for convenience + "EDITOR": "code -w", + // Use our custom SSH Auth proxy for SSH key forwarding e.g. for commit signing + "SSH_AUTH_SOCK": "/home/user/.ssh/atom-ssh-auth-proxy/server.sock" + }, + + "workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind", + "workspaceFolder": "${localWorkspaceFolder}", + "mounts": [ + "source=/home/user/.devcontainer-state/${devcontainerId},target=/home/user/.state,type=bind", + "source=devcontainer-caches,target=/home/user/.cache,type=volume", + "source=/home/user/.config/git,target=/home/user/.config/git,type=bind,readonly", + "source=/etc/rancher/k3s/k3s.yaml,target=/run/secrets/rancher-k3s.yaml,type=bind,readonly", + "source=/home/user/.atom-env-info,target=/home/user/.atom-env-info,type=bind,readonly", + "source=/home/user/.ssh/atom-ssh-auth-proxy/server.sock,target=/home/user/.ssh/atom-ssh-auth-proxy/server.sock,type=bind", + "source=/home/user/.gnupg,target=/home/user/.gnupg,type=bind" + ], + "initializeCommand": "bash '${localWorkspaceFolder}/.devcontainer/scripts/init.bash' '${devcontainerId}' '${localWorkspaceFolder}'", + "postStartCommand": "/usr/local/bin/container-hooks.bash postStart '${containerWorkspaceFolder}'", + + "features": {}, + + "customizations": { + "vscode": { + "extensions": ["esbenp.prettier-vscode","EditorConfig.EditorConfig","dbaeumer.vscode-eslint",], + "settings": { + // General VS Code + "editor.formatOnSave": true, + "editor.formatOnPaste": false, + "editor.formatOnSaveMode": "file", + "dev.containers.copyGitConfig": false, + + // Exclude big, generated directories from VS Code's filewatcher to avoid it hogging file watch handles + "files.watcherExclude": { + "**/__pycache__/**": true, + "**/.cache/**": true, + "**/.venv/**": true, + "**/.yarn/unplugged/**": true, + "**/dist/**": true, + "**/node_modules/**": true + } + } + } + } +} diff --git a/.devcontainer/files/customisation.template/custom-packages.sh b/.devcontainer/files/customisation.template/custom-packages.sh new file mode 100644 index 000000000..68349a870 --- /dev/null +++ b/.devcontainer/files/customisation.template/custom-packages.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +# Use this script, which is run as root, to install any custom packages +# This should be done with extreme caution as it could easily break your environment in weird ways +# Packages should only be installed here if pretty much they only apply to you/one other user +# Other packages should be put into the main Dockerfile and under Git. +# +# Apt is the available package manager. `apt-get update` must be run before attempting any package installs +# +# Rebuild the container after making changes to this script for it to take effect + diff --git a/.devcontainer/files/customisation.template/custom.zshrc.sh b/.devcontainer/files/customisation.template/custom.zshrc.sh new file mode 100644 index 000000000..f0e201a31 --- /dev/null +++ b/.devcontainer/files/customisation.template/custom.zshrc.sh @@ -0,0 +1,9 @@ +# Add any other .zshrc scripting (e.g. aliases) +# +# .zshrc construction: +# 1. files/user-before-omz.zshrc.sh (cannot be user edited) +# 2. customisation/oh-my-zsh-settings.zshrc.sh +# 3. files/user-omz-init.zshrc.sh (cannot be user edited) +# 4. customisation/custom.zshrc.sh (you are here) +# + diff --git a/.devcontainer/files/customisation.template/oh-my-zsh-settings.zshrc.sh b/.devcontainer/files/customisation.template/oh-my-zsh-settings.zshrc.sh new file mode 100644 index 000000000..0944e6dea --- /dev/null +++ b/.devcontainer/files/customisation.template/oh-my-zsh-settings.zshrc.sh @@ -0,0 +1,67 @@ +# Edit Oh My ZSH settings here. Rebuild container after editing to take effect +# +# .zshrc construction: +# 1. files/user-before-omz.zshrc.sh (cannot be user edited) +# 2. customisation/oh-my-zsh-settings.zshrc.sh (you are here) +# 3. files/user-omz-init.zshrc.sh (cannot be user edited) +# 4. customisation/custom.zshrc.sh +# +# Based on default .zshrc from oh-my-zsh commit 9ba6daa1b5d0b60c89525d679eb30fe3ed9947de + +# Set name of the theme to load --- if set to "random", it will +# load a random theme each time Oh My Zsh is loaded, in which case, +# to know which specific one was loaded, run: echo $RANDOM_THEME +# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes +ZSH_THEME="robbyrussell" + +# Set list of themes to pick from when loading at random +# Setting this variable when ZSH_THEME=random will cause zsh to load +# a theme from this variable instead of looking in $ZSH/themes/ +# If set to an empty array, this variable will have no effect. +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) + +# Uncomment the following line to use case-sensitive completion. +# CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. +# Case-sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment the following line if pasting URLs and other text is messed up. +# DISABLE_MAGIC_FUNCTIONS="true" + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +# ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +# You can also set it to another string to have that shown instead of the default red dots. +# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" +# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) +# COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# You can set one of the optional three formats: +# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# or set a custom format using the strftime function format specifications, +# see 'man strftime' for details. +# HIST_STAMPS="mm/dd/yyyy" + +# Which plugins would you like to load? +# Standard plugins can be found in $ZSH/plugins/ +# Custom plugins may be added to $ZSH_CUSTOM/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=(git jump) + diff --git a/.devcontainer/scripts/init.bash b/.devcontainer/scripts/init.bash new file mode 100644 index 000000000..e3a5d66cb --- /dev/null +++ b/.devcontainer/scripts/init.bash @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +ID="${1}" +LOCAL_WORKSPACE="${2}" + +# This is a hack that does two things: creates the backing directory for ~/.state; and copy the customisation template into place to be available for the user to edit + +mkdir -p "/home/user/.devcontainer-state/${ID}" + +cd "${LOCAL_WORKSPACE}/.devcontainer" +if [ ! -d customisation ]; then + cp -r files/customisation.template customisation +fi diff --git a/package.json b/package.json index 4cdd87a2a..0a411b583 100644 --- a/package.json +++ b/package.json @@ -58,5 +58,6 @@ "packageManager": "yarn@4.4.0", "engines": { "node": "20.x" - } + }, + "version": "4.3.1" }