project-name
Advanced tools
Comparing version 0.2.1 to 0.2.2
24
index.js
@@ -22,3 +22,3 @@ /*! | ||
module.exports = function (fp) { | ||
module.exports = function(fp) { | ||
return pkgname(fp) || gitname(fp) || basename(fp); | ||
@@ -31,5 +31,10 @@ }; | ||
function pkgname(fp) { | ||
var pkg = utils.pkg(fp); | ||
if (pkg) return pkg.name; | ||
function pkgname(dir) { | ||
var file = utils.findPkg(dir); | ||
if (file) { | ||
try { | ||
var pkg = require(path.resolve(file)); | ||
return pkg.name; | ||
} catch (err) {} | ||
} | ||
return; | ||
@@ -65,7 +70,10 @@ } | ||
if (cached) return cached; | ||
var dir = utils.cwd(fp); | ||
if (fs.statSync(dir).isFile()) { | ||
dir = path.dirname(dir); | ||
} | ||
var dir = utils.findPkg(fp); | ||
try { | ||
var stat = fs.statSync(dir); | ||
if (stat.isFile()) { | ||
dir = path.dirname(dir); | ||
} | ||
} catch (err) {} | ||
return (cached = dir); | ||
} |
{ | ||
"name": "project-name", | ||
"description": "Get the name of a project, from package.json, git config, or basename of the current working directory.", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"homepage": "https://github.com/jonschlinkert/project-name", | ||
@@ -23,7 +23,7 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
}, | ||
"preferGlobal": true, | ||
"dependencies": { | ||
"cwd": "^0.8.4", | ||
"git-repo-name": "^0.5.0", | ||
"lazy-cache": "^0.2.4", | ||
"load-pkg": "^2.0.1" | ||
"find-pkg": "^0.1.0", | ||
"git-repo-name": "^0.5.1", | ||
"lazy-cache": "^0.2.4" | ||
}, | ||
@@ -30,0 +30,0 @@ "devDependencies": { |
@@ -1,2 +0,2 @@ | ||
# project-name [![NPM version](https://badge.fury.io/js/project-name.svg)](http://badge.fury.io/js/project-name) | ||
# project-name [![NPM version](https://badge.fury.io/js/project-name.svg)](http://badge.fury.io/js/project-name) [![Build Status](https://travis-ci.org/jonschlinkert/project-name.svg)](https://travis-ci.org/jonschlinkert/project-name) | ||
@@ -67,2 +67,2 @@ > Get the name of a project, from package.json, git config, or basename of the current working directory. | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on November 04, 2015._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on November 27, 2015._ |
@@ -27,5 +27,4 @@ 'use strict'; | ||
require('cwd'); | ||
require('git-repo-name', 'git'); | ||
require('load-pkg', 'pkg'); | ||
require('find-pkg'); | ||
@@ -32,0 +31,0 @@ /** |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6579
3
94
4
+ Addedfind-pkg@^0.1.0
- Removedcwd@^0.8.4
- Removedload-pkg@^2.0.1
- Removedarr-diff@2.0.0(transitive)
- Removedarr-flatten@1.1.0(transitive)
- Removedarray-unique@0.2.1(transitive)
- Removedbraces@1.8.5(transitive)
- Removedcwd@0.8.4(transitive)
- Removedexpand-brackets@0.1.5(transitive)
- Removedexpand-range@1.8.2(transitive)
- Removedextglob@0.3.2(transitive)
- Removedfilename-regex@2.0.1(transitive)
- Removedfill-range@2.2.4(transitive)
- Removedfor-in@1.0.2(transitive)
- Removedfor-own@0.1.5(transitive)
- Removedglob-base@0.3.0(transitive)
- Removedglob-parent@2.0.0(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedis-dotfile@1.0.3(transitive)
- Removedis-equal-shallow@0.1.3(transitive)
- Removedis-extendable@0.1.1(transitive)
- Removedis-extglob@1.0.0(transitive)
- Removedis-glob@2.0.1(transitive)
- Removedis-number@2.1.04.0.0(transitive)
- Removedis-posix-bracket@0.1.1(transitive)
- Removedis-primitive@2.0.0(transitive)
- Removedisarray@1.0.0(transitive)
- Removedisobject@2.1.0(transitive)
- Removedkind-of@3.2.26.0.3(transitive)
- Removedlazy-cache@1.0.4(transitive)
- Removedload-pkg@2.0.1(transitive)
- Removedlook-up@0.8.3(transitive)
- Removedmath-random@1.0.4(transitive)
- Removedmicromatch@2.3.11(transitive)
- Removednormalize-path@2.1.1(transitive)
- Removedobject.omit@2.0.1(transitive)
- Removedparse-glob@3.0.4(transitive)
- Removedpreserve@0.2.0(transitive)
- Removedrandomatic@3.1.1(transitive)
- Removedregex-cache@0.4.4(transitive)
- Removedremove-trailing-separator@1.1.0(transitive)
- Removedrepeat-element@1.1.4(transitive)
- Removedrepeat-string@1.6.1(transitive)
Updatedgit-repo-name@^0.5.1