版博士V2.0程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

19 lines
452 B

  1. var path = require('path');
  2. module.exports = function (opts) {
  3. if (!opts) {
  4. opts = {};
  5. }
  6. var cwd = opts.cwd;
  7. var configPath = opts.configPath;
  8. // if a path to the desired config was specified
  9. // but no cwd was provided, use configPath dir
  10. if (typeof configPath === 'string' && !cwd) {
  11. cwd = path.dirname(path.resolve(configPath));
  12. }
  13. if (typeof cwd === 'string') {
  14. return path.resolve(cwd);
  15. }
  16. return process.cwd();
  17. };