getChangedFiles.js 385 B

123456789101112131415161718
  1. const { execa, hasProjectGit } = require('@vue/cli-shared-utils')
  2. module.exports = async function getChangedFiles (context) {
  3. if (!hasProjectGit(context)) return []
  4. const { stdout } = await execa('git', [
  5. 'ls-files',
  6. '-o',
  7. '--exclude-standard',
  8. '--full-name'
  9. ], {
  10. cwd: context
  11. })
  12. if (stdout.trim()) {
  13. return stdout.split(/\r?\n/g)
  14. }
  15. return []
  16. }