66# github-changelog-generator; install via:
77# pip install git+https://github.com/matrix-org/github-changelog-generator.git
88# jq; install from your distribution's package manager (https://stedolan.github.io/jq/)
9- # hub; install via brew (OSX) or source/pre-compiled binaries (debian) (https://github.com/github/hub) - Tested on v2.2.9
9+ # hub; install via brew (macOS) or source/pre-compiled binaries (debian) (https://github.com/github/hub) - Tested on v2.2.9
10+ # npm; typically installed by Node.js
11+ # yarn; install via brew (macOS) or similar (https://yarnpkg.com/docs/install/)
1012
1113set -e
1214
2224 echo " hub is required: please install it"
2325 exit
2426fi
27+ npm --version > /dev/null || (echo " npm is required: please install it" ; kill $$ )
28+ yarn --version > /dev/null || (echo " yarn is required: please install it" ; kill $$ )
2529
2630USAGE=" $0 [-xz] [-c changelog_file] vX.Y.Z"
2731
@@ -88,6 +92,8 @@ if [ -z "$skip_changelog" ]; then
8892 update_changelog -h > /dev/null || (echo " github-changelog-generator is required: please install it" ; exit)
8993fi
9094
95+ # Login and publish continues to use `npm`, as it seems to have more clearly
96+ # defined options and semantics than `yarn` for writing to the registry.
9197actual_npm_user=` npm whoami` ;
9298if [ $expected_npm_user != $actual_npm_user ]; then
9399 echo " you need to be logged into npm as $expected_npm_user , but you are logged in as $actual_npm_user " >&2
@@ -147,18 +153,18 @@ cat "${changelog_file}" | `dirname $0`/scripts/changelog_head.py > "${latest_cha
147153set -x
148154
149155# Bump package.json and build the dist
150- echo " npm version"
151- # npm version will automatically commit its modification
156+ echo " yarn version"
157+ # yarn version will automatically commit its modification
152158# and make a release tag. We don't want it to create the tag
153159# because it can only sign with the default key, but we can
154160# only turn off both of these behaviours, so we have to
155161# manually commit the result.
156- npm version --no-git-tag-version " $release "
162+ yarn version --no-git-tag-version " $release "
157163
158- # commit package-lock.json if it exists, is versioned, and is modified
159- if [[ -f package-lock.json && ` git status --porcelain package-lock.json | grep ' ^ M' ` ]];
164+ # commit yarn.lock if it exists, is versioned, and is modified
165+ if [[ -f yarn.lock && ` git status --porcelain yarn.lock | grep ' ^ M' ` ]];
160166then
161- pkglock=' package-lock.json '
167+ pkglock=' yarn.lock '
162168else
163169 pkglock=' '
164170fi
178184# assets.
179185# We make a completely separate checkout to be sure
180186# we're using released versions of the dependencies
181- # (rather than whatever we're pulling in from npm link)
187+ # (rather than whatever we're pulling in from yarn link)
182188assets=' '
183189dodist=0
184190jq -e .scripts.dist package.json 2> /dev/null || dodist=$?
@@ -189,10 +195,10 @@ if [ $dodist -eq 0 ]; then
189195 pushd " $builddir "
190196 git clone " $projdir " .
191197 git checkout " $rel_branch "
192- npm install
198+ yarn install
193199 # We haven't tagged yet, so tell the dist script what version
194200 # it's building
195- DIST_VERSION=" $tag " npm run dist
201+ DIST_VERSION=" $tag " yarn dist
196202
197203 popd
198204
281287rm " ${release_text} "
282288rm " ${latest_changes} "
283289
284- # publish to npmjs
290+ # Login and publish continues to use `npm`, as it seems to have more clearly
291+ # defined options and semantics than `yarn` for writing to the registry.
285292npm publish
286293
287294if [ -z " $skip_jsdoc " ]; then
288295 echo " generating jsdocs"
289- npm run gendoc
296+ yarn gendoc
290297
291298 echo " copying jsdocs to gh-pages branch"
292299 git checkout gh-pages
@@ -311,7 +318,7 @@ git checkout master
311318git pull
312319git merge " $rel_branch "
313320
314- # push master and docs (if generated) to github
321+ # push master and docs (if generated) to github
315322git push origin master
316323if [ -z " $skip_jsdoc " ]; then
317324 git push origin gh-pages
0 commit comments