Skip to content

Commit

Permalink
Fixed cwd var error
Browse files Browse the repository at this point in the history
  • Loading branch information
electerious committed Feb 17, 2017
1 parent a4255c7 commit d6e3b44
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ const isPlainObj = require('is-plain-obj')
*/
const getFiles = function(pattern, cwd) {

return glob.sync(pattern, {
cwd: opts.cwd
})
return glob.sync(pattern, { cwd })

}

Expand Down Expand Up @@ -82,19 +80,19 @@ module.exports = function(pattern, opts) {
}

opts = Object.assign({
cwd: process.cwd(),
dataPaths: (fileName) => {}
cwd : process.cwd(),
dataPaths : () => {}
}, opts)

// Support relative and absolute paths
opts.cwd = path.resolve(process.cwd(), opts.cwd)

const filePaths = getFiles(pattern, cwd)
const filePaths = getFiles(pattern, opts.cwd)

return filePaths.map((filePath) => {

// Ensure that path is absolute
filePath = path.resolve(cwd, filePath)
filePath = path.resolve(opts.cwd, filePath)

return parseComponent(filePath, opts.cwd, opts.dataPaths)

Expand Down

0 comments on commit d6e3b44

Please sign in to comment.