there is a 4th option, see below

Il 28/11/20 20:28, Pirate Praveen ha scritto:
...
So some options I can think,

1. Port yarn 1.x to build with babel 7 (but this has not been successfull)
2. Try to run ES6 code directly somehow, may be with newer nodejs and patches. 
I think Paolo tried this option, not sure what happened.
3. Build it using 'deb 
https://snapshot.debian.org/archive/debian/20200502T085134Z sid main' (the last 
version that builds in sid) and embed the built files in the package (as two 
steps, like we bootstrap babel, rollup etc). This will mean, we will have to 
move it to contrib. I prefer shipping yarn in contrib to missing it in bullseye.

4. Build yarn 2 (berry)

I have done some preliminary exploration.

First, if I follow the upstream suggested path to install yarn 2 I get this (on 
Debian testing with node 14 from experimental):

1. running `npm install yarn` in an empty dir adds node_modules/yarn (about 5 
MB), and no other dependencies; running `./node_modules/yarn/bin/yarn -v` 
returns 1.22.10

2. if you then run `./node_modules/yarn/bin/yarn set version berry` it drops a 
`.yarnrc.yml` file with the content `yarnPath: ".yarn/releases/yarn-berry.cjs"` 
and pulls the single file `.yarn/releases/yarn-berry.cjs` (1.8 MB)

3. now running `./node_modules/yarn/bin/yarn -v` or directly 
`.yarn/releases/yarn-berry.cjs` returns 2.3.3; I can run this file from 
anywhere, referencing its full path

4. for example running `/tmp/yarn/.yarn/releases/yarn-berry.cjs add yarn` in an 
empty dir adds .yarn/unplugged/yarn-npm-1.22.10-b1a926d20f (about 5 MB), and 
running `.yarn/unplugged/yarn-npm-1.22.10-b1a926d20f/node_modules/yarn/bin/yarn 
-v' returns 1.22.10 (back to square one).

What we want is to build the yarn-berry.cjs file from sources. This is what I 
have found on that:

1. Cloning the berry repo from github pulls almost 1GB of data (up from about 
100 MB for yarn 1)

2. the tarball is 180 MB (up from ~70 MB for yarn 1) and has all dependencies 
needed to run yarn (!) including monaco-editor (?) from Microsoft (the code 
editor which powers VS Code), react-icons, 6 versions of the typescript tree 
(version 3.75, 3.95 and 4.1 and three patched versions) etc.

3. running npm install in the source tree fails ('Unsupported URL Type 
"workspace:"')

4. if I delete yarn.lock and remove from package.json the 4 dependencies that 
use the workspace url (@yarnpkg/cli, @yarnpkg/core, @yarnpkg/eslint-config and 
@yarnpkg/pnpify), npm install runs fine

5. we want to run `yarn build:cli`, which according to 
packages/yarnpkg-cli/package.json runs `builder build bundle`; this file gives 
some clue as to what is supposed to happen:
https://github.com/yarnpkg/berry/blob/master/packages/yarnpkg-builder/sources/commands/build/bundle.ts#L96

Finally, I have also found: https://yarnpkg.com/advanced/telemetry

Paolo

Reply via email to