Skip to content

Commit

Permalink
remove some comments and upgrade readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
AlessandroMinoccheri committed Mar 20, 2017
1 parent 50a5603 commit 1ae94b5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 117 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

[![Build Status](https://api.travis-ci.org/AlessandroMinoccheri/package-info.png)](https://travis-ci.org/AlessandroMinoccheri/package-info)

> Get the information of a npm package and return an object
> Get information about NPM packages. Contribute to package-info development by creating an account on GitHub.
Fetches the information directly from the registry
Fetches the information directly from the registry

https://www.npmjs.org/package/package-info

Expand Down Expand Up @@ -59,9 +59,9 @@ Example

It will prints:
```
name: package-info
name: package-info
version: 2.2.3
description: Get the information of a npm package
description: Get the information of a npm package
license: MIT
homepage: https://github.com/AlessandroMinoccheri/package-info
author: Alessandro Minoccheri
Expand All @@ -78,4 +78,3 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

10 changes: 0 additions & 10 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,3 @@ info(input)
console.error(err);
process.exit(1);
});

/*info(input, function (err, version) {
if (err) {
console.error(err);
process.exit(1);
return;
}
console.log(version);
});*/
100 changes: 0 additions & 100 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,104 +61,4 @@ module.exports = function (name) {

throw err;
});

/*return got(url).then(function (res) {
var $ = cheerio.load(res.body);
return {
name: $('.fullname').text() || null,
email: unobfuscateEmail($('.email [data-email]').attr('data-email')) || null,
homepage: $('.homepage a').attr('href') || null,
github: $('.github a').text().slice(1) || null,
twitter: $('.twitter a').text().slice(1) || null,
freenode: $('.freenode a').text() || null
};
}).catch(function (err) {
if (err.statusCode === 404) {
err.message = 'User doesn\'t exist';
}
throw err;
});*/
};

/*function request(name) {
return got.head(registryUrl + name.toLowerCase())
.then(() => false)
.catch(err => {
if (err.statusCode === 404) {
return true;
}
throw err;
});
}
/*
module.exports = name => {
if (!(typeof name === 'string' && name.length !== 0)) {
return Promise.reject(new Error('Package name required'));
}
return request(name);
};*/

/*module.exports = name => {
//if (!(typeof name === 'string' && name.length !== 0)) {
// return Promise.reject(new Error('Package name required'));
//}
return request(name);
/*
got(registryUrl + encodeURIComponent(name), {method: 'GET'}, function (err, data) {
var name = '';
var version = '';
var description = '';
var license = '';
var homepage = '';
var author_name = '';
if (err === 404) {
return cb(new Error('Package doesn\'t exist'));
}
if (err) {
return cb(err);
}
var data_parsed = JSON.parse(data);
var name = data_parsed.name;
var version = data_parsed[ 'dist-tags' ].latest;
var description = data_parsed.description;
var license = data_parsed.license;
if(data_parsed.homepage !== undefined){
var homepage = data_parsed.homepage;
}
if(data_parsed.author !== undefined){
var author_name = data_parsed.author.name;
}
else{
if(data_parsed.maintainers !== undefined){
for (var i in data_parsed.maintainers) {
var maintainer = data_parsed.maintainers[i];
if(author_name == ''){
author_name = maintainer.name;
}
else{
author_name = author_name + ', ' + maintainer.name;
}
}
}
}
cb(null, {
name : name,
version : version,
description : description,
license : license,
homepage : homepage,
author : author_name
});
});*/
//};
2 changes: 0 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
var assert = require('assert');
var info = require('./index');


it('should get the latest info of a package', function (done) {
//this.timeout(500000);
info('package-info', function (err, info) {
assert(!err, err);
assert(info);
Expand Down

0 comments on commit 1ae94b5

Please sign in to comment.