Open samijaber opened 2 years ago
This issue reproduces on master:
Error: expect(received).toBe(expected) // Object.is equality
Expected: "0.0.2-1"
Received: "0.0.2-0"
at module.exports (evalmachine.<anonymous>:19:26)
at async /github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.3-558f52b79f-286d94b96d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:57:13
at async executeInTempDirectory (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.3-558f52b79f-286d94b96d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:18:16)
at async executeRepro (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.3-558f52b79f-286d94b96d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:25:12)
at async ExecCommand.execute (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.3-558f52b79f-286d94b96d.zip/node_modules/@arcanis/sherlock/lib/commands/exec.js:26:38)
at async ExecCommand.validateAndExecute (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-4061026d74.zip/node_modules/clipanion/lib/advanced/Command.js:161:26)
at async Cli.run (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-4061026d74.zip/node_modules/clipanion/lib/advanced/Cli.js:74:24)
at async Cli.runExit (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-4061026d74.zip/node_modules/clipanion/lib/advanced/Cli.js:83:28)
This issue reproduces on master:
Error: expect(received).toBe(expected) // Object.is equality
Expected: "0.0.2-1"
Received: "0.0.2-0"
at module.exports (evalmachine.<anonymous>:19:26)
at async /github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.3-558f52b79f-286d94b96d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:57:13
at async executeInTempDirectory (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.3-558f52b79f-286d94b96d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:18:16)
at async executeRepro (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.3-558f52b79f-286d94b96d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:25:12)
at async ExecCommand.execute (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.3-558f52b79f-286d94b96d.zip/node_modules/@arcanis/sherlock/lib/commands/exec.js:26:38)
at async ExecCommand.validateAndExecute (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-4061026d74.zip/node_modules/clipanion/lib/advanced/Command.js:161:26)
at async Cli.run (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-4061026d74.zip/node_modules/clipanion/lib/advanced/Cli.js:74:24)
at async Cli.runExit (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-4061026d74.zip/node_modules/clipanion/lib/advanced/Cli.js:83:28)
Still getting this issue
Yep, it's still relevant for the Yarn 4.1.11
. The prerelease version gets stuck:
I'm having the same issue.
I've noticed 2 things that will increment the prerelease version.
stableVersion
from package.json
. or;stableVersion
's prerelease version in package.json
to the current version
.
Then run yarn version -i prerelease
https://github.com/yarnpkg/berry/assets/15949513/6a0a6502-ee23-44fb-b4aa-67fe7e4531f1
This is definitely not the behaviour one would expect - at least from my understanding of the developer docs.
This command will bump the version number for the given package, following the specified strategy:
- If major, the first number from the semver range will be increased (X.0.0).
- If minor, the second number from the semver range will be increased (0.X.0).
- If patch, the third number from the semver range will be increased (0.0.X).
- If prefixed by pre (premajor, ...), a -0 suffix will be set (0.0.0-0).
- If prerelease, the suffix will be increased (0.0.0-X); the third number from the semver range will also be increased if there was no suffix in the previous version.
- If decline, the nonce will be increased for yarn version check to pass without version bump.
- If a valid semver range, it will be used as new version.
- If unspecified, Yarn will ask you for guidance.
Furthermore, the pre
functionality does not work either:
- If prefixed by pre (premajor, ...), a -0 suffix will be set (0.0.0-0).
command yarn version -i premajor
returns this error:
Usage Error: Invalid value for enumeration: "premajor" (expected one of "decline", "major", "minor", "patch", "prerelease")
$ yarn version [-d,--deferred] [-i,--immediate] <strategy>
Any news on this? Or insight into the recommended way of managing a workflow with a prerelease version? What we'd really like is the same functionality presented by npm
(https://stackoverflow.com/questions/39206082/npm-version-to-add-alpha-postfix).
Generally, it would be great to get documentation (even something small) describing an example scenario for developing and iterating on a library using Yarn 4 that isn't focused on the workspace/project release flow.
I thought I'd share an expansion on the workaround that applies to workspaces with multiple nested package.json files:
# The same workaround as shared above
removeStableVersion() {
echo "$(jq 'del(.stableVersion)' $1)" >$1
}
# A simple script to find all package.json files and run the workaround on them, filtering `node_modules` and `.nx` cache files
find . -type d \( -name node_modules -o -name .nx \) -prune -o -name 'package.json' -print|while read fname; do
removeStableVersion $fname
done
There is probably a more performant way, but this was simple and works for us.
Self-service
Describe the bug
Duplicate of #3868 with a Sherlock reproduction.
The issue is that:
yarn version prerelease
on a0.0.1
package, it willstableVersion
key inpackage.json
with value0.0.1
version
to0.0.2-0
yarn version prerelease
, it will try to usestableVersion
to dictate what version to upgrade to. Since it's0.0.1
, it will bumpversion
to0.0.2-0
(which is already its current value) instead of0.0.2-1
.Workaround
A solution is to remove
stableVersion
right before you runyarn version <strategy>
. You can make sure thisjq
script runs before every call toyarn version
:./scripts/remove-stableVersion.sh
:package.json
:To reproduce
Environment
Additional context
No response