@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, 03:37 UTC

next
ts 112 lines 2.9 KB
Raw
1 import type { UserConfig } from 'tsdown';
2
3 // Turbo task execution triggers a tsdown tarball-pack path bug for scoped packages:
4 // an intermittent ENOENT while reading the packed `.tgz` (e.g. composio-anthropic-*.tgz).
5 // tsdown packs the tarball once and shares it between ATTW and publint, and only runs the
6 // pack when at least one of them is enabled — so BOTH must be disabled to skip the pack
7 // under Turbo. Keep both checks for direct package builds; disable them for workspace builds.
8 const isTurboTask = Boolean(process.env.TURBO_HASH);
9
10 export const baseNeverBundle: Array<string | RegExp> = ['zod', '@composio/core', /^node:/];
11
12 /**
13 * tsdown config with shared defaults.
14 * Package-specific options (e.g., entry, outDir, outExtensions) can be overridden by the caller.
15 * Paths are relative to the closest `tsdown.config.ts` file that imports this config.
16 */
17 export const baseConfig = {
18 /**
19 * Entry points for the build.
20 */
21 entry: ['src/index.ts'],
22
23 /**
24 * Output directory for the build.
25 */
26 outDir: 'dist',
27 outExtensions: () => ({
28 js: '.mjs',
29 dts: '.d.mts',
30 }),
31
32 /**
33 * Configures the output formats for the build.
34 * - 'esm' generates ESM (ECMAScript Module) output
35 */
36 format: ['esm'],
37
38 /**
39 * Generates TypeScript declaration files (.d.mts, .d.ts)
40 */
41 dts: true,
42
43 /**
44 * Clean `outDir` before each build.
45 */
46 clean: true,
47
48 /**
49 * Compress code to reduce bundle size.
50 */
51 minify: false,
52
53 /**
54 * Target ECMAScript version for the output.
55 */
56 target: 'es2022',
57
58 /**
59 * Callback function to execute after a successful build.
60 */
61 onSuccess() {
62 console.info('🙏 Build succeeded!');
63 },
64
65 deps: {
66 /**
67 * Dependencies that should not be bundled, but provided by the consumer.
68 */
69 neverBundle: baseNeverBundle,
70 /**
71 * Workspace packages intentionally bundle selected dependencies today. Keep
72 * that behavior explicit without emitting per-package hint noise.
73 */
74 onlyBundle: false,
75 },
76
77 /**
78 * Control how Node.js built-in module imports are handled.
79 * When true, imports like `fs` are transformed to `node:fs`.
80 */
81 nodeProtocol: true,
82
83 checks: {
84 pluginTimings: false,
85 ineffectiveDynamicImport: false,
86 },
87
88 /**
89 * Configuration for @arethetypeswrong/cli.
90 * Uses '.' entrypoint to check the package root via the exports field,
91 * since src/index.ts is only used during development and not exported.
92 * Uses the ESM-only profile because packages no longer publish CJS entrypoints.
93 */
94 attw: {
95 entrypoints: ['.'],
96 enabled: !isTurboTask,
97 level: 'error',
98 profile: 'esm-only',
99 ignoreRules: [
100 /* Node.js 10 only, attw doesn't automatically exclude it despite the selected profile */ 'internal-resolution-error',
101 ],
102 },
103
104 /**
105 * Configuration for publint.
106 */
107 publint: {
108 enabled: !isTurboTask,
109 level: 'error',
110 pack: 'pnpm',
111 },
112 } satisfies UserConfig;