Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Apr 2020 15:34:40 +0000 (UTC)
From:      Luca Pizzamiglio <pizzamig@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r531699 - in head/www/yarn: . files
Message-ID:  <202004141534.03EFYemV063142@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pizzamig
Date: Tue Apr 14 15:34:40 2020
New Revision: 531699
URL: https://svnweb.freebsd.org/changeset/ports/531699

Log:
  www/yarn: fix regression with global packages
  
  Add a patch to fix global packages upgrade
  
  PR:		245425
  Submitted by:	madpilot@
  Obtained from:	https://github.com/yarnpkg/yarn/issues/4884

Added:
  head/www/yarn/files/
  head/www/yarn/files/patch-lib_cli.js   (contents, props changed)
Modified:
  head/www/yarn/Makefile

Modified: head/www/yarn/Makefile
==============================================================================
--- head/www/yarn/Makefile	Tue Apr 14 15:30:20 2020	(r531698)
+++ head/www/yarn/Makefile	Tue Apr 14 15:34:40 2020	(r531699)
@@ -3,6 +3,7 @@
 PORTNAME=	yarn
 DISTVERSIONPREFIX=	v
 DISTVERSION=	1.22.4
+PORTREVISION=	1
 CATEGORIES=	www
 MASTER_SITES=	https://yarnpkg.com/downloads/${PORTVERSION}/
 

Added: head/www/yarn/files/patch-lib_cli.js
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/yarn/files/patch-lib_cli.js	Tue Apr 14 15:34:40 2020	(r531699)
@@ -0,0 +1,80 @@
+--- lib/cli.js.orig	2020-03-09 15:51:47 UTC
++++ lib/cli.js
+@@ -56939,10 +56939,10 @@ function getRcConfigForFolder(cwd) {
+ }
+ 
+ function loadRcFile(fileText, filePath) {
+-  var _parse = (0, (_lockfile || _load_lockfile()).parse)(fileText, filePath),
++  var _parse = (0, (_lockfile || _load_lockfile()).parse)(fileText, 'yarnrc'),
+       values = _parse.object;
+ 
+-  if (filePath.match(/\.yml$/) && typeof values.yarnPath === 'string') {
++  if (filePath.match(/\.yml$/)) {
+     values = { 'yarn-path': values.yarnPath };
+   }
+ 
+@@ -64532,27 +64532,16 @@ function parse(str, fileLoc) {
+   var parser = new Parser(str, fileLoc);
+   parser.next();
+ 
+-  if (!fileLoc.endsWith(`.yml`)) {
++  try {
++    return parser.parse();
++  } catch (error1) {
+     try {
+-      return parser.parse();
+-    } catch (error1) {
+-      try {
+-        return safeLoad(str, {
+-          schema: FAILSAFE_SCHEMA
+-        });
+-      } catch (error2) {
+-        throw error1;
+-      }
++      return safeLoad(str, {
++        schema: FAILSAFE_SCHEMA
++      });
++    } catch (error2) {
++      throw error1;
+     }
+-  } else {
+-    var result = safeLoad(str, {
+-      schema: FAILSAFE_SCHEMA
+-    });
+-    if (typeof result === 'object') {
+-      return result;
+-    } else {
+-      return {};
+-    }
+   }
+ }
+ 
+@@ -90319,7 +90308,7 @@ var _buildSubCommands = (0, (_buildSubCommands2 || _lo
+         var rcPath = `${config.lockfileFolder}/.yarnrc.yml`;
+         reporter.log(`Updating ${chalk.magenta(rcPath)}...`);
+ 
+-        yield (_fs || _load_fs()).writeFilePreservingEol(rcPath, `yarnPath: ${(0, (_stringify || _load_stringify()).default)(targetPath)}\n`);
++        yield (_fs || _load_fs()).writeFilePreservingEol(rcPath, `yarnPath: ${(0, (_stringify || _load_stringify()).default)(yarnPath)}\n`);
+       } else {
+         var _rcPath = `${config.lockfileFolder}/.yarnrc`;
+         reporter.log(`Updating ${chalk.magenta(_rcPath)}...`);
+@@ -101330,11 +101319,7 @@ function parseRcPaths(paths, parser) {
+     try {
+       return parser((0, (_fs || _load_fs()).readFileSync)(path).toString(), path);
+     } catch (error) {
+-      if (error.code === 'ENOENT' || error.code === 'EISDIR') {
+-        return {};
+-      } else {
+-        throw error;
+-      }
++      return {};
+     }
+   })));
+ }
+@@ -153406,4 +153391,4 @@ module.exports = require("dns");
+ module.exports = require("domain");
+ 
+ /***/ })
+-/******/ ]);
+\ No newline at end of file
++/******/ ]);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004141534.03EFYemV063142>