Skip to content

Instantly share code, notes, and snippets.

@kobalab
Last active March 8, 2021 22:56
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 kobalab/9e82f764af3c5b3caadd2fdaea2d920b to your computer and use it in GitHub Desktop.
Save kobalab/9e82f764af3c5b3caadd2fdaea2d920b to your computer and use it in GitHub Desktop.
電脳麻将のバージョンを変更するスクリプト
#!/bin/sh
set -e
[ $1 ] || (echo "Usage: $0 version"; exit 1)
version=$1
npx semver ${version} || (echo "${version}: bad semver"; exit 1)
ex package.json <<++
/"version":/s/: .*$/: "${version}",/
/"build:css":/s/majiang[^ ]*\.css/majiang-${version}.css/
w!
++
ex package-lock.json <<++
3s/"version":.*,/"version": "${version}",/
w!
++
ex src/js/majiang.js <<++
/Majiang v/s/v.*/v${version}/
/VERSION:/s/'.*'/'${version}'/
w!
++
echo "- var version = '${version}'" > src/html/version.pug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment