New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dvm

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dvm - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

.travis.yml

63

bin/dvm.js

@@ -16,4 +16,2 @@ #!/usr/bin/env node

const is_admin = require("is-admin");
const path = require("path");

@@ -23,2 +21,3 @@ const fs = require("fs");

const is_admin = require("is-admin");
const program = require("commander");

@@ -29,2 +28,3 @@ const npm_prefix = require("npm-prefix")();

const request = require("request");
const debug = require("debug");

@@ -35,2 +35,6 @@ const pkg = require("../package.json");

const E = debug("dvm:error");
const W = debug("dvm:warn");
const I = debug("dvm:info");
const DVM_PATH = process.env.DVM_PATH || path.join(os.homedir(), ".dvm");

@@ -50,8 +54,10 @@ const DENO_EXECUTOR = "deno" + (process.platform === "win32" ? ".exe" : "");

program.version(pkg.version, "-v, --version");
program
.version(pkg.version, "-v, --version")
.description("Easy way to manage multiple active deno versions")
.option("-d, --debug", "Print verbose infos for debug");
program
.command("arch")
// .option("-s, --setup_mode [mode]", "Which setup mode to use")
.description("Show if deno is running in 32 or 64 bit mode.")
.description("Show if deno is running in 32 or 64 bit mode")
.action(() => {

@@ -72,2 +78,3 @@ console.log("System Arch: %s_%s.", process.platform, process.arch);

.action(function(version) {
I("check whether the current version is installed");
if (fs.existsSync(path.join(DVM_PATH, version))) {

@@ -82,2 +89,5 @@ console.log(

I("deno v%s is not installed", version);
I("try to download...", version);
download(version)

@@ -102,3 +112,3 @@ .then(filePath => extractDownload(filePath, path.join(DVM_PATH, version)))

.command("use [version]")
.description("Switch to use the specified version.")
.description("Switch to use the specified version")
.action(version => {

@@ -131,9 +141,9 @@ if (version !== undefined) {

program.on("option:verbose", function() {
process.env.VERBOSE = this.verbose;
program.on("option:debug", () => {
debug.enable("*");
});
program.on("command:*", function() {
console.error(
"Invalid command: %s\nSee --help or -h for a list of available commands.",
program.on("command:*", () => {
console.log(
"Invalid command: '%s'. See 'dvm --help' for a list of available commands.",
program.args.join(" ")

@@ -146,3 +156,3 @@ );

if (process.argv.length === 2) {
if (program.args.length === 0) {
program.help();

@@ -164,3 +174,6 @@ }

try {
I("deno symbolic link: %s", DENO_PATH);
const link = fs.readlinkSync(DENO_PATH);
I("deno installed path: %s", link);
version = link && path.basename(path.resolve(link, ".."));

@@ -187,2 +200,4 @@ } catch (e) {} /* eslint-disable-line no-empty */

let ln = path.join(DVM_PATH, version, DENO_EXECUTOR);
I("deno location: %s", ln);
let stat;

@@ -202,3 +217,10 @@

I("check elevated");
if (!admin) {
W("permissions check failed");
E(
"deno v%s has been installed on you computer successfully, but we con't use it",
version
);
console.error(

@@ -232,3 +254,6 @@ "You may have to run dvm in a shell (cmd, PowerShell, Git Bash, etc) with elevated (Administrative) privileges to get it to run."

function get_download_url(version, registry = "denocn") {
I("using mirror %s", registry);
const url_prefix = registries[registry].registry;
I("using registry %s", url_prefix);
let name;

@@ -254,2 +279,4 @@

let url = get_download_url(version, registry);
I("remote package url: %s", url);
let downloaded_file;

@@ -262,5 +289,8 @@

downloaded_file = path.join(tmpdir, fileName);
I("file will save at %s", downloaded_file);
if (fs.existsSync(downloaded_file)) {
I("file already exists, try to delete it...");
fs.unlinkSync(downloaded_file);
I("delete successfully");
return verify_checksum();

@@ -294,2 +324,3 @@ }

return new Promise((resolve, reject) => {
I("start downloading");
request(url)

@@ -307,5 +338,2 @@ .on("response", function(response) {

// Start the install.
console.log("Downloading from ", url);
const bar = new ProgressBar(" downloading [:bar] :percent :etas", {

@@ -324,2 +352,3 @@ complete: "=",

response.on("end", function() {
I("download finish");
writeStream.end();

@@ -329,3 +358,5 @@ });

writeStream.on("finish", function() {
I("successfully downloaded files to local files");
fs.renameSync(writePath, filePath);
I("rename %s to %s", writePath, filePath);
resolve(filePath);

@@ -360,3 +391,5 @@ });

if (fs.existsSync(extractedPath)) {
I("file <%s> already exists, try to delete it...", extractedPath);
fs.rmdirSync(extractedPath);
I("delete successfully");
}

@@ -363,0 +396,0 @@

{
"name": "dvm",
"version": "0.1.6",
"version": "0.1.7",
"keywords": [

@@ -37,2 +37,3 @@ "deno",

"compressing": "^1.3.1",
"debug": "^3.1.0",
"ini": "^1.3.5",

@@ -43,3 +44,4 @@ "is-admin": "^2.1.1",

"request": "^2.88.0",
"request-progress": "^3.0.0"
"request-progress": "^3.0.0",
"string-similarity": "^1.2.1"
},

@@ -46,0 +48,0 @@ "devDependencies": {

Deno Version Manager
=====
[![npm package](https://nodei.co/npm/dvm.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/dvm/)
[![Build Status](https://travis-ci.com/justjavac/dvm.svg?branch=master)](https://travis-ci.com/justjavac/dvm)
[![NPM version](https://img.shields.io/npm/v/dvm.svg)](https://www.npmjs.com/package/dvm)
[![NPM Downloads](https://img.shields.io/npm/dm/dvm.svg?style=flat)](https://npmcharts.com/compare/dvm?minimal=true)
[![Install Size](https://packagephobia.now.sh/badge?p=dvm)](https://packagephobia.now.sh/result?p=dvm)
Switch between different versions of [Deno](https://github.com/denoland/deno).

@@ -31,2 +38,3 @@

-v, --version output the version number
-d, --debug Print verbose infos for debug
-h, --help output usage information

@@ -36,6 +44,6 @@

arch Show if deno is running in 32 or 64 bit mode.
arch Show if deno is running in 32 or 64 bit mode
list List all installed versions
install <version> Install deno <version>
use [version] Switch to use the specified version.
use [version] Switch to use the specified version
```

@@ -108,10 +116,13 @@

## Credits
## Authors
* GitHub ([justjavac](http://github.com/justjavac))
* Twitter ([@justjavac](http://twitter.com/justjavac))
* Weibo ([@justjavac](http://weibo.com/justjavac))
- [justjavac](http://github.com/justjavac)
## Contributors
- [justjavac](http://github.com/justjavac)
- [jysperm](http://github.com/jysperm)
## License
Deno Version Manager(dvm) is released under the GPL License. See the bundled [LICENSE](./LICENSE) file for details.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc