dev.js 916 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. Run Rollup in watch mode for development.
  3. To specific the package to watch, simply pass its name and the desired build
  4. formats to watch (defaults to "global"):
  5. ```
  6. # name supports fuzzy match. will watch all packages with name containing "dom"
  7. yarn dev dom
  8. # specify the format to output
  9. yarn dev core --formats cjs
  10. # Can also drop all __DEV__ blocks with:
  11. __DEV__=false yarn dev
  12. ```
  13. */
  14. const execa = require('execa')
  15. const { fuzzyMatchTarget } = require('./utils')
  16. const args = require('minimist')(process.argv.slice(2))
  17. const target = args._.length ? fuzzyMatchTarget(args._)[0] : 'vue'
  18. const formats = args.formats || args.f
  19. const commit = execa.sync('git', ['rev-parse', 'HEAD']).stdout.slice(0, 7)
  20. execa(
  21. 'rollup',
  22. [
  23. '-wc',
  24. '--environment',
  25. [
  26. `COMMIT:${commit}`,
  27. `TARGET:${target}`,
  28. `FORMATS:${formats || 'global'}`
  29. ].join(',')
  30. ],
  31. {
  32. stdio: 'inherit'
  33. }
  34. )