Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: add Yarn 1.22.5 #37277

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -62,6 +62,7 @@ _UpgradeReport_Files/
*.wixobj
/tools/msvs/genfiles/
/npm.wxs
/yarn.wxs
/tools/msvs/msi/Release/
/tools/msvs/msi/obj/
/tools/msvs/msi/x64/
Expand Down
26 changes: 24 additions & 2 deletions Makefile
Expand Up @@ -806,6 +806,7 @@ DISTTYPEDIR ?= $(DISTTYPE)
RELEASE=$(shell sed -ne 's/\#define NODE_VERSION_IS_RELEASE \([01]\)/\1/p' src/node_version.h)
PLATFORM=$(shell uname | tr '[:upper:]' '[:lower:]')
NPMVERSION=v$(shell cat deps/npm/package.json | grep '"version"' | sed 's/^[^:]*: "\([^"]*\)",.*/\1/')
YARNVERSION=v$(shell cat deps/yarn/package.json | grep '"version"' | sed 's/^[^:]*: "\([^"]*\)",.*/\1/')

UNAME_M=$(shell uname -m)
ifeq ($(findstring x86_64,$(UNAME_M)),x86_64)
Expand Down Expand Up @@ -962,6 +963,7 @@ $(PKG): release-only
cat tools/macos-installer/productbuild/distribution.xml.tmpl \
| sed -E "s/\\{nodeversion\\}/$(FULLVERSION)/g" \
| sed -E "s/\\{npmversion\\}/$(NPMVERSION)/g" \
| sed -E "s/\\{yarnversion\\}/$(YARNVERSION)/g" \
>$(MACOSOUTDIR)/installer/productbuild/distribution.xml ; \

@for dirname in tools/macos-installer/productbuild/Resources/*/; do \
Expand All @@ -971,10 +973,12 @@ $(PKG): release-only
cat $$dirname/welcome.html.tmpl \
| sed -E "s/\\{nodeversion\\}/$(FULLVERSION)/g" \
| sed -E "s/\\{npmversion\\}/$(NPMVERSION)/g" \
| sed -E "s/\\{yarnversion\\}/$(YARNVERSION)/g" \
>$(MACOSOUTDIR)/installer/productbuild/Resources/$$lang/welcome.html ; \
cat $$dirname/conclusion.html.tmpl \
| sed -E "s/\\{nodeversion\\}/$(FULLVERSION)/g" \
| sed -E "s/\\{npmversion\\}/$(NPMVERSION)/g" \
| sed -E "s/\\{yarnversion\\}/$(YARNVERSION)/g" \
>$(MACOSOUTDIR)/installer/productbuild/Resources/$$lang/conclusion.html ; \
done
$(PYTHON) ./configure \
Expand All @@ -986,11 +990,16 @@ $(PKG): release-only
SIGN="$(CODESIGN_CERT)" PKGDIR="$(MACOSOUTDIR)/dist/node/usr/local" sh \
tools/osx-codesign.sh
mkdir -p $(MACOSOUTDIR)/dist/npm/usr/local/lib/node_modules
mkdir -p $(MACOSOUTDIR)/dist/yarn/usr/local/lib/node_modules
mkdir -p $(MACOSOUTDIR)/pkgs
mv $(MACOSOUTDIR)/dist/node/usr/local/lib/node_modules/npm \
$(MACOSOUTDIR)/dist/npm/usr/local/lib/node_modules
mv $(MACOSOUTDIR)/dist/node/usr/local/lib/node_modules/yarn \
$(MACOSOUTDIR)/dist/yarn/usr/local/lib/node_modules
unlink $(MACOSOUTDIR)/dist/node/usr/local/bin/npm
unlink $(MACOSOUTDIR)/dist/node/usr/local/bin/npx
unlink $(MACOSOUTDIR)/dist/node/usr/local/bin/yarn
unlink $(MACOSOUTDIR)/dist/node/usr/local/bin/yarnpkg
$(NODE) tools/license2rtf.js < LICENSE > \
$(MACOSOUTDIR)/installer/productbuild/Resources/license.rtf
cp doc/osx_installer_logo.png $(MACOSOUTDIR)/installer/productbuild/Resources
Expand All @@ -1002,16 +1011,29 @@ $(PKG): release-only
--root $(MACOSOUTDIR)/dist/npm \
--scripts ./tools/macos-installer/pkgbuild/npm/scripts \
$(MACOSOUTDIR)/pkgs/npm-$(NPMVERSION).pkg
pkgbuild --version $(NPMVERSION) \
--identifier org.nodejs.yarn.pkg \
--root $(MACOSOUTDIR)/dist/yarn \
--scripts ./tools/macos-installer/pkgbuild/yarn/scripts \
$(MACOSOUTDIR)/pkgs/yarn-$(YARNVERSION).pkg
productbuild --distribution $(MACOSOUTDIR)/installer/productbuild/distribution.xml \
--resources $(MACOSOUTDIR)/installer/productbuild/Resources \
--package-path $(MACOSOUTDIR)/pkgs ./$(PKG)
SIGN="$(PRODUCTSIGN_CERT)" PKG="$(PKG)" sh tools/osx-productsign.sh
sh tools/osx-notarize.sh $(FULLVERSION)
#SIGN="$(PRODUCTSIGN_CERT)" PKG="$(PKG)" sh tools/osx-productsign.sh
#sh tools/osx-notarize.sh $(FULLVERSION)

.PHONY: pkg
# Builds the macOS installer for releases.
pkg: $(PKG)

yarn-update:
rm -rf deps/yarn
mkdir -p deps/yarn
curl -s -L https://yarnpkg.com/latest.tar.gz | tar -xz --strip-components=1 -Cdeps/yarn
# Those shellscripts are originally meant for Yarn Windows packages; tweaked for Node Windows paths
sed -i '' -E 's#"\$$basedir/yarn.js"#"\$$basedir/node_modules/yarn/bin/yarn.js"#g' deps/yarn/bin/yarn
sed -i '' -E 's#"%~dp0\\yarn.js"#"%~dp0\\node_modules\\yarn\\bin\\yarn.js"#g' deps/yarn/bin/yarn.cmd

# Note: this is strictly for release builds on release machines only.
pkg-upload: pkg
ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
Expand Down
26 changes: 26 additions & 0 deletions deps/yarn/LICENSE
@@ -0,0 +1,26 @@
BSD 2-Clause License

For Yarn software

Copyright (c) 2016-present, Yarn Contributors. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60 changes: 60 additions & 0 deletions deps/yarn/README.md
@@ -0,0 +1,60 @@
<p align="center">
<a href="https://yarnpkg.com/">
<img alt="Yarn" src="https://github.com/yarnpkg/assets/blob/master/yarn-kitten-full.png?raw=true" width="546">
</a>
</p>

<p align="center">
Fast, reliable, and secure dependency management.
</p>

<p align="center">
<a href="https://circleci.com/gh/yarnpkg/yarn"><img alt="Circle Status" src="https://circleci.com/gh/yarnpkg/yarn.svg?style=shield&circle-token=5f0a78473b0f440afb218bf2b82323cc6b3cb43f"></a>
<a href="https://ci.appveyor.com/project/kittens/yarn/branch/master"><img alt="Appveyor Status" src="https://ci.appveyor.com/api/projects/status/0xdv8chwe2kmk463?svg=true"></a>
<a href="https://dev.azure.com/yarnpkg/yarn/_build"><img alt="Azure Pipelines status" src="https://dev.azure.com/yarnpkg/yarn/_apis/build/status/Yarn%20Acceptance%20Tests"></a>
<a href="https://discord.gg/yarnpkg"><img alt="Discord Chat" src="https://img.shields.io/discord/226791405589233664.svg"></a>
<a href="http://commitizen.github.io/cz-cli/"><img alt="Commitizen friendly" src="https://img.shields.io/badge/commitizen-friendly-brightgreen.svg"></a>
</p>

---

**Fast:** Yarn caches every package it has downloaded, so it never needs to download the same package again. It also does almost everything concurrently to maximize resource utilization. This means even faster installs.

**Reliable:** Using a detailed but concise lockfile format and a deterministic algorithm for install operations, Yarn is able to guarantee that any installation that works on one system will work exactly the same on another system.

**Secure:** Yarn uses checksums to verify the integrity of every installed package before its code is executed.

## Features

* **Offline Mode.** If you've installed a package before, then you can install it again without an internet connection.
* **Deterministic.** The same dependencies will be installed in the same exact way on any machine, regardless of installation order.
* **Network Performance.** Yarn efficiently queues requests and avoids request waterfalls in order to maximize network utilization.
* **Network Resilience.** A single request that fails will not cause the entire installation to fail. Requests are automatically retried upon failure.
* **Flat Mode.** Yarn resolves mismatched versions of dependencies to a single version to avoid creating duplicates.
* **More emojis.** 🐈

## Installing Yarn

Read the [Installation Guide](https://yarnpkg.com/en/docs/install) on our website for detailed instructions on how to install Yarn.

## Using Yarn

Read the [Usage Guide](https://yarnpkg.com/en/docs/usage) on our website for detailed instructions on how to use Yarn.

## Contributing to Yarn

Contributions are always welcome, no matter how large or small. Substantial feature requests should be proposed as an [RFC](https://github.com/yarnpkg/rfcs). Before contributing, please read the [code of conduct](CODE_OF_CONDUCT.md).

See [Contributing](https://yarnpkg.com/org/contributing/).

## Prior art

Yarn wouldn't exist if it wasn't for excellent prior art. Yarn has been inspired by the following projects:

- [Bundler](https://github.com/bundler/bundler)
- [Cargo](https://github.com/rust-lang/cargo)
- [npm](https://github.com/npm/cli)

## Credits

Thanks to [Sam Holmes](https://github.com/samholmes) for donating the npm package name!
35 changes: 35 additions & 0 deletions deps/yarn/bin/yarn
@@ -0,0 +1,35 @@
#!/bin/sh
argv0=$(echo "$0" | sed -e 's,\\,/,g')
basedir=$(dirname "$(readlink "$0" || echo "$argv0")")

case "$(uname -s)" in
Darwin) basedir="$( cd "$( dirname "$argv0" )" && pwd )";;
Linux) basedir=$(dirname "$(readlink -f "$0" || echo "$argv0")");;
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac

command_exists() {
command -v "$1" >/dev/null 2>&1;
}

if command_exists node; then
if [ "$YARN_FORCE_WINPTY" = 1 ] || command_exists winpty && test -t 1; then
winpty node "$basedir/node_modules/yarn/bin/yarn.js" "$@"
else
exec node "$basedir/node_modules/yarn/bin/yarn.js" "$@"
fi
ret=$?
# Debian and Ubuntu use "nodejs" as the name of the binary, not "node", so we
# search for that too. See:
# https://lists.debian.org/debian-devel-announce/2012/07/msg00002.html
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=614907
elif command_exists nodejs; then
exec nodejs "$basedir/node_modules/yarn/bin/yarn.js" "$@"
ret=$?
else
>&2 echo 'Yarn requires Node.js 4.0 or higher to be installed.'
ret=1
fi

exit $ret
2 changes: 2 additions & 0 deletions deps/yarn/bin/yarn.cmd
@@ -0,0 +1,2 @@
@echo off
node "%~dp0\node_modules\yarn\bin\yarn.js" %*
31 changes: 31 additions & 0 deletions deps/yarn/bin/yarn.js
@@ -0,0 +1,31 @@
#!/usr/bin/env node

/* eslint-disable no-var */
/* eslint-disable flowtype/require-valid-file-annotation */
'use strict';

var ver = process.versions.node;
var majorVer = parseInt(ver.split('.')[0], 10);

if (majorVer < 4) {
console.error('Node version ' + ver + ' is not supported, please use Node.js 4.0 or higher.');
process.exit(1); // eslint-disable-line no-process-exit
} else {
try {
require(__dirname + '/../lib/v8-compile-cache.js');
} catch (err) {
// We don't have/need this on legacy builds and dev builds
}

// Just requiring this package will trigger a yarn run since the
// `require.main === module` check inside `cli/index.js` will always
// be truthy when built with webpack :(
// `lib/cli` may be `lib/cli/index.js` or `lib/cli.js` depending on the build.
var cli = require(__dirname + '/../lib/cli');
if (!cli.autoRun) {
cli.default().catch(function(error) {
console.error(error.stack || error.message || error);
process.exitCode = 1;
});
}
}
2 changes: 2 additions & 0 deletions deps/yarn/bin/yarnpkg
@@ -0,0 +1,2 @@
#!/usr/bin/env node
require('./yarn.js');
2 changes: 2 additions & 0 deletions deps/yarn/bin/yarnpkg.cmd
@@ -0,0 +1,2 @@
@echo off
"%~dp0\yarn.cmd" %*