Skip to content

Instantly share code, notes, and snippets.

@ntnyq
Last active March 13, 2023 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ntnyq/38a1f41b44a62e13ff3846bea0a9f592 to your computer and use it in GitHub Desktop.
Save ntnyq/38a1f41b44a62e13ff3846bea0a9f592 to your computer and use it in GitHub Desktop.
Run command in root with execa
import path from 'node:path'
import { URL, fileURLToPath } from 'node:url'
import { $ } from 'execa'
const __dirname = fileURLToPath(new URL('.', import.meta.url))
const rootPath = path.resolve(__dirname, '..')
const $$ = $({ cwd: rootPath, stdio: 'inherit' })
;(async () => {
await $$`prettier --write .`
)()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment