Skip to content

Instantly share code, notes, and snippets.

@DaneTheory
Forked from zkat/index.js
Last active December 24, 2021 23:36
Show Gist options
  • Save DaneTheory/06a3bc6db42c010d0fa15e16487a0685 to your computer and use it in GitHub Desktop.
Save DaneTheory/06a3bc6db42c010d0fa15e16487a0685 to your computer and use it in GitHub Desktop.
npx test

Hi!

try passing the URL for this gist to npx.

#!/usr/bin/env node
import { $, require } from 'zx'
// const currDate = await $`date`
// await console.log(currDate)
try {
let { version } = await require('./package.json')
await console.log(chalk.cyan(version))
const {
shell
} = await $
const activeShell = await shell
await console.log(chalk.green(activeShell))
await console.log(chalk.blue('Hello world!'))
await $`exit 1`
}
catch(err) {
console.error(err)
console.error(`Exit code: ${err.exitCode}`)
console.error(`Error: ${err.stderr}`)
process.exit(1)
}
{
"name": "npx-test",
"version": "0.0.1",
"bin": "./index.mjs",
"dependencies": {
"zx": "latest",
"cowsay": "latest"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment