chore: add cwd option when calling globby (#4442)

Make globby working as expected when project path contains parentheses.

Close #4417.
This commit is contained in:
zrh122
2019-08-21 16:33:29 +08:00
committed by Haoqun Jiang
parent 55e1c3ca56
commit 51cd831cd5
4 changed files with 4 additions and 6 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ module.exports = function lint (args = {}, api) {
]
.filter(pattern =>
globby
.sync(path.join(cwd, pattern))
.sync(pattern, { cwd, absolute: true })
.some(p => !engine.isPathIgnored(p))
)
@@ -36,7 +36,7 @@ function reset (context) {
}
function _loadFolder (root, context) {
const paths = globby.sync([path.join(root, './locales/*.json')])
const paths = globby.sync(['./locales/*.json'], { cwd: root, absolute: true })
paths.forEach(file => {
const basename = path.basename(file)
const lang = basename.substr(0, basename.indexOf('.'))
@@ -1,5 +1,4 @@
const { withFilter } = require('graphql-subscriptions')
const path = require('path')
const globby = require('globby')
const merge = require('lodash.merge')
const { GraphQLJSON } = require('graphql-type-json')
@@ -90,7 +89,7 @@ const resolvers = [{
}]
// Load resolvers in './schema'
const paths = globby.sync([path.join(__dirname, './schema/*.js')])
const paths = globby.sync(['./schema/*.js'], { cwd: __dirname, absolute: true })
paths.forEach(file => {
const { resolvers: r } = require(file)
r && resolvers.push(r)
@@ -1,5 +1,4 @@
const gql = require('graphql-tag')
const path = require('path')
const globby = require('globby')
const typeDefs = [gql`
@@ -86,7 +85,7 @@ type Subscription {
`]
// Load types in './schema'
const paths = globby.sync([path.join(__dirname, './schema/*.js')])
const paths = globby.sync(['./schema/*.js'], { cwd: __dirname, absolute: true })
paths.forEach(file => {
const { types } = require(file)
types && typeDefs.push(types)