Skip to content

combostrap/devfiles

Repository files navigation

Devfiles - Dev flow configuration across Git repositories

About

This repository contains devfiles.

We use them to manage centrally and distribute our development flow and environment across Git repositories.

What are devfiles?

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.

QuickStart in three commands

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 reload

For a step by step, see the detailed steps

How it works

Core Component

It uses the following core components:

  • copier for devfiles installation and upgrade
  • direnv for setup (project and environment)
  • dev scripts for development flow

Utility components

The utility components are used in the scripts or as configuration:

Steps

Prerequisites

Install:

Copy or update this copier template

  • to install the latest devfiles in 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 devfiles version
copier update .

Note: the copier template is in the copier-template directory

Setup and local configuration (direnv)

The .envrc file is the main entry for setup and local config.

It will:

If you open your terminal, direnv should execute .envrc. If not:

direnv reload

Features and configuration

Pass - Local Secret Management

Pass (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:

JReleaser

For release management, we use jreleaser.

We distribute with this template, a jreleaser wrapper script to pass the needed secrets with pass

Git User Configuration

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

Code Styling (Editor Config)

The editorconfig file is .editorconfig

We also use the following editorconfig code styling utility:

Commit Message Validation (CommitLint)

commitlint configuration is located at commitlint.config.js

Markdown Link-Check

markdown-link-check for Markdown link validation configuration is located at markdown-link-check.config.json

Copy .gitignore and .gitattributes if not found

Default .gitignore and .gitattributes are installed

Create a LICENSE file

A LICENSE file is created from the following templates:

We follow the most common names:

  • LICENSE,
  • LICENSE.txt,
  • LICENSE.md

Scripts

Project only scripts (direnv.d)

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

Dev scripts located in the dev-scripts directory.

They are made available:

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

Scripts Environment variable

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

Git Hooks and Pre-commit

The pre-commit:

Prepare your next commit

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-prepare

Task Distribution

The go task file is Taskfile.yaml

How to

How to update the devfiles to the latest version?

You can update any repo generated to the last devfiles with:

task update
# or/equivalent to
copier update .

Contrib

How to develop and contrib to this repository. See contrib

About

Combostrap Devfiles - Dev flow configuration across Git repositories.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published