Skip to content

8.3.1 – Perfect Seal

Latest
Compare
Choose a tag to compare
@antonmedv antonmedv released this 29 Jan 09:24
· 3 commits to main since this release
3419ab6

The release essence: introduced full-featured .env support #461#1060 #1052 #1043 #1037 #1032 #1030 #1022

API

envapi is a tiny 100 LOC dotenv-inspired parser and serializer that we've integrated into zx.

import { dotenv, fs } from 'zx'

// parse
const env = dotenv.parse('A=A\nFOO=BAR') // { A: 'A', FOO: 'BAR' }

// serialize
const raw = dotenv.stringify(env) // A=A\nFOO=BAR
await fs.writeFile('.env', raw)

// load
dotenv.load('.env') // { A: 'A', FOO: 'BAR' }

// update the process.env
dotenv.config('.env')
process.env.A // A

CLI

zx --env .env script.mjs
zx --env-file .env script.mjs

QnA

— Why not use dotenv directly?
— 1) Size does matter 2) We'd like to avoid internal vaults.

— Why not load .env by default?
— 1) Explicit is better than implicit 2) Runtime itself (like bun) may provide the feature.

Chore

  • Provided stdall piping #1033
  • Exposed ProcessPromise fullCmd and unique id #1035
  • Simplified internal regexps #1040 #1038
  • Removed zx globals from unit tests scope #1039
  • Added check if tempfile exists #1041
  • Added ts support in markdown #1042
  • Enabled CodeQL and OSV scanners #1011
  • Configured pre-push git hooks #1044
  • Explicitly declared permissions for test.yml #1045
  • Mentioned halt and run API in docs #1046
  • Fixed timeout option handling for corner cases #1049
  • Allowed killSignal setting via env vars #1054
  • Added diagnostic_channel to built-ins list #1056
  • Enhanced logger: added id field and introduced end event #1057 #1058
  • Made nothrown() toggleable #1066 #1029
  • Handle ZX_REPL_HISTORY envvar #1065
  • Fixed file:// protocol check #1064
  • Accept mode option for tmpdir and tmpfile #1063
  • Enhanced deno support #1062 #1061
  • Optimized markdown parser #1068
  • Applied zizmor suggestions #1067
  • Minor code improvements #1070 #1069
  • Optimized output buffers joining #1072
  • Fixed predefined _timeoutSignal override #1075
  • Exposed ProcessPromise stage #1077 #967
  • Aligned script processing flows (CLI) #1078
  • Enhanced $ options tests #1079