Skip to content

Commit 60a6aa7

Browse files
author
Tonye Jack
committed
Updated the imports.
1 parent 46f2ef7 commit 60a6aa7

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

bin/graphql-codegen-hook.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
'use strict';
44
const minimatch = require('minimatch');
5+
const shell = require('shelljs');
56

67
const argv = require('yargs')
78
.option('config', { alias: 'c', required: true, type: 'string' })
@@ -11,16 +12,16 @@ const argv = require('yargs')
1112
.argv;
1213

1314
const { filenames = [] } = argv;
14-
const shouldExecute = filenames.filter(minimatch.filter("*.+(tsx?|jsx?)", { matchBase: true })).length > 0;
15-
16-
const shell = require('shelljs');
17-
const basePath = shell.pwd().toString();
18-
19-
shell.cd(basePath);
15+
const fileMatches = filenames.filter(minimatch.filter("*.+(tsx|jsx|js|ts)", { matchBase: true }));
16+
const shouldExecute = fileMatches.length > 0;
2017

2118
if (!shouldExecute) {
2219
shell.exit(0);
2320
} else {
21+
const basePath = shell.pwd().toString();
22+
23+
shell.cd(basePath);
24+
2425
const child = shell.exec(`npx graphql-codegen --config ${argv.config}`, {
2526
async: true,
2627
verbose: argv.verbose

0 commit comments

Comments
 (0)