Berry: [Bug] .yarnrc grammar doesn't handle Windows paths

Created on 3 Apr 2019  路  2Comments  路  Source: yarnpkg/berry

Describe the bug

When I have a .yarnrc file like this (generated by Yarn v1):

# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1

cache-folder "N:\\Resources\\Yarn\\Cache"
email [email protected]
lastUpdateCheck 1554139102835
username embraser01

It doesn't work because the grammar will split the line by the : inside quotes and not by the space after cache-folder.

From https://pegjs.org/online:

{
   "cache-folder \"N": "\\Resources\\Yarn\\Cache\"",
   "email": "[email protected]",
   "lastUpdateCheck": "1554139102835",
   "username": "embraser01"
}

For now, the workaround is simply to add the : after cache-folder.

To Reproduce

Go to https://pegjs.org/online and use the syml grammar and use the .yarnrc sample.

Environment if relevant (please complete the following information):

  • OS: Windows
  • Node version 11.0.0
  • Yarn version latest berry

Additional context

It happend because when working on #57, a script was loading my Yarn V1 .yarnrc placed in C:\Users\marca\.

Also, I had to remove temporary legacy settings even if I might use them in other project, is it possible to just throw a warning instead of throwing an error?

bug

All 2 comments

It doesn't work because the grammar will split the line by the : inside quotes and not by the space after cache-folder.

Good catch, that's probably pseudostringLegacy that needs a guard against double/single quotes.

Also, I had to remove temporary legacy settings even if I might use them in other project, is it possible to just throw a warning instead of throwing an error?

It's a bit hidden but you just have to add a berry: key in your .yarnrc (even empty), and Yarn will use this object as the v2 configuration (instead of the whole file):

workspaces-experimental: true

berry:
  init-scope: "berry"

Fixed 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrisands picture chrisands  路  3Comments

Bessonov picture Bessonov  路  4Comments

milichev picture milichev  路  3Comments

joshmeads picture joshmeads  路  4Comments

tiansijie picture tiansijie  路  4Comments