Open halvardssm opened 1 month ago
Just commenting to raise visibility on the deno task --sync-version [TASK]
proposed by @halvardssm.
I think that's the way to go, letting deno handle (and download, if applies) the proper version for the project about to be executed.
Of course, this does not exclude allowing manual version handling via denonup or whatever name you guys come up with.
Related but tangential topic: indicating the version of Deno that a project uses in deno.json
. Even if Deno doesn't automatically sync the version, it would be useful to still raise a CLI error when the wrong Deno version is used.
Node handles this via a package.json#engines
field and a related engine-strict
config.
Introduction
This Issue builds upon the previous issue https://github.com/denoland/deno/issues/5214 and relates to https://github.com/denoland/deno/issues/24157
As we are closing in on a 2.0 release, I would like the team to reconsider a built in version manager similar to how rust has rustup. Having a version manager provided by deno will provide more stability for older projects, as well as for newer projects.
If this gets support from the Deno team, I would be happy to contribute with the code changes.
Features
denoVersion
orengines.deno
property (not both, we just have to decide on the better path)Challenges:
Possible challenges will amongst other be backwards compatibility for deno versions that does not consider a deno version property. To get around this, the deno executable could be split up into three separate parts:
deno
command, but will only check the version restriction and forward the command to the deno executable if the restrictions are satisfied.Out of scope:
User stories
A developer runs the installer script for deno. The script first installs a separate tool
denoup
, which will be executed to install the latest version of deno and set it as active. The developer would create a new deno project usingdeno init
. The newly createddeno.json
will not contain the deno version property, so by default, the active deno version will be used.A developer has deno version
1.2.3
installed on their system, and wants to clone a deno project from GitHub. The project has adeno.json
file with the deno version~1.0.20
. The developer runsdeno task run
which compares the versions. The semver does not match the installed version so deno gives back an error saying that the engine version does not satisfies the requirements of the package. The output statesDeno version is not satisfied, please run again with "--sync-version" or use the latest satisfied version by running "denoup use ~1.0.20" (optionally add "--latest" if you want to check for the latest allowed version)
.A developer has deno version
1.2.3
installed on their system, and wants to clone a deno project from GitHub. The project has adeno.json
file with the deno version>=1.1.1 <1.2.4
. The developer runsdeno task run
which compares the versions. The active deno version is withing the range, so the script will run.Existing work