-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
4970c67
commit 2186606
Showing
80 changed files
with
27,349 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY | ||
_commit: 51bb1ef | ||
_src_path: ./ | ||
accountname: quickplates | ||
appname: next-example | ||
description: Next.js app example ⚫ | ||
docs: true | ||
docsurl: https://quickplates.github.io/next-example | ||
envprefix: NEXT_EXAMPLE | ||
imagename: apps/next-example | ||
port: 3000 | ||
registry: true | ||
releases: true | ||
reponame: next-example | ||
repourl: https://github.com/quickplates/next-example |
This file contains 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 |
---|---|---|
@@ -0,0 +1,112 @@ | ||
{ | ||
// Build the base image | ||
"build": { | ||
// Docker context to use, relative to this file | ||
"context": "image/", | ||
// Dockerfile to use, relative to this file | ||
"dockerfile": "image/Dockerfile", | ||
// Build options | ||
"options": [ | ||
// Use host network | ||
"--network=host" | ||
] | ||
}, | ||
// Tool-specific settings | ||
"customizations": { | ||
// VS Code settings | ||
"vscode": { | ||
// Extensions to install | ||
"extensions": [ | ||
// Nix | ||
"jnoortheen.nix-ide", | ||
// Direnv | ||
"mkhl.direnv", | ||
// Task | ||
"task.vscode-task", | ||
// Trunk | ||
"Trunk.io" | ||
], | ||
// Settings to override | ||
"settings": { | ||
// Set Trunk as the default formatter | ||
"editor.defaultFormatter": "trunk.io", | ||
// Use LSP for Nix | ||
"nix.enableLanguageServer": true, | ||
// Use nil as the language server | ||
"nix.serverPath": "nil", | ||
"nix.serverSettings": { | ||
"nil": { | ||
"formatting": { | ||
// Use 'nix fmt' for formatting | ||
"command": ["nix", "fmt", "--", "-"] | ||
} | ||
} | ||
}, | ||
// Don't forward ports automatically | ||
"remote.autoForwardPorts": false, | ||
// Use Nix IDE instead of Trunk for Nix files | ||
"[nix]": { | ||
"editor.defaultFormatter": "jnoortheen.nix-ide" | ||
} | ||
} | ||
} | ||
}, | ||
// Extra features to install to the container | ||
"features": { | ||
// Install Nix | ||
"ghcr.io/devcontainers/features/nix:1.2.0": { | ||
// Enable experimental features | ||
"extraNixConfig": "experimental-features = nix-command flakes", | ||
"version": "2.20.5" | ||
}, | ||
// Install Direnv | ||
"ghcr.io/devcontainers-contrib/features/direnv:1.0.2": { | ||
"version": "2.34.0" | ||
}, | ||
// Enable using Docker from within the container | ||
"ghcr.io/devcontainers/features/docker-in-docker:2.10.1": { | ||
"version": "24.0.8", | ||
// Use Docker Compose v2 | ||
"dockerDashComposeVersion": "v2" | ||
}, | ||
// Install Starship | ||
"ghcr.io/devcontainers-contrib/features/starship:1.0.9": { | ||
"version": "1.17.1" | ||
} | ||
}, | ||
// Volumes | ||
"mounts": [ | ||
// Mount secrets (shared) | ||
"source=devcontainer-shared-secrets,target=/secrets/,type=volume", | ||
// Mount nix store (not shared) | ||
"source=devcontainer-${devcontainerId}-nix,target=/nix/,type=volume", | ||
// Mount shell history (not shared) | ||
"source=devcontainer-${devcontainerId}-shellhistory-persist,target=/persist/shellhistory/,type=volume", | ||
// Mount trunk cache (shared) | ||
"source=devcontainer-shared-trunk-cache,target=/cache/trunk/,type=volume", | ||
// Mount npm cache (shared) | ||
"source=devcontainer-shared-npm-cache,target=/cache/npm/,type=volume" | ||
], | ||
// Run a command when the container is created | ||
"onCreateCommand": "/hooks/create.sh", | ||
// Environment variables | ||
"remoteEnv": { | ||
// Set workspace path | ||
"WORKSPACE": "${containerWorkspaceFolder}" | ||
}, | ||
// Run arguments | ||
"runArgs": [ | ||
// Use host UTS namespace | ||
"--uts=host", | ||
// Use host IPC | ||
"--ipc=host", | ||
// Use host network | ||
"--network=host", | ||
// Use host user namespace | ||
"--userns=host", | ||
// Use host cgroup namespace | ||
"--cgroupns=host", | ||
// Run with elevated privileges | ||
"--privileged" | ||
] | ||
} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Using one of the offical dev container images as base | ||
# Going with Ubuntu, because it has glibc, which some tools might need | ||
# It also has git, zsh and a bunch of other stuff preinstalled | ||
# Also, it includes a non-root 'vscode' user with sudo access | ||
# The version is pinned to ensure reproducibility | ||
FROM mcr.microsoft.com/devcontainers/base:1.0.22-ubuntu-22.04 | ||
|
||
ENV REMOTE_USER=vscode | ||
|
||
# Setup script | ||
COPY setup.sh /tmp/setup.sh | ||
|
||
RUN /tmp/setup.sh && \ | ||
rm /tmp/setup.sh | ||
|
||
# Lifecycle hooks | ||
COPY hooks/ /hooks/ |
This file contains 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Create shell history cache files if they don't exist for some reason | ||
touch /persist/shellhistory/.bash_history | ||
touch /persist/shellhistory/.zsh_history | ||
|
||
# Use GitHub token secret if it exists | ||
if [[ -s /secrets/.ghtoken && -r /secrets/.ghtoken ]]; then | ||
token="$(cat /secrets/.ghtoken)" | ||
confighome="${XDG_CONFIG_HOME:-${HOME}/.config/}" | ||
|
||
# Add GitHub token to Nix config | ||
configfile="${confighome}/nix/nix.conf" | ||
tmpfile="$(mktemp)" | ||
|
||
mkdir --parents "$(dirname "${configfile}")" | ||
touch "${configfile}" | ||
|
||
if grep --quiet extra-access-tokens "${configfile}"; then | ||
sed "s|extra-access-tokens.*|extra-access-tokens = github.com=${token}|" "${configfile}" >"${tmpfile}" | ||
cat "${tmpfile}" >"${configfile}" | ||
rm "${tmpfile}" | ||
else | ||
echo "extra-access-tokens = github.com=${token}" >>"${configfile}" | ||
fi | ||
fi |
This file contains 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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/usr/bin/env bash | ||
|
||
REMOTE_USER="${REMOTE_USER:?}" | ||
REMOTE_USER_PASSWD="$(getent passwd "${REMOTE_USER}")" | ||
REMOTE_USER_HOME="$(echo "${REMOTE_USER_PASSWD}" | cut --delimiter ':' --fields 6)" | ||
|
||
# Setup default shell | ||
chsh --shell /usr/bin/zsh "${REMOTE_USER}" | ||
|
||
# Setup direnv | ||
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc" | ||
eval "\$(direnv hook bash)" | ||
EOF | ||
|
||
cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc" | ||
eval "\$(direnv hook zsh)" | ||
EOF | ||
|
||
# Setup starship | ||
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc" | ||
eval "\$(starship init bash)" | ||
EOF | ||
|
||
cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc" | ||
eval "\$(starship init zsh)" | ||
EOF | ||
|
||
# Setup secrets directory | ||
mkdir --parents /secrets/ | ||
|
||
chown --recursive "${REMOTE_USER}:" /secrets/ | ||
|
||
# Setup shell history cache | ||
mkdir --parents /persist/shellhistory/ | ||
|
||
touch /persist/shellhistory/.bash_history | ||
touch /persist/shellhistory/.zsh_history | ||
|
||
chown --recursive "${REMOTE_USER}:" /persist/shellhistory/ | ||
|
||
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc" | ||
export HISTFILE=/persist/shellhistory/.bash_history | ||
EOF | ||
|
||
cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc" | ||
export HISTFILE=/persist/shellhistory/.zsh_history | ||
EOF | ||
|
||
# Setup trunk cache | ||
mkdir --parents /cache/trunk/ | ||
|
||
chown --recursive "${REMOTE_USER}:" /cache/trunk/ | ||
|
||
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc" | ||
export TRUNK_CACHE=/cache/trunk/ | ||
EOF | ||
|
||
cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc" | ||
export TRUNK_CACHE=/cache/trunk/ | ||
EOF | ||
|
||
# Setup npm cache | ||
mkdir --parents /cache/npm/ | ||
|
||
chown --recursive "${REMOTE_USER}:" /cache/npm/ | ||
|
||
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc" | ||
export NPM_CONFIG_CACHE=/cache/npm/ | ||
EOF | ||
|
||
cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc" | ||
export NPM_CONFIG_CACHE=/cache/npm/ | ||
EOF |
This file contains 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#Task | ||
/.task/ | ||
/Taskfile.yaml | ||
/Taskfile.yml | ||
|
||
# Misc | ||
.DS_Store | ||
.todo | ||
|
||
# Dependencies | ||
/node_modules/ | ||
|
||
# Build | ||
/build/ | ||
|
||
# Debug | ||
npm-debug.log* | ||
|
||
# Typescript | ||
*.tsbuildinfo | ||
|
||
# Next.js | ||
next-env.d.ts | ||
|
||
# Tracked, but not needed | ||
/.devcontainer/ | ||
/.github/ | ||
/.trunk/ | ||
/.vscode/ | ||
/docs/ | ||
/.copier-answers.yaml | ||
/.dockerignore | ||
/.envrc | ||
/.gitattributes | ||
/.gitignore | ||
/CONTRIBUTING.md | ||
/docker-compose.yaml | ||
/Dockerfile | ||
/LICENSE | ||
/README.md | ||
/Taskfile.dist.yaml |
This file contains 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
# reload when these files change | ||
watch_file flake.lock ./*.nix package.json package-lock.json Taskfile.dist.yaml {taskfile,Taskfile}.{yaml,yml} | ||
|
||
# activate the default development shell in the current shell | ||
# --accept-flake-config will accept the nix configuration from the flake without prompting | ||
eval "$(nix print-dev-env path:./ --accept-flake-config)" || true |
This file contains 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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module.exports = { | ||
env: { | ||
// Set ES2022 environment | ||
es2022: true, | ||
}, | ||
|
||
extends: [ | ||
// Use Next.js core web vitals rules | ||
"next/core-web-vitals", | ||
|
||
// Use recommended eslint rules | ||
"eslint:recommended", | ||
|
||
// Use recommended typescript-eslint rules | ||
"plugin:@typescript-eslint/recommended", | ||
|
||
// Turn off rules that might conflict with Prettier | ||
"prettier", | ||
], | ||
|
||
// Use typescript-eslint parser | ||
parser: "@typescript-eslint/parser", | ||
|
||
parserOptions: { | ||
// Allow ES2022 syntax | ||
sourceType: "module", | ||
}, | ||
|
||
plugins: [ | ||
// Support typescript-eslint | ||
"@typescript-eslint", | ||
], | ||
|
||
// Ignore configuration files in directories above this one | ||
root: true, | ||
|
||
rules: { | ||
// Allow empty destructuring patterns | ||
"no-empty-pattern": "off", | ||
|
||
// Allow anonymous default exports | ||
"import/no-anonymous-default-export": "off", | ||
}, | ||
}; |
This file contains 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Mark everything as vendored | ||
* linguist-vendored | ||
# Treat docs as documentation | ||
/docs/** -linguist-vendored linguist-documentation | ||
# Unmark files in src, so that they are included in language stats | ||
/src/** -linguist-vendored |
This file contains 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
changelog: | ||
exclude: | ||
# Exclude PRs with the following labels from the changelog | ||
labels: | ||
- skip-changelog | ||
# Categories are used make sections in the changelog based on PR labels | ||
categories: | ||
- title: 🚀 Features | ||
labels: | ||
- feature | ||
- title: 🐛 Bug Fixes | ||
labels: | ||
- bug | ||
- title: 🧽 Cleanup | ||
labels: | ||
- cleanup |
Oops, something went wrong.