@khanacademy/graphql-flow 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cli/run.js +4 -1
- package/dist/parser/parse.js +4 -1
- package/dist/parser/utils.js +6 -2
- package/package.json +1 -1
- package/src/cli/run.ts +4 -1
- package/src/parser/parse.ts +3 -1
- package/src/parser/utils.ts +5 -1
package/CHANGELOG.md
CHANGED
package/dist/cli/run.js
CHANGED
|
@@ -42,7 +42,10 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
42
42
|
|
|
43
43
|
/** Step (1) */
|
|
44
44
|
const findGraphqlTagReferences = root => {
|
|
45
|
-
|
|
45
|
+
// NOTE(john): We want to include untracked files here so that we can
|
|
46
|
+
// generate types for them. This is useful for when we have a new file
|
|
47
|
+
// that we want to generate types for, but we haven't committed it yet.
|
|
48
|
+
const response = (0, _child_process.execSync)("git grep -I --word-regexp --name-only --fixed-strings --untracked 'graphql-tag' -- '*.js' '*.jsx' '*.ts' '*.tsx'", {
|
|
46
49
|
encoding: 'utf8',
|
|
47
50
|
cwd: root
|
|
48
51
|
});
|
package/dist/parser/parse.js
CHANGED
|
@@ -35,7 +35,10 @@ const listExternalReferences = file => {
|
|
|
35
35
|
if (v.type === 'import') {
|
|
36
36
|
if (followImports) {
|
|
37
37
|
const absPath = (0, _utils.getPathWithExtension)(v.path);
|
|
38
|
-
|
|
38
|
+
|
|
39
|
+
if (absPath) {
|
|
40
|
+
paths[absPath] = true;
|
|
41
|
+
}
|
|
39
42
|
}
|
|
40
43
|
} else {
|
|
41
44
|
v.source.expressions.forEach(expr => add(expr, true));
|
package/dist/parser/utils.js
CHANGED
|
@@ -28,9 +28,13 @@ const getPathWithExtension = pathWithoutExtension => {
|
|
|
28
28
|
|
|
29
29
|
if (_fs.default.existsSync(pathWithoutExtension + '.ts')) {
|
|
30
30
|
return pathWithoutExtension + '.ts';
|
|
31
|
-
}
|
|
31
|
+
} // NOTE(john): This is a bit of a hack, but it's necessary for when we
|
|
32
|
+
// have a file that doesn't exist. This will happen when we delete all of
|
|
33
|
+
// the type files before re-running graphql-flow again. We want to ensure
|
|
34
|
+
// that we don't error out in this case.
|
|
35
|
+
|
|
32
36
|
|
|
33
|
-
|
|
37
|
+
return "";
|
|
34
38
|
};
|
|
35
39
|
|
|
36
40
|
exports.getPathWithExtension = getPathWithExtension;
|
package/package.json
CHANGED
package/src/cli/run.ts
CHANGED
|
@@ -32,8 +32,11 @@ import {dirname} from 'path';
|
|
|
32
32
|
/** Step (1) */
|
|
33
33
|
|
|
34
34
|
const findGraphqlTagReferences = (root: string): Array<string> => {
|
|
35
|
+
// NOTE(john): We want to include untracked files here so that we can
|
|
36
|
+
// generate types for them. This is useful for when we have a new file
|
|
37
|
+
// that we want to generate types for, but we haven't committed it yet.
|
|
35
38
|
const response = execSync(
|
|
36
|
-
"git grep -I --word-regexp --name-only --fixed-strings 'graphql-tag' -- '*.js' '*.jsx' '*.ts' '*.tsx'",
|
|
39
|
+
"git grep -I --word-regexp --name-only --fixed-strings --untracked 'graphql-tag' -- '*.js' '*.jsx' '*.ts' '*.tsx'",
|
|
37
40
|
{
|
|
38
41
|
encoding: 'utf8',
|
|
39
42
|
cwd: root,
|
package/src/parser/parse.ts
CHANGED
|
@@ -105,7 +105,9 @@ const listExternalReferences = (file: FileResult): Array<string> => {
|
|
|
105
105
|
if (v.type === 'import') {
|
|
106
106
|
if (followImports) {
|
|
107
107
|
const absPath = getPathWithExtension(v.path);
|
|
108
|
-
|
|
108
|
+
if (absPath) {
|
|
109
|
+
paths[absPath] = true;
|
|
110
|
+
}
|
|
109
111
|
}
|
|
110
112
|
} else {
|
|
111
113
|
v.source.expressions.forEach((expr) => add(expr, true));
|
package/src/parser/utils.ts
CHANGED
|
@@ -20,5 +20,9 @@ export const getPathWithExtension = (pathWithoutExtension: string): string => {
|
|
|
20
20
|
if (fs.existsSync(pathWithoutExtension + '.ts')) {
|
|
21
21
|
return pathWithoutExtension + '.ts';
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
// NOTE(john): This is a bit of a hack, but it's necessary for when we
|
|
24
|
+
// have a file that doesn't exist. This will happen when we delete all of
|
|
25
|
+
// the type files before re-running graphql-flow again. We want to ensure
|
|
26
|
+
// that we don't error out in this case.
|
|
27
|
+
return "";
|
|
24
28
|
};
|