Describe the bug
nicolas@laptop:~/PROJECTS/CONCERTO/concerto$ yarn set version classic
➤ YN0000: Downloading https://nightly.yarnpkg.com/latest.js
➤ YN0001: Error: Invalid semver version
at /home/nicolas/PROJECTS/CONCERTO/concerto/.yarn/releases/yarn-2.4.0.cjs:2:86456
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async a.mktempPromise (/home/nicolas/PROJECTS/CONCERTO/concerto/.yarn/releases/yarn-2.4.0.cjs:2:513898)
at async Qe (/home/nicolas/PROJECTS/CONCERTO/concerto/.yarn/releases/yarn-2.4.0.cjs:2:86181)
at async /home/nicolas/PROJECTS/CONCERTO/concerto/.yarn/releases/yarn-2.4.0.cjs:2:86042
at async Function.start (/home/nicolas/PROJECTS/CONCERTO/concerto/.yarn/releases/yarn-2.4.0.cjs:2:388437)
at async we.execute (/home/nicolas/PROJECTS/CONCERTO/concerto/.yarn/releases/yarn-2.4.0.cjs:2:85865)
at async we.validateAndExecute (/home/nicolas/PROJECTS/CONCERTO/concerto/.yarn/releases/yarn-2.4.0.cjs:2:659490)
at async Y.run (/home/nicolas/PROJECTS/CONCERTO/concerto/.yarn/releases/yarn-2.4.0.cjs:17:3854)
at async Y.runExit (/home/nicolas/PROJECTS/CONCERTO/concerto/.yarn/releases/yarn-2.4.0.cjs:17:4021)
➤ YN0000: Failed with errors in 0s 386ms
To Reproduce
Reproduction
js repro
yarn set version classic
It's the same than https://github.com/yarnpkg/berry/issues/1893
https://nightly.yarnpkg.com/latest.js resolves to https://nightly.yarnpkg.com/yarn-1.23.0-20210102.0010.js which contains leading zeros
This seems to be caused by the generation of the version here:
const formattedDate =
date.getUTCFullYear() +
leftPad(date.getUTCMonth() + 1) +
leftPad(date.getUTCDate()) +
'.' +
leftPad(date.getUTCHours()) +
leftPad(date.getUTCMinutes());
Is there any appetite for changing this so that it does not generate invalid semver? Perhaps using a - instead of a . before the time? Or prepending a non-zero before the hour? I don't know if there's a dependency on the current format.
In our case, this causes breakage to a Yarn v2 workflow that packs a GitHub dependency using Yarn Classic as part of the project installation.
Why not skipping hours and minutes and replace it with git ref :
I've just opened https://github.com/yarnpkg/yarn/issues/8534 to address this.
Closing as fixed in https://github.com/yarnpkg/yarn/commit/3119382885ea373d3c13d6a846de743eca8c914b