release.sh: drop node dependency, use sed for version bump
This commit is contained in:
parent
26857d52da
commit
0b0bfc4a8a
1 changed files with 11 additions and 13 deletions
|
|
@ -56,20 +56,18 @@ fi
|
||||||
|
|
||||||
echo "==> Bumping to v$VERSION"
|
echo "==> Bumping to v$VERSION"
|
||||||
|
|
||||||
# Root package.json
|
# Bump a package.json "version" field without needing node/jq.
|
||||||
node -e '
|
# Only touches the first top-level "version": "…" line, which is the
|
||||||
var fs=require("fs"); var f="package.json";
|
# canonical location npm puts it. Fragile only if someone hand-wrote
|
||||||
var p=JSON.parse(fs.readFileSync(f)); p.version=process.argv[1];
|
# a nested "version" ABOVE the top-level one.
|
||||||
fs.writeFileSync(f, JSON.stringify(p, null, 2) + "\n");
|
bump_pkg_version() {
|
||||||
' "$VERSION"
|
local file="$1" new="$2"
|
||||||
echo " updated package.json"
|
sed -i -E "0,/(\"version\"[[:space:]]*:[[:space:]]*\")[^\"]+(\")/ s//\1${new}\2/" "$file"
|
||||||
|
}
|
||||||
|
|
||||||
# Mobile package.json
|
bump_pkg_version package.json "$VERSION"
|
||||||
node -e '
|
echo " updated package.json"
|
||||||
var fs=require("fs"); var f="mobile/package.json";
|
bump_pkg_version mobile/package.json "$VERSION"
|
||||||
var p=JSON.parse(fs.readFileSync(f)); p.version=process.argv[1];
|
|
||||||
fs.writeFileSync(f, JSON.stringify(p, null, 2) + "\n");
|
|
||||||
' "$VERSION"
|
|
||||||
echo " updated mobile/package.json"
|
echo " updated mobile/package.json"
|
||||||
|
|
||||||
# Android build.gradle
|
# Android build.gradle
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue