attio 0.0.1-experimental.20241003 → 0.0.1-experimental.20241003.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.
|
@@ -11,7 +11,22 @@ function findGraphQLFiles(dir) {
|
|
|
11
11
|
if (entry.isDirectory()) {
|
|
12
12
|
files.push(...findGraphQLFiles(fullPath));
|
|
13
13
|
}
|
|
14
|
-
else if (entry.isFile() &&
|
|
14
|
+
else if (entry.isFile() &&
|
|
15
|
+
(path.extname(entry.name) === ".graphql" || path.extname(entry.name) === ".gql")) {
|
|
16
|
+
files.push(fullPath);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return files;
|
|
20
|
+
}
|
|
21
|
+
function findGeneratedFiles(dir) {
|
|
22
|
+
const files = [];
|
|
23
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
24
|
+
for (const entry of entries) {
|
|
25
|
+
const fullPath = path.join(dir, entry.name);
|
|
26
|
+
if (entry.isDirectory()) {
|
|
27
|
+
files.push(...findGraphQLFiles(fullPath));
|
|
28
|
+
}
|
|
29
|
+
else if (entry.isFile() && path.extname(entry.name) === ".graphql.d.ts") {
|
|
15
30
|
files.push(fullPath);
|
|
16
31
|
}
|
|
17
32
|
}
|
|
@@ -161,6 +176,7 @@ export async function generateOperationFromQuery(graphqlFileName, query, schema)
|
|
|
161
176
|
return format(operation, { parser: "typescript" });
|
|
162
177
|
}
|
|
163
178
|
export async function generateOperations(rootDir, schema) {
|
|
179
|
+
await Promise.all(findGeneratedFiles(rootDir).map(async (file) => fs.promises.unlink(file)));
|
|
164
180
|
const graphqlFiles = findGraphQLFiles(rootDir);
|
|
165
181
|
await Promise.all(graphqlFiles.map(async (file) => {
|
|
166
182
|
const content = await fs.promises.readFile(file, "utf-8");
|