Skip to content

Instantly share code, notes, and snippets.

@seanwash
Last active May 19, 2021 19:53
Show Gist options
  • Save seanwash/968786b1152cecf1af254d10b2cbe0fb to your computer and use it in GitHub Desktop.
Save seanwash/968786b1152cecf1af254d10b2cbe0fb to your computer and use it in GitHub Desktop.
NPM Check Package Version
#!/usr/bin/env zx
// Don't output every command run.
$.verbose = false
let TARGET_BRANCH = await question('Which branch do you want to check? (develop) ')
TARGET_BRANCH = TARGET_BRANCH || 'develop'
const originalBranch = await $`git branch --show-current`
await $`git checkout ${TARGET_BRANCH}`
const version = await require('../package.json').version
console.log(`${TARGET_BRANCH}:`, version)
await $`git checkout ${originalBranch}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment