diff --git a/.gitignore b/.gitignore index 2ef725bb..2052683c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,3 @@ node_modules **/.nango **/models.ts .vscode/ - -// use-cases documentation dump -use-cases.json \ No newline at end of file diff --git a/scripts/generate-docs-use-cases.ts b/scripts/generate-docs-use-cases.ts deleted file mode 100644 index b5e92480..00000000 --- a/scripts/generate-docs-use-cases.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { promises as fs } from 'fs'; -import yaml from 'js-yaml'; - -interface UseCase { - method: string; - path: string; - description: string; - group: string; - script: string; -} - -const maybeIntegrations = await fs.readdir('integrations', { withFileTypes: true }); -const integrations = maybeIntegrations.filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name); - -const exportData: Record = {}; - -for (const integration of integrations) { - // eslint-disable-next-line @nangohq/custom-integrations-linting/no-object-casting - const yamlConfig = yaml.load(await fs.readFile(`integrations/${integration}/nango.yaml`, 'utf8')) as any; - const config = yamlConfig.integrations[integration] || yamlConfig.integrations['${PWD}']; - - exportData[integration] = readUseCases(config.syncs, integration).concat(readUseCases(config.actions, integration)); -} - -await fs.writeFile('use-cases.json', JSON.stringify(exportData, null, 2), 'utf-8'); - -function readUseCases(syncOrAction: any, integration: string) { - const endpoints: UseCase[] = []; - if (syncOrAction) { - for (const [key, item] of Object.entries(syncOrAction)) { - const syncEndpoints = Array.isArray(item.endpoint) ? item.endpoint : [item.endpoint]; - for (const endpoint of syncEndpoints) { - endpoints.push({ - method: endpoint.method, - path: endpoint.path, - description: item.description?.trim(), - group: endpoint.group, - script: `${integration}/actions/${key}` - }); - } - } - } - - return endpoints; -} diff --git a/tsconfig.json b/tsconfig.json index 408cdf93..06ae6f7c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,5 +7,5 @@ "composite": true, "checkJs": false }, - "include": ["integrations", "globals.d.ts", "scripts"] + "include": ["integrations", "globals.d.ts"] }