2023-08-15 22:13:28 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) Contributors to the Suwayomi project
|
|
|
|
|
*
|
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import fs from 'fs';
|
|
|
|
|
import * as path from 'path';
|
|
|
|
|
|
2023-09-30 16:55:35 +02:00
|
|
|
const format = (source: string, regex: RegExp | string, replaceValue: string): string =>
|
|
|
|
|
source.replace(regex, replaceValue);
|
2023-08-15 22:13:28 +02:00
|
|
|
|
2026-06-28 18:16:28 +02:00
|
|
|
const generatedGraphQLFilePath = path.resolve(import.meta.dirname, '../../src/lib/graphql/generated/graphql.ts');
|
|
|
|
|
const generatedGraphQLFile = fs.readFileSync(generatedGraphQLFilePath, 'utf8');
|
2023-08-15 22:13:28 +02:00
|
|
|
|
|
|
|
|
// add logic to format the codegen generated graphql file
|
|
|
|
|
|
2023-09-30 16:55:35 +02:00
|
|
|
/* ******************************************* */
|
|
|
|
|
/* */
|
|
|
|
|
/* typescript, typescript-operations */
|
|
|
|
|
/* */
|
|
|
|
|
/* ******************************************* */
|
|
|
|
|
|
2024-03-28 17:30:34 +01:00
|
|
|
const fixSubscriptionHookNameSuffix = format(generatedGraphQLFile, /SubscriptionSubscription/g, 'Subscription');
|
2023-08-15 22:13:28 +02:00
|
|
|
|
|
|
|
|
fs.writeFileSync(generatedGraphQLFilePath, fixSubscriptionHookNameSuffix);
|
2023-09-30 16:55:35 +02:00
|
|
|
|
|
|
|
|
/* ****************************************** */
|
|
|
|
|
/* */
|
|
|
|
|
/* typescript-apollo-client-helpers */
|
|
|
|
|
/* */
|
|
|
|
|
/* ****************************************** */
|
|
|
|
|
|
2026-06-28 18:16:28 +02:00
|
|
|
// generatedGraphQLFilePath = path.resolve(import.meta.dirname, '../../src/lib/graphql/generated/apollo-helpers.ts');
|
|
|
|
|
// generatedGraphQLFile = fs.readFileSync(generatedGraphQLFilePath, 'utf8');
|