Comparing version 0.2.1 to 0.3.0
18
index.js
@@ -12,2 +12,3 @@ /*! | ||
var isValid = require('is-valid-app'); | ||
var find = require('find-pkg'); | ||
@@ -17,2 +18,3 @@ module.exports = function(types) { | ||
if (!isValid(app, 'base-cwd', types)) return; | ||
var cached; | ||
@@ -23,7 +25,9 @@ Object.defineProperty(this, 'cwd', { | ||
set: function(cwd) { | ||
this.cache.cwd = path.resolve(cwd); | ||
cached = path.resolve(cwd); | ||
this.cache.cwd = cached; | ||
app.emit('cwd', cached); | ||
}, | ||
get: function() { | ||
if (typeof this.cache.cwd === 'string') { | ||
return path.resolve(this.cache.cwd); | ||
if (typeof cached === 'string') { | ||
return path.resolve(cached); | ||
} | ||
@@ -33,2 +37,10 @@ if (typeof this.options.cwd === 'string') { | ||
} | ||
var pkgPath = find.sync(process.cwd()); | ||
if (pkgPath) { | ||
var dir = path.dirname(pkgPath); | ||
if (dir !== process.cwd()) { | ||
app.emit('cwd', dir); | ||
} | ||
return dir; | ||
} | ||
return process.cwd(); | ||
@@ -35,0 +47,0 @@ } |
{ | ||
"name": "base-cwd", | ||
"description": "Base plugin that adds a getter/setter for the current working directory.", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"homepage": "https://github.com/node-base/base-cwd", | ||
@@ -13,3 +13,5 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"files": [ | ||
"index.js" | ||
"index.js", | ||
"LICENSE", | ||
"README.md" | ||
], | ||
@@ -24,3 +26,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"is-valid-app": "^0.1.1" | ||
"find-pkg": "^0.1.2", | ||
"is-valid-app": "^0.2.0" | ||
}, | ||
@@ -33,6 +36,16 @@ "devDependencies": { | ||
"keywords": [ | ||
"api", | ||
"app", | ||
"application", | ||
"base", | ||
"baseplugin", | ||
"cwd" | ||
"building-blocks", | ||
"create", | ||
"cwd", | ||
"framework", | ||
"plugin", | ||
"plugins", | ||
"tool", | ||
"toolkit", | ||
"tools" | ||
], | ||
@@ -39,0 +52,0 @@ "verb": { |
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
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
3505
43
2
+ Addedfind-pkg@^0.1.2
+ Addedexpand-tilde@1.2.2(transitive)
+ Addedfind-file-up@0.1.3(transitive)
+ Addedfind-pkg@0.1.2(transitive)
+ Addedfs-exists-sync@0.1.0(transitive)
+ Addedglobal-modules@0.2.3(transitive)
+ Addedglobal-prefix@0.1.5(transitive)
+ Addedhomedir-polyfill@1.0.3(transitive)
+ Addedini@1.3.8(transitive)
+ Addedis-valid-app@0.2.1(transitive)
+ Addedis-valid-instance@0.2.0(transitive)
+ Addedis-windows@0.2.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedos-homedir@1.0.2(transitive)
+ Addedparse-passwd@1.0.0(transitive)
+ Addedresolve-dir@0.1.1(transitive)
+ Addedwhich@1.3.1(transitive)
- Removedis-valid-app@0.1.2(transitive)
- Removedis-valid-instance@0.1.0(transitive)
Updatedis-valid-app@^0.2.0