This feature provides common utilities for the devcontainer features.
"features": {
"ghcr.io/tomgrv/devcontainer-features/common-utils:11": {
"utils": "jq dos2unix"
}
}npx tomgrv/devcontainer-features -- add common-utils
# or, without node/npm:
curl -fsSL https://raw.githubusercontent.com/tomgrv/devcontainer-features/develop/setup.sh | sh -s -- add common-utilsnpm install --save-dev @tomgrv/devcontainer-features-common-utils| Options Id | Description | Type | Default Value |
|---|---|---|---|
| utils | The utilities to install. | string | jq yq dos2unix shellcheck |
The following utilities are included by default:
jqdos2unix
You can specify additional utilities to install by modifying the utils option in the devcontainer.json file.
The feature also includes the following VS Code customizations:
-
Extensions:
actboy168.tasksgruntfuggly.triggertaskonsavenatizyskunk.sftpformulahendry.auto-rename-tagformulahendry.auto-close-taggruntfuggly.todo-treefoxundermoon.shell-formatrichie5um2.vscode-sort-json
-
Settings:
editor.formatOnSave:trueeditor.formatOnPaste:truetodo-tree.general.tags:["BUG", "HACK", "FIXME", "TODO", "XXX", "[ ]", "[x]", "NOTE"]editor.indentSize:"tabSize"editor.detectIndentation:trueeditor.tabSize:4
- Installs specified common utilities such as jq and dos2unix.
- Installs mikefarah/yq v4 (pinned
release binary, via
zz-use yq), whichyaml-mergerequires; a distro pythonyqalready onPATHis rejected byyaml-merge. - Supports specifying additional utilities to install.
stubs/.devcontainer/devcontainer.json is merged into the consumer's .devcontainer/devcontainer.json and adds a postStartCommand.npm entry: npm install when a package.json exists and npm is on PATH.
Consumer repos get these deployed workflows under .github/workflows/:
validate-pr-lock.yml— validatespackage.json/package-lock.jsonandcomposer.json/composer.lockcoherence viatomgrv/actions/check-lock, reporting drift inline via reviewdog.check-lockdetects whichever manifests are present, so this one workflow covers both npm and Composer repos without needing a feature-specific variant.common-utilsis a transitive dependency of almost every other feature in this repo (gitutils,githooks,larasets, …), so this check ships for nearly every consumer without them needing to add it explicitly.- By default it checks the repo root only (
paths: '.'). If your manifests live in subdirectories, edit the deployed workflow and pass a comma-separatedpathslist (e.g..,packages/foo) to thecheck-lockstep. test-workspaces.yaml— runs each npm/Composer workspace's own test suite with workspace granularity. It discovers workspaces viatomgrv/actions/list-packagesand, for every workspace, runstomgrv/actions/run-workspace-tests(backed bytomgrv/scripts/ws-test). A draft pull request only runs the workspaces its changes impact: the ones owning a changed file plus, transitively, the workspaces depending on them (dependencies/peerDependencies/devDependencies/optionalDependencies), computed byws-impactedand passed tolist-packagesas itsfilter. Markdown impacts nobody; a changed file owned by no workspace (root manifest, shared test helpers, workflows) impacts everybody. Marking the pull request ready for review, pushing to a non-draft pull request, and pushes tomain/developrun every workspace (branches without a pull request are no longer tested: open a draft one). Repo-widetests/also wait for ready. TheTests greenjob fails if any test job failed or was cancelled: mark it as a required status check in branch protection to block merging. For each root*.jsonfile found directly under a workspace (typicallypackage.json), that command reads its.scripts.testentry as the workspace's generic test entrypoint:- no root
*.jsonfile in the workspace → silently skipped; - a
*.jsonfile present but no.scripts.testentry → warns, doesn't fail the workspace; .scripts.testpresent → run it; a non-zero exit, or a zero exit with no output at all (a silently-empty test run), both fail the workspace. Add a"scripts": {"test": "..."}entry to a workspace'spackage.json(e.g."test": "bats tests/") to opt it into this workflow. The same workflow also runs arepo-testsjob for repo-wide suites (tests that guard a convention across the whole repo rather than one workspace — seetests/README.md), silently skipped whentests/has no*.batsfiles. It runs on every push and pull request except markdown-only changes, and a newer run on the same ref cancels the one still in progress.
- no root
update-features.yml— deployed with the repository's rootstubs/bynpx tomgrv/devcontainer-features -- init, not by this feature. Weekly (and on demand) it runsnpm exec -- tomgrv/devcontainer-features update -aand opens a pull request when the installed features changed. Runs are queued, never overlapped.
feature-installinstalls links for a feature'sbin/scripts in a writable bin directory.- It resolves the writable bin directory with this fallback order:
INSTALL_BIN_DIR(or/usr/local/binby default)~/.local/bin- First writable directory found in
$PATH(excludingnode_modules/.bin) <feature-target>/bin
Installed from tomgrv/scripts; each has its own README with usage and options.
| Utility | Purpose |
|---|---|
zz-colors |
color codes to source in your scripts |
zz-log |
log messages with color |
zz-args |
parse command line arguments and print help in one go |
distribute-utils |
copy the zz-* utilities into a project folder (was zz-dist) |
zz-persist |
upsert a KEY=VALUE into an env file and/or /etc/profile.d |
json-validate |
validate JSON against a local, inferred or remote schema |
json-normalize |
order JSON keys by schema, then alphabetically |
If you have a feature that you would like to add to this repository, please open an issue or submit a pull request.