Skip to content

Simple version ensurer for Deno that check {deno, typescript, v8} version for users of your module and prevent them from incompatibylities error

License

Notifications You must be signed in to change notification settings

JOTSR/ensure_version

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EnsureVersion

Simple version ensurer for Deno that check {deno, typescript, v8} version for users of your module and prevent them from incompatibylities error.

Use semver to check versions

Tags deno doc

Usage

Import

import ensureVersion from "https://deno.land/x/ensure_version/mod.ts";

Simply add it in your mod.ts

//some semver version constraint
ensureVersion(">1.18.0")
//or full Deno.version
ensureVersion({ deno: "1.19.2", v8: "9.9.115.7", typescript: "4.5.2" })

Examples

 // Deno.version.deno = "1.9.4"
 ensureVersion(">=1.8.0")
 //warn minor updated

 // Deno.version.deno = "1.9.4"
 ensureVersion("1.9.3")
 //throw version error
 
 // Deno.version.deno = "1.9.4"
 ensureVersion("1.5.2 || 1.8.0 - 2.0.0")
 //pass

 // Deno.version = {deno: "1.9.4", typescript: "4.5.2", v8: "9.9.115.7"}
 const required = {deno: ">=1.8.0"}
 ensureVersion(required, false)
 //no logs

 // Deno.version = {deno: "1.9.4", typescript: "4.5.2", v8: "9.9.115.7"}
 const required = {deno: ">=1.8.0", typescript: "3.2.1"}
 ensureVersion(required)
 //throw version error

 // Deno.version = {deno: "1.9.4", typescript: "4.5.2", v8: "9.9.115.7"}
 const required = {}
 ensureVersion(required)
 //warn empty argument

 // Deno.version = {deno: "1.9.4", typescript: "4.5.2", v8: "9.9.115.7"}
 const required = {deno: "<1.9.5", typescript: "4.0.0 - 4.5.2", v8: "8.3.102 || 9.9.155"}
 ensureVersion(required)
 //pass

All the modules are exposed in mod.ts

Documentation

About

Simple version ensurer for Deno that check {deno, typescript, v8} version for users of your module and prevent them from incompatibylities error

Resources

License

Stars

Watchers

Forks

Packages

No packages published