Dashboard sipadu mbip
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

Paths.js 897B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. let argv = require('yargs').argv;
  2. class Paths {
  3. /**
  4. * Create a new Paths instance.
  5. */
  6. constructor() {
  7. if (argv['$0'].includes('ava')) {
  8. this.rootPath = path.resolve(__dirname, '../');
  9. } else {
  10. this.rootPath = process.cwd();
  11. }
  12. }
  13. /**
  14. * Set the root path to resolve webpack.mix.js.
  15. *
  16. * @param {string} path
  17. */
  18. setRootPath(path) {
  19. this.rootPath = path;
  20. return this;
  21. }
  22. /**
  23. * Determine the path to the user's webpack.mix.js file.
  24. */
  25. mix() {
  26. return this.root(
  27. argv.env && argv.env.mixfile ? argv.env.mixfile : 'webpack.mix'
  28. );
  29. }
  30. /**
  31. * Determine the project root.
  32. *
  33. * @param {string|null} append
  34. */
  35. root(append = '') {
  36. return path.resolve(this.rootPath, append);
  37. }
  38. }
  39. module.exports = Paths;