Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

get-pkg-repo

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-pkg-repo - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

49

cli.js

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

'Examples',
' get-pkg-repo',
' get-pkg-repo bitbucket.org/a/b.git',
'',
' cat package.json | get-pkg-repo --fix-typo'

@@ -23,14 +23,43 @@ ].join('\n')

if (cli.input.length > 0) {
forEach(cli.input, function(repo) {
var pkgData = {
repository: repo
};
console.log(getPkgRepo(pkgData, flags.fixTypo));
});
if (process.stdin.isTTY) {
if (cli.input[0]) {
forEach(cli.input, function(repo) {
var url;
var pkgData = {
repository: repo
};
try {
url = getPkgRepo(pkgData, flags.fixTypo, flags.warn);
console.log(url);
} catch (e) {
console.error(e.toString());
}
});
} else {
process.stdin
.pipe(through(function(chunk, enc, callback) {
var url;
var pkgData = {
repository: chunk.toString()
};
try {
url = getPkgRepo(pkgData, flags.fixTypo, flags.warn);
callback(null, url + '\n');
} catch (e) {
console.error(e.toString());
callback(null);
}
}))
.pipe(process.stdout);
}
} else {
process.stdin
.pipe(through(function(chunk, enc, callback) {
var url = getPkgRepo(chunk.toString(), flags.fixTypo, flags.warn);
var url;
try {
url = getPkgRepo(chunk.toString(), flags.fixTypo, flags.warn);
} catch (e) {
console.error(e.toString());
process.exit(1);
}
callback(null, url + '\n');

@@ -37,0 +66,0 @@ }))

@@ -20,3 +20,3 @@ 'use strict';

} catch (e) {
return '';
throw new Error('Cannot parse non Github Url');
}

@@ -51,3 +51,3 @@ }

if (typeof url !== 'string') {
return '';
throw new Error('Cannot get repository');
}

@@ -54,0 +54,0 @@

{
"name": "get-pkg-repo",
"version": "0.0.3",
"version": "0.0.4",
"description": "Get repository url from package json data",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/stevemao/get-pkg-repo",

@@ -64,5 +64,13 @@ # [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage Status][coverall-image]][coverall-url]

You can use cli to see what your url will look like after being parsed. You can write more than one repository urls at a time.
You can use cli to see what your url will look like after being parsed.
You can enter interactive mode by typing
```sh
$ get-pkg-repo
```
You can use the command followed by a url. You can write more than one repository urls at a time.
```sh
$ npm install --global get-pkg-repo

@@ -69,0 +77,0 @@ $ get-pkg-repo bitbucket.org/a/b.git

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