Simple email application for Android. Original source code: https://framagit.org/dystopia-project/simple-email
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.

39 lines
766 B

  1. 'use strict';
  2. const path = require('path');
  3. const pathKey = require('path-key');
  4. module.exports = opts => {
  5. opts = Object.assign({
  6. cwd: process.cwd(),
  7. path: process.env[pathKey()]
  8. }, opts);
  9. let prev;
  10. let pth = path.resolve(opts.cwd);
  11. const ret = [];
  12. while (prev !== pth) {
  13. ret.push(path.join(pth, 'node_modules/.bin'));
  14. prev = pth;
  15. pth = path.resolve(pth, '..');
  16. }
  17. // ensure the running `node` binary is used
  18. ret.push(path.dirname(process.execPath));
  19. return ret.concat(opts.path).join(path.delimiter);
  20. };
  21. module.exports.env = opts => {
  22. opts = Object.assign({
  23. env: process.env
  24. }, opts);
  25. const env = Object.assign({}, opts.env);
  26. const path = pathKey({env});
  27. opts.path = env[path];
  28. env[path] = module.exports(opts);
  29. return env;
  30. };