1 | import * as path from 'path';
|
2 |
|
3 | const unadjustedRelativePath = (from: string, to: string) =>
|
4 | path.relative(path.dirname(from), path.join(path.dirname(to), path.basename(to, '.ts')));
|
5 |
|
6 |
|
7 | const adjustedRelativePath = (path: string) => (path.startsWith('.') ? path : `./${path}`);
|
8 |
|
9 | export const relativePath = (from: string, to: string) =>
|
10 | adjustedRelativePath(unadjustedRelativePath(from, to));
|
11 |
|
12 | export const outputPath = (fragmentOrOperationName: string, filePath: string) =>
|
13 | path.join(path.join(path.dirname(filePath), '__generated__'), fragmentOrOperationName + '.ts');
|