casey / casey/just

Cross-platform `sh` via `deno` or `busybox`

Open
#2,671 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
35.8k
Forks
846
Avg merge
27m
Merged PRs (30d)
3

Description

I wanted to quickly share an option for writing cross-platform justfiles using (limited) sh-style syntax: leverage `deno`'s `task` subcommand.

## Context

I'm an OSS maintainer, projects support Windows, I want to use justfiles, I must make it extremely easy for potential contributors to install all necessary dependencies that are outside of the language ecosystem's core tools. _For example, Golang devs obviously have golang installed, but they shouldn't be expected to jump through hoops to install shells and command runners._

## Setup

Tell just to use deno's `sh` interpreter subcommand, `deno task`.

```
set shell := ["deno", "task", "--quiet", "--eval"]

# Sample recipe
prune-docs:
cat *.md | markdown-formatter-tool dist/docs.md
```

PowerShell can't do this, because PowerShell's `cat` is subtly different -- breaks newlines, breaks binary files -- and PowerShell doesn't do `*` globbing.

Deno handles it correctly.

## Installation

For contributors on Windows:

```
winget install -e --id Casey.Just
winget install -e --id DenoLand.Deno
```

## Why deno?

"Isn't deno a JavaScript/TypeScript thing? I hate JavaScript/TypeScript! My project is C#/golang/rust/etc!"

In this case, we are using deno's built-in ability to run one-line commands written in `sh`-style syntax, exactly what `just` needs for vanilla recipes!
*We are not running any JavaScript.*

https://docs.deno.com/runtime/reference/cli/task/#syntax

Deno installs as a single, ~100MB binary file.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.