A module version manager for Deno

A module version manager for Deno

A simple module version manager for Deno. dem creates `dem.json` and links script files with version

dem

  • A simple module version manager for Deno.
  • dem creates dem.json and links script files with version.
    • linked scripts are stored in vendor directory.
  • dem provides an easy way to update dependencies.

Example

Using https://deno.land/std/http/server.ts at v0.51.0

  • dem.json
    • generated file like a package.json
{
  "modules": [
    {
      "protocol": "https",
      "path": "deno.land/std",
      "version": "v0.51.0",
      "files": [
        "/http/server.ts"
      ]
    }
  ]
}
  • vendor/https/deno.land/std/http/server.ts
    • generated linked script includes version specified in dem.json
export * from "https://deno.land/[email protected]/http/server.ts";
  • example.ts
    • script to run
// You can import module without the version.
import { serve } from "./vendor/https/deno.land/std/http/server.ts";

Install

deno install --allow-read --allow-write --allow-net -f -n dem https://deno.land/x/[email protected]/cmd.ts

Usage

Getting Started

1. dem init to create dem.json
$ dem init
successfully initialized the project.
2. dem add to add module.
$ dem add https://deno.land/[email protected]
successfully added new module: https://deno.land/std, version: v0.51.0
3. Edit your script and import module from vendor.

example.ts

import * as path from './vendor/https/deno.land/std/fs/path.ts';

console.log(path.join(Deno.cwd(), 'example'));
4. dem ensure to resolve modules.
$ dem ensure
successfully created link: https://deno.land/[email protected]/fs/path.ts
5. Run your script.
$ deno example.ts

Standard Usage

Updating module

  • dem update updates versions in dem.json and linked scripts.
$ dem update https://deno.land/[email protected]
successfully updated module: https://deno.land/std, version: v0.52.0

Advanced Usage

Alias

  • With alias, shortened script paths are available.

example.ts

// Original
import * as dejs from "./vendor/https/deno.land/x/dejs/mod.ts"
// With alias
import * as dejs from "./vendor/dejs.ts"
How to use alias
  1. execute dem alias.
# create alias for module.
$ dem alias https://deno.land/x/dejs/mod.ts dejs.ts # ./vendor/dejs.ts will be created.
  1. import script using alias path
import * as dejs from "./vendor/dejs.ts"
  1. run dem ensure.
# create link for `./vendor/https/deno.land/x/dejs/mod.ts`.
$ dem ensure

Commands

dem init                                          # initialize dem.json
dem add https://deno.land/x/[email protected]            # add module `dejs` and set its version to `0.1.0`
dem link https://deno.land/x/dejs/mod.ts          # create link of `[email protected]/mod.ts` and put it into vendor.
dem update https://deno.land/x/[email protected]         # update module to `0.2.0`
dem unlink https://deno.land/x/dejs/mod.ts        # remove link of `[email protected]/mod.ts`.
dem remove https://deno.land/x/dejs               # remove module `dejs`
dem ensure                                        # resolve file paths of added modules used in project and link them.
dem prune                                         # remove unused modules and linked scripts.
dem alias https://deno.land/x/dejs/mod.ts dejs.ts # create alias for module and put it into vendor.
dem unalias dejs.ts                               # remove alias for module.

Unsupported features

  • default export
  • manage .d.ts file

Author

syumai

Download Details:

Author: syumai

Source Code: https://github.com/syumai/dem

deno node nodejs javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

AEM Querybuilder for JavaScript (Browser, Node, Deno)

Helix Querybuilder .AEM Querybuilder for JavaScript (Browser, Node, Deno)

NKeys for JavaScript - Node.js, Browsers, and Deno

A public-key signature system based on Ed25519 for the NATS ecosystem system for JavaScript. The nkeys.js library works in Deno, Node.js, and the browser!

Javascript module for easily generating mazes,compatible with both Deno and Node

A work-in-progress Javascript maze generator module, compatible with both Deno and Node.

Deno Tutorial for Beginners: Deno vs. Node: Better Than NodeJS?

Deno is released, it’s time to find out if it can prove a worthy competition for Node.js. What is Deno? Why Deno can be considered an alternative to Node? The main differences between Deno and Node. Write a simple Deno app.

What is Deno? The Node.JS Killer? The Deno-minator to Node?

What is Deno? The Node.JS Killer? The Deno-minator to Node? Deno is the new hype and will it be better than node.js? Deno is a secure runtime for JavaScript and TypeScript that is based on the V8 JavaScript engine and the Rust programming language that addresses Node’s shortcomings