bencodezen / vue-enterprise-boilerplate

An ever-evolving, very opinionated architecture and dev environment for new Vue SPA projects using Vue CLI.
7.78k stars 1.32k forks source link

.DS_Store file breaks mock-api #57

Closed JamesLarson closed 6 years ago

JamesLarson commented 6 years ago

Im working on a mac, the OS put a .DS_Store file into the tests/mock-api/routes/ directory.

This resulted in breaking the require statement on line 9 of tests/mock-api/index.js because the .DS_Store file does not have module.exports defined inside it.

I suggest adding something like this before to fix the problem

if(fs.existsSync(`${path.join(__dirname, 'routes')}/.DS_Store`)){
    fs.unlinkSync(`${path.join(__dirname, 'routes')}/.DS_Store`)
  }

I have not gone through the rest of the project to see if entire directories of files are being required in this way elsewhere, but a project wide solution to this problem may be better.

JamesLarson commented 6 years ago

on second thought, a more elegant solution may be to loop over only files with a .js extension

chrisvfritz commented 6 years ago

I just added a fix for this. Thanks for reporting it! 🙂