Skip to content

Commit

Permalink
chore: add cwd option when calling globby (vuejs#4442)
Browse files Browse the repository at this point in the history
Make globby working as expected when project path contains parentheses.

Close vuejs#4417.
  • Loading branch information
zrh122 authored and haoqunjiang committed Aug 21, 2019
1 parent 55e1c3c commit 51cd831
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/@vue/cli-plugin-eslint/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
)

Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-ui/apollo-server/connectors/locales.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('.'))
Expand Down
3 changes: 1 addition & 2 deletions packages/@vue/cli-ui/apollo-server/resolvers.js
Original file line number Diff line number Diff line change
@@ -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')
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions packages/@vue/cli-ui/apollo-server/type-defs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const gql = require('graphql-tag')
const path = require('path')
const globby = require('globby')

const typeDefs = [gql`
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 51cd831

Please sign in to comment.