dependents-editor-backend
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -25,3 +25,3 @@ #!/usr/bin/env node | ||
.option('--get-tree', 'get the dependency tree of the current file') | ||
.option('--get-path', 'get the trimmed path of the current file') | ||
.option('--get-path', 'get the import form of the current filename') | ||
@@ -28,0 +28,0 @@ // Modifiers |
var Config = require('./Config'); | ||
var getPath = require('./getPath'); | ||
@@ -14,3 +15,3 @@ var cabinet = require('filing-cabinet'); | ||
debug('given values', program); | ||
debug('given program options', program); | ||
@@ -24,3 +25,5 @@ var config; | ||
} catch (e) { | ||
debug('error when searching for deprc file: ' + e.message); | ||
deferred.reject(e.message); | ||
return deferred.promise; | ||
} | ||
@@ -69,2 +72,9 @@ | ||
}); | ||
} else if (program.getPath) { | ||
deferred.resolve(getPath({ | ||
filename: options.filename, | ||
directory: options.directory, | ||
stylesDirectory: config.stylesRoot | ||
})); | ||
} | ||
@@ -71,0 +81,0 @@ |
@@ -22,2 +22,4 @@ var fs = require('fs'); | ||
Config.prototype.find = function(directory) { | ||
debug('searching for deprc in ' + directory); | ||
if (!directory || directory === '/') { | ||
@@ -52,22 +54,15 @@ throw new Error('.deprc file could not be found'); | ||
this.stylesRoot = config.styles_root || config.sass_root; | ||
this.buildConfig = config.build_config; | ||
this.webpackConfig = config.webpack_config; | ||
this.requireConfig = config.config || config.require_config; | ||
this.directory = config.root || this.stylesRoot; | ||
this.stylesRoot = getAbsolute(config.styles_root || config.sass_root, configPath); | ||
this.buildConfig = getAbsolute(config.build_config, configPath); | ||
this.webpackConfig = getAbsolute(config.webpack_config, configPath); | ||
this.requireConfig = getAbsolute(config.config || config.require_config, configPath); | ||
this.directory = getAbsolute(config.root || this.stylesRoot, configPath); | ||
if (this.requireConfig) { | ||
this.requireConfig = path.resolve(path.dirname(configPath), this.requireConfig); | ||
} | ||
if (this.webpackConfig) { | ||
this.webpackConfig = path.resolve(path.dirname(configPath), this.webpackConfig); | ||
} | ||
// CSS users shouldn't need to supply a JS root | ||
this.directory = path.resolve(path.dirname(configPath), this.directory); | ||
this.exclude = config.exclude ? config.exclude.split(',') : []; | ||
}; | ||
function getAbsolute(filepath, base) { | ||
return filepath ? path.resolve(path.dirname(base), filepath) : ''; | ||
} | ||
/** | ||
@@ -74,0 +69,0 @@ * @private |
{ | ||
"name": "dependents-editor-backend", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "The brains behind Dependents editor plugins", | ||
@@ -5,0 +5,0 @@ "main": "lib/cli.js", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
8612
8
205
0