Mirror: TypeScript LSP plugin that finds GraphQL documents in your code and provides diagnostics, auto-complete and hover-information.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Recursively create dir (#364)

authored by

Jovi De Croock and committed by
GitHub
2330aa09 4ec1921f

+10 -10
+5
.changeset/rotten-pugs-begin.md
··· 1 + --- 2 + '@0no-co/graphqlsp': patch 3 + --- 4 + 5 + Recursively create directories if the target does not exist
-4
packages/graphqlsp/src/fieldUsage.ts
··· 130 130 const isChained = 131 131 ts.isPropertyAccessExpression(ref.expression) && 132 132 arrayMethods.has(ref.expression.name.text); 133 - console.log('[GRAPHQLSP]: ', isChained, ref.getFullText()); 134 133 if (isChained) { 135 134 const foundRef = ref.expression; 136 135 const isReduce = foundRef.name.text === 'reduce'; ··· 250 249 // - const pokemon = result.data.pokemon --> this initiates a new crawl with a renewed scope 251 250 // - const { pokemon } = result.data --> this initiates a destructuring traversal which will 252 251 // either end up in more destructuring traversals or a scope crawl 253 - console.log('[GRAPHQLSP]: ', foundRef.getFullText()); 254 252 while ( 255 253 ts.isIdentifier(foundRef) || 256 254 ts.isPropertyAccessExpression(foundRef) || ··· 301 299 const res = []; 302 300 const isSomeOrEvery = 303 301 foundRef.name.text === 'some' || foundRef.name.text === 'every'; 304 - console.log('[GRAPHQLSP]: ', foundRef.name.text); 305 302 const chainedResults = crawlChainedExpressions( 306 303 callExpression, 307 304 pathParts, ··· 309 306 source, 310 307 info 311 308 ); 312 - console.log('[GRAPHQLSP]: ', chainedResults.length); 313 309 if (chainedResults.length) { 314 310 res.push(...chainedResults); 315 311 }
+5 -6
packages/graphqlsp/src/graphql/getSchema.ts
··· 76 76 }); 77 77 78 78 let output = tadaOutputLocation; 79 - 80 79 if (await statFile(output, stat => stat.isDirectory())) { 81 80 output = path.join(output, 'introspection.d.ts'); 82 - } else if ( 83 - !(await statFile(path.dirname(output), stat => stat.isDirectory())) 84 - ) { 85 - logger(`Output file is not inside a directory @ ${output}`); 86 - return; 81 + } else if (!(await statFile(output, p => !!p))) { 82 + await fs.mkdir(path.dirname(output), { recursive: true }); 83 + if (await statFile(output, stat => stat.isDirectory())) { 84 + output = path.join(output, 'introspection.d.ts'); 85 + } 87 86 } 88 87 89 88 try {