This repository contains devfiles.
We use them to manage centrally and distribute our development flow and environment across Git repositories.
dotfiles configure application files, devfiles configure a development flow.
With them, you can:
- init/scaffold a new repo
- update an existing one to the latest
devfiles
and get instantly a consistent development environment across your git repositories.
In a new or existing git repository, execute the following commands to install the devfiles:
cd your-git-repo
copier copy https://github.com/combostrap/devfiles .
direnv reloadFor a step by step, see the detailed steps
It uses the following core components:
- copier for
devfilesinstallation and upgrade - direnv for setup (project and environment)
- dev scripts for development flow
The utility components are used in the scripts or as configuration:
- pre-commit for files check and normalization
- jreleaser for release management
- pass for secrets management
- git-cliff for change log and version bump
- go task for common tasks distribution
- editorconfig for code styling
- commitlint for commit message validation
- markdown-link-check for Markdown link validation
Install:
- copier
- direnv
- pre-commit
- task
optional
- to install the latest
devfilesin a git repo (empty or not)
# Optionally cd your_repo && git init
copier copy https://github.com/combostrap/devfiles .- to update a git repo with the last
devfilesversion
copier update .Note: the copier template is in the copier-template directory
The .envrc file is the main entry for setup and local config.
It will:
- install the git hooks with pre-commit
- install the dev scripts
If you open your terminal, direnv should execute .envrc.
If not:
direnv reloadPass (pass or gopass) is used for secret management.
All secrets are located under the organization name.
Example for a GitHub token:
pass "$ORGANISATION_PATH_NAME/github/release-token"Note:
- The secrets are not stored as global shell variables.
- They are retrieved in wrapper script that wraps a command.
- They are therefore only available while running the wrapper script.
Example of wrappers:
For release management, we use jreleaser.
We distribute with this template, a jreleaser wrapper script to pass the needed secrets with pass
To set the git user, you can set in your .bashrc the following env:
| Env |
|---|
DEVF_${ORGANIZATION_NAME}_EMAIL |
DEVF_${ORGANIZATION_NAME}_SIGNING_KEY |
See the Git User Configuration Script
The editorconfig file is .editorconfig
We also use the following editorconfig code styling utility:
- shfmt for bash styling
- editorconfig-checker) as hook
commitlint configuration is located at commitlint.config.js
markdown-link-check for Markdown link validation configuration is located at markdown-link-check.config.json
Default .gitignore and .gitattributes are installed
A LICENSE file is created from the following templates:
We follow the most common names:
LICENSE,LICENSE.txt,LICENSE.md
For project only configuration, you can add your own direnv scripts in the PROJECT_ROOT/direnv.d directory.
All .sh files present in this directory will be sourced.
Dev scripts located in the dev-scripts directory.
They are made available:
- by cloning this repository
- and put in the
PATH:
The code is in the envrc and can be configured by setting the
following variable in your shell profile, ~/.bashrc, or ~/.config/direnv/direnvrc, or ~/.envrc.local.
| Environment | Default Value | Description |
|---|---|---|
DEVF_${ORGANIZATION_NAME}_DIR |
$PROJET_ROOT/../devfiles |
The local file system location of the devfiles repository clone |
DEVF_${ORGANIZATION_NAME}_URI |
https://github.com/combostrap/devfiles | The URI location of the devfiles repository |
In your scripts, you can use the following env:
| Syntax | Description |
|---|---|
PROJECT_ROOT |
The root directory of the git repo (ie GIT_ROOT without submodule) |
ORGANISATION_NAME |
The organization name |
ORGANISATION_ENV_NAME |
The organization name in a env format |
ORGANISATION_PATH_NAME |
The organization name in a file path format |
The pre-commit:
- config is part of the template at .pre-commit-config.yaml
- setup is performed with direnv via .envrc
- extra
git hooksare available at git-hooks
You can check the files in you next commit with:
task prepare
# equivalent to
git add -A && pre-commit run
# or with the common dev script
git-prepareThe go task file is Taskfile.yaml
You can update any repo generated to the last devfiles with:
task update
# or/equivalent to
copier update .How to develop and contrib to this repository. See contrib