npm.io
0.5.4 • Published 2 weeks agoCLI

@reteps/dockerfmt

Licence
MIT
Version
0.5.4
Deps
0
Size
6.9 MB
Vulns
0
Weekly
0
Stars
606

@reteps/dockerfmt

Bindings around the Golang dockerfmt tooling. It compiles the Go code to WebAssembly (using standard Go's GOOS=js GOARCH=wasm target), which is then used in the JS bindings.

import { formatDockerfile } from '@reteps/dockerfmt'
// Alternatively, you can use `formatDockerfileContents` to format a string instead of a file.

const result = await formatDockerfile('../tests/comment.dockerfile', { indent: 4, trailingNewline: true })

console.log(result)

CLI

The package also ships the dockerfmt CLI.

# Format a Dockerfile and print to stdout
npx @reteps/dockerfmt Dockerfile