Garnix Logo
Nov 8, 2023Sönke Hahn

garn version v0.0.15

Release announcement for garn version v0.0.15

Today we released version v0.0.15 of Garn and the accompanying typescript library.

How to get itshare

If you don't have Garn installed you can follow our installation instructions. If you already have Garn installed, then follow our updating guide.

New featuresshare

It's a small release with the following additional user-facing features:

Added a --version flagshare

Added golang version 1.21share

Simplify declaring Checks and Executablesshare

We added simpler overloads to the functions Project.addCheck, Project.addExecutable, Project.check, Project.shell, etc. in the typescript library.

So for example a Check definition used to look like this:

import * as garn from "https://garn.io/ts/v0.0.15/mod.ts";

export const myProject = garn.javascript
  .mkNpmProject({
    description: "my cool project",
    nodeVersion: "18",
    src: ".",
  })
  .addCheck("no todos allowed")`! grep -r TODO src`;

That syntax in the last line with the backticks after the function call to addCheck is valid, but unusual. We designed the API like this to allow to reference packages from nixpkgs and splice them into the script snippets, for example like this:

import * as garn from "https://garn.io/ts/v0.0.15/mod.ts";
import * as pkgs from "https://garn.io/ts/v0.0.15/nixpkgs.ts";

export const myProject = garn.javascript
  .mkNpmProject({
    description: "my cool project",
    nodeVersion: "18",
    src: ".",
  })
  .addCheck("no todos allowed")`! ${pkgs.ripgrep}/bin/rg TODO src`;

Notice that just by splicing in pkgs.ripgrep in that script snippet, you would declare a dependency of that check on ripgrep, so Garn would automatically install ripgrep when running this check. That felt very fancy and cool, and it's also sometimes needed, but it's also much less common than we thought. So now you can just write this instead:

import * as garn from "https://garn.io/ts/v0.0.15/mod.ts";
import * as pkgs from "https://garn.io/ts/v0.0.15/nixpkgs.ts";

export const myProject = garn.javascript
  .mkNpmProject({
    description: "my cool project",
    nodeVersion: "18",
    src: ".",
  })
  .withDevTools([pkgs.ripgrep])
  .addCheck("no todos allowed", "! rg TODO src");

The old syntax still works, in case you want to splice in packages. (Or in case you want to feel fancy and cool.)

Better handling of non-zero exit codes of spawned child processesshare

Consider a failing Executable like this:

import * as garn from "https://garn.io/ts/v0.0.15/mod.ts";

export const foo = garn.shell("echo some error message ; exit 23");

In version v0.0.15 garn run foo now:

  • exits with exit code 23, and
  • doesn't output a confusing error message about a failed child process. Instead it leaves printing error messages to the child process.

Thank to Simon Hengel for submitting a PR for this!

Remove unused flake inputsshare

The generated flake files now only include flake inputs that are actually used. This is more an internal detail, but it's included here, since it means that Garn should run a little faster now.

Continue Reading

Dec 19, 2023Alex David

Microsoft's LSP is great for text-editor diversity, but it is severely lacking in flexibility for project-specific configuration.

Dec 7, 2023Alex David

Release announcement for garn version v0.0.19, which includes the ability to import Nix flakes from the internet and from your repository.

Nov 30, 2023Julian K. Arni

Release announcement for garn version v0.0.17 and v0.0.18. Includes better Haskell support, and less confusing file tracking.

View Archive →
black globe

Say hi, ask questions, give feedback