@devries-cameron20 / composio Mirror · read-only
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 04:45 UTC

next
ts 49 lines 1.74 KB
Raw
1 // Runs the Effect language service over the CLI's sources and tests, and fails
2 // on any error-level diagnostic. The one this exists for is `floatingEffect`:
3 // an Effect that is created and never yielded, such as a client call whose
4 // result is dropped, compiles and silently never runs.
5 //
6 // The language service needs TypeScript's JS API, which the workspace's
7 // TypeScript 7 does not ship, so it runs against this package's TypeScript 6
8 // alias. It loads `typescript/lib/tsserverlibrary` from its own location, so
9 // symlinks are preserved to resolve that from this package's node_modules, and
10 // NODE_PATH lets the alias load the TypeScript 6 package it re-exports.
11 //
12 // Usage:
13 // tsx ./scripts/check-effect-diagnostics.ts
14 import { spawnSync } from 'node:child_process';
15 import * as fs from 'node:fs';
16 import * as path from 'node:path';
17
18 const scriptDir = import.meta.dirname ?? path.dirname(new URL(import.meta.url).pathname);
19 const packageRoot = path.resolve(scriptDir, '..');
20 const nodeModules = path.join(packageRoot, 'node_modules');
21 // <store>/node_modules/@typescript/typescript6 -> <store>/node_modules
22 const typescriptAliasModules = path.resolve(
23 fs.realpathSync(path.join(nodeModules, 'typescript')),
24 '..',
25 '..'
26 );
27
28 const result = spawnSync(
29 process.execPath,
30 [
31 '--preserve-symlinks',
32 '--preserve-symlinks-main',
33 path.join(nodeModules, '@effect', 'language-service', 'cli.js'),
34 'diagnostics',
35 '--project',
36 path.join(packageRoot, 'tsconfig.test.json'),
37 '--severity',
38 'error',
39 '--format',
40 process.env.GITHUB_ACTIONS === 'true' ? 'github-actions' : 'text',
41 ],
42 {
43 cwd: packageRoot,
44 stdio: 'inherit',
45 env: { ...process.env, NODE_PATH: typescriptAliasModules },
46 }
47 );
48
49 process.exit(result.status ?? 1);