mirror of
https://github.com/zhigang1992/yarn.git
synced 2026-06-10 07:55:57 +08:00
**Summary** Yarn 1.1.0 release failed due to a bug in npm@5: https://github.com/npm/npm/issues/16723. This patch uses `npx` to force using `np@4` when publishing in `update-npm.sh`. **Test plan** CircleCI
31 lines
888 B
Bash
Executable File
31 lines
888 B
Bash
Executable File
#!/bin/bash
|
|
# Pushes the locally built Yarn version to npm
|
|
|
|
set -ex
|
|
|
|
version=`./dist/bin/yarn --version`
|
|
tarball="./artifacts/yarn-v$version.tar.gz"
|
|
|
|
# Ensure Yarn tarball was built
|
|
if [ ! -f "$tarball" ]; then
|
|
echo 'Could not find Yarn tarball; please re-run "yarn build-dist".'
|
|
exit 1
|
|
fi;
|
|
|
|
# Check if this version is already published to npm.
|
|
# Note: npm doesn't return a non-zero error code when "npm view" can't find a
|
|
# package, so we need to improvise by checking that the value is what we expect.
|
|
if [ "`npm view yarn@$version name`" = 'yarn' ]; then
|
|
echo "$version is already available on npm"
|
|
exit 0
|
|
fi;
|
|
|
|
# Determine if this is an RC or a stable release
|
|
release_type=`curl --fail https://release.yarnpkg.com/release_type/$version`
|
|
npm_flags=''
|
|
if [ "$release_type" = "rc" ]; then
|
|
npm_flags='--tag rc'
|
|
fi;
|
|
|
|
eval "npx npm@4 publish '$tarball' --access public $npm_flags"
|