Skip to content

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

feat(ts/cli): addres review comments, add typescript-mjs-import-nodenext e2e test

jkomynoa9de329703fb
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 7d59d77e5..a6a81a671 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -313,6 +313,15 @@ importers:
specifier: workspace:*
version: link:../../../../packages/core
+ ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext:
+ devDependencies:
+ '@composio/cli':
+ specifier: workspace:*
+ version: link:../../../../packages/cli
+ typescript:
+ specifier: ^5.9.2
+ version: 5.9.3
+
ts/examples/anthropic:
dependencies:
'@anthropic-ai/claude-agent-sdk':
diff --git a/ts/e2e-tests/_utils/Dockerfile.node b/ts/e2e-tests/_utils/Dockerfile.node
index 8cd1acbe8..9dc1e09e4 100644
--- a/ts/e2e-tests/_utils/Dockerfile.node
+++ b/ts/e2e-tests/_utils/Dockerfile.node
@@ -1,5 +1,9 @@
# Reusable Dockerfile for Node.js e2e tests
# Usage: docker build -f Dockerfile.node --build-arg NODE_VERSION=20.19.0 --build-arg TEST_DIR=... --build-arg TEST_CMD="node test.cjs" -t test-name .
+#
+# Uses official node:slim images. For multi-version testing, run the build/run
+# multiple times with different NODE_VERSION values from the shell script.
+
ARG NODE_VERSION=20.19.0
FROM node:${NODE_VERSION}-slim
@@ -9,12 +13,17 @@ ENV PATH="$PNPM_HOME:$PATH"
WORKDIR /app
-# Install corepack to use pnpm.
-# See: https://vercel.com/kb/guide/corepack-errors-github-actions.
-RUN npm i -g corepack@latest && corepack enable
+# Install corepack (for pnpm) and bun
+RUN npm i -g corepack@latest bun && corepack enable
# Copy pnpm workspace files
-COPY pnpm-lock.yaml pnpm-workspace.yaml .pnpmfile.cjs package.json tsconfig.base.json tsdown.config.base.ts ./
+COPY pnpm-lock.yaml \
+ pnpm-workspace.yaml \
+ .pnpmfile.cjs \
+ package.json \
+ tsconfig.base.json \
+ tsdown.config.base.ts \
+ ./
# Copy all ts/packages (pre-built)
COPY ts/packages/ ./ts/packages/
@@ -27,11 +36,20 @@ COPY ts/e2e-tests/ ./ts/e2e-tests/
# because it causes native binding issues (e.g., rolldown-binding) across builds
RUN pnpm install --frozen-lockfile
+# Build and install composio CLI binary
+# This is a simplified version of ts/packages/cli/scripts/build-binary.ts + install-binary.ts
+WORKDIR /app/ts/packages/cli
+RUN bun build ./src/bin.ts \
+ --env DEBUG_OVERRIDE_* \
+ --compile \
+ --production \
+ --outfile /usr/local/bin/composio
+
# Test directory (relative to /app)
ARG TEST_DIR
WORKDIR /app/${TEST_DIR}
-# Command to run the test (e.g., "node test.cjs", "node test.mjs", "pnpm test")
+# Command to run the test (e.g., "node test.cjs", "node test.mjs", "pnpm test", "bun test")
ARG TEST_CMD="echo 'No TEST_CMD specified'"
ENV TEST_CMD=${TEST_CMD}
diff --git a/ts/e2e-tests/_utils/run-docker-test.sh b/ts/e2e-tests/_utils/run-docker-test.sh
index 90fd2fb52..10bfaa143 100755
--- a/ts/e2e-tests/_utils/run-docker-test.sh
+++ b/ts/e2e-tests/_utils/run-docker-test.sh
@@ -2,21 +2,22 @@
# Reusable Docker test runner for e2e tests
#
# Usage:
-# run-docker-test.sh --name <name> --dir <dir> --cmd <cmd> [--node <version>]
+# run-docker-test.sh --name <name> --dir <dir> --cmd <cmd> [--node-versions <versions>]
#
# Arguments:
-# --name, -n Name for the Docker image (e.g., "composio-cjs-test")
-# --dir, -d Relative path from repo root to test directory (e.g., "ts/packages/core/test-e2e/node-cjs")
-# --cmd, -c Command to run (e.g., "node test.cjs", "node test.mjs", "pnpm test"). Default: "pnpm test"
-# --node Node.js version. Default: 20.19.0
+# --name, -n Name for the Docker image (e.g., "composio-cjs-test")
+# --dir, -d Relative path from repo root to test directory (e.g., "ts/packages/core/test-e2e/node-cjs")
+# --cmd, -c Command to run (e.g., "node test.cjs", "node test.mjs", "pnpm test"). Default: "pnpm test"
+# --node-versions Space-separated Node.js versions to test with. Default: "20.19.0"
+# --node Single Node.js version (alias for --node-versions with one version)
#
# Example:
-# ./run-docker-test.sh --name "composio-cjs-test" --dir "ts/packages/core/test-e2e/node-cjs" --cmd "node test.cjs" --node "20.17.0"
+# ./run-docker-test.sh --name "composio-cjs-test" --dir "ts/packages/core/test-e2e/node-cjs" --cmd "node test.cjs" --node-versions "20.18.0 20.19.0"
set -e
# Default values
-NODE_VERSION="20.19.0"
+NODE_VERSIONS="20.19.0"
TEST_NAME=""
TEST_DIR=""
TEST_CMD="pnpm test"
@@ -36,13 +37,17 @@ while [[ $# -gt 0 ]]; do
TEST_CMD="$2"
shift 2
;;
+ --node-versions)
+ NODE_VERSIONS="$2"
+ shift 2
+ ;;
--node)
- NODE_VERSION="$2"
+ NODE_VERSIONS="$2"
shift 2
;;
*)
echo "Error: Unknown argument '$1'"
- echo "Usage: run-docker-test.sh --name <name> --dir <dir> --cmd <cmd> [--node <version>]"
+ echo "Usage: run-docker-test.sh --name <name> --dir <dir> --cmd <cmd> [--node-versions <versions>]"
exit 1
;;
esac
@@ -68,27 +73,40 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
echo "πŸ§ͺ Running Docker e2e test: $TEST_NAME"
-echo " Node.js version: $NODE_VERSION"
+echo " Node.js versions: $NODE_VERSIONS"
echo " Test directory: $TEST_DIR"
echo " Test command: $TEST_CMD"
echo ""
-echo "🐳 Building test image..."
-
cd "$REPO_ROOT"
-# Build Docker image
-docker build \
- -f "$SCRIPT_DIR/Dockerfile.node" \
- --build-arg NODE_VERSION="$NODE_VERSION" \
- --build-arg TEST_DIR="$TEST_DIR" \
- --build-arg TEST_CMD="$TEST_CMD" \
- -t "$TEST_NAME" \
- .
+# Build docker run arguments, passing through relevant environment variables
+DOCKER_ENV_ARGS=""
+if [[ -n "$COMPOSIO_API_KEY" ]]; then
+ DOCKER_ENV_ARGS="-e COMPOSIO_API_KEY=$COMPOSIO_API_KEY"
+fi
-echo ""
-echo "πŸ§ͺ Running test in Docker container..."
-docker run --rm "$TEST_NAME"
+# Run tests for each Node.js version
+for NODE_VERSION in $NODE_VERSIONS; do
+ echo ""
+ echo "========================================"
+ echo "🐳 Building and testing with Node.js $NODE_VERSION"
+ echo "========================================"
+
+ IMAGE_NAME="${TEST_NAME}-node${NODE_VERSION}"
+
+ docker build \
+ -f "$SCRIPT_DIR/Dockerfile.node" \
+ --build-arg NODE_VERSION="$NODE_VERSION" \
+ --build-arg TEST_DIR="$TEST_DIR" \
+ --build-arg TEST_CMD="$TEST_CMD" \
+ -t "$IMAGE_NAME" \
+ .
+
+ echo ""
+ echo "πŸ§ͺ Running test in Docker container..."
+ docker run --rm $DOCKER_ENV_ARGS "$IMAGE_NAME"
+done
echo ""
-echo "βœ… Docker test completed successfully!"
+echo "βœ… All Node.js versions passed!"
diff --git a/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/.gitignore b/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/.gitignore
new file mode 100644
index 000000000..f854e31e6
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/.gitignore
@@ -0,0 +1,3 @@
+generated/
+dist/
+node_modules/
diff --git a/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/README.md b/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/README.md
new file mode 100644
index 000000000..88fb4ce15
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/README.md
@@ -0,0 +1,36 @@
+# TypeScript .mjs Import Resolution Test
+
+Verifies that `composio ts generate` produces TypeScript files that compile correctly with `moduleResolution: "nodenext"`.
+
+## The Issue
+
+When `composio ts generate --output-dir ./types` runs without `--transpiled`:
+
+- Only `.ts` files are generated
+- These files contain `import ... from "./foo.mjs"` statements
+- With `moduleResolution: "node16"` or `"nodenext"`, TypeScript resolves:
+ - `.js` imports β†’ `.ts` files βœ…
+ - `.mjs` imports β†’ `.mts` files only (not `.ts`) ❌
+
+This causes `TS2307: Cannot find module './foo.mjs'` errors.
+
+## What It Tests
+
+| Test | Description |
+| ---------------------- | ----------------------------------------------------------- |
+| composio ts generate | Runs CLI to generate TypeScript files for entelligence toolkit |
+| File existence | Verifies generated .ts files exist |
+| TypeScript compilation | Runs `tsc --noEmit` to check import resolution |
+
+## Running
+
+```bash
+# With nvm - test specific Node.js versions
+nvm use 20.18.0 && pnpm install && pnpm test:e2e
+nvm use 20.19.0 && pnpm install && pnpm test:e2e
+```
+
+## Expected Behavior
+
+- **If bug exists (importExtension: 'mjs')**: Test 3 fails with TS2307
+- **If fixed (importExtension: 'js')**: All tests pass
diff --git a/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/package.json b/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/package.json
new file mode 100644
index 000000000..ef0f957b9
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@test-e2e/typescript-mjs-import-nodenext",
+ "version": "0.0.0",
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "test:e2e": "node test.mjs",
+ "test:e2e:node": "node test.mjs"
+ },
+ "devDependencies": {
+ "@composio/cli": "workspace:*",
+ "typescript": "^5.9.2"
+ }
+}
diff --git a/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/run-docker-test.sh b/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/run-docker-test.sh
new file mode 100755
index 000000000..ec20f98ac
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/run-docker-test.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+# TypeScript .mjs import resolution e2e test runner
+# Uses shared Docker test infrastructure from _utils/
+#
+# Requires COMPOSIO_API_KEY environment variable to be set
+# Tests with Node.js 20.18.0 and 20.19.0 using nvm
+
+set -e
+
+if [[ -z "$COMPOSIO_API_KEY" ]]; then
+ echo "Error: COMPOSIO_API_KEY environment variable is required"
+ echo "Export it before running: export COMPOSIO_API_KEY=your_key"
+ exit 1
+fi
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+UTILS_DIR="$SCRIPT_DIR/../../../_utils"
+
+# Test with both Node.js 20.18.0 and 20.19.0
+NODE_VERSIONS="${COMPOSIO_E2E_NODE_VERSIONS:-20.18.0 20.19.0}"
+
+"$UTILS_DIR/run-docker-test.sh" \
+ --name "composio-typescript-mjs-import-nodenext" \
+ --dir "ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext" \
+ --cmd "node test.mjs" \
+ --node-versions "$NODE_VERSIONS"
diff --git a/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/test.mjs b/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/test.mjs
new file mode 100644
index 000000000..ecaf33213
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/test.mjs
@@ -0,0 +1,108 @@
+/**
+ * E2E test: TypeScript .mjs import resolution with moduleResolution: "nodenext"
+ *
+ * This test verifies that generated TypeScript files with .mjs imports
+ * can be compiled successfully with moduleResolution: "nodenext".
+ *
+ * The issue: When `composio ts generate` uses importExtension: 'mjs',
+ * the generated .ts files contain `import ... from "./foo.mjs"` statements.
+ * With moduleResolution: "node16" or "nodenext", TypeScript expects .mjs
+ * imports to resolve to .mts files, NOT .ts files.
+ *
+ * This causes TS2307: Cannot find module './foo.mjs' errors.
+ */
+
+import assert from 'node:assert';
+import { execSync } from 'node:child_process';
+import { existsSync, rmSync, readdirSync } from 'node:fs';
+import { dirname, join } from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const __dirname = dirname(fileURLToPath(import.meta.url));
+const GENERATED_DIR = join(__dirname, 'generated');
+
+console.log('πŸ§ͺ Testing TypeScript .mjs import resolution with moduleResolution: "nodenext"...\n');
+console.log(`Node.js version: ${process.version}`);
+console.log(`Working directory: ${__dirname}\n`);
+
+// Cleanup generated directory if it exists
+if (existsSync(GENERATED_DIR)) {
+ console.log('Cleaning up previous generated files...');
+ rmSync(GENERATED_DIR, { recursive: true });
+}
+
+// Test 1: Run composio ts generate --toolkits entelligence --output-dir ./generated
+console.log('Test 1: Running composio ts generate --toolkits entelligence --output-dir ./generated...');
+try {
+ // Use the composio CLI binary built and installed to /usr/local/bin in the Dockerfile
+ execSync(`composio ts generate --toolkits entelligence --output-dir ${GENERATED_DIR}`, {
+ cwd: __dirname,
+ stdio: 'inherit',
+ env: { ...process.env, FORCE_COLOR: '0' },
+ });
+
+ console.log('βœ… Test 1 passed: composio ts generate succeeded\n');
+} catch (error) {
+ console.error('❌ Test 1 failed: composio ts generate threw an error');
+ console.error(error.message);
+ process.exit(1);
+}
+
+// Test 2: Verify generated files exist
+console.log('Test 2: Verifying generated files exist...');
+try {
+ assert.ok(existsSync(GENERATED_DIR), 'Generated directory should exist');
+
+ const files = readdirSync(GENERATED_DIR);
+ console.log('Generated files:', files);
+
+ assert.ok(files.length > 0, 'Generated directory should not be empty');
+ assert.ok(files.some((f) => f.endsWith('.ts')), 'Should have .ts files');
+
+ console.log('βœ… Test 2 passed: Generated files exist\n');
+} catch (error) {
+ console.error('❌ Test 2 failed: Generated files verification failed');
+ console.error(error.message);
+ process.exit(1);
+}
+
+// Test 3: Run tsc --noEmit to check TypeScript compilation
+console.log('Test 3: Running tsc --noEmit to verify TypeScript compilation...');
+console.log('Expected: FAILURE with TS2307 if importExtension is "mjs"');
+console.log('Expected: SUCCESS if importExtension is "js"\n');
+
+try {
+ execSync('npx tsc --noEmit', {
+ cwd: __dirname,
+ stdio: 'pipe',
+ encoding: 'utf-8',
+ });
+
+ console.log('βœ… Test 3 passed: TypeScript compilation succeeded');
+ console.log(' (importExtension is correctly set to "js")\n');
+} catch (error) {
+ // execSync error object has stdout/stderr as Buffer or string
+ const stdout = error.stdout?.toString?.() || error.stdout || '';
+ const stderr = error.stderr?.toString?.() || error.stderr || '';
+ const output = stdout + stderr + error.message;
+
+ if (output.includes('TS2307') && output.includes('.mjs')) {
+ console.log('❌ Test 3 failed: TypeScript compilation failed with TS2307');
+ console.log(' This confirms the bug: .mjs imports do not resolve to .ts files');
+ console.log(' with moduleResolution: "nodenext"\n');
+ console.log('Error output:');
+ console.log(stdout || stderr);
+ process.exit(1);
+ }
+
+ console.error('❌ Test 3 failed: Unexpected TypeScript error');
+ console.error('stdout:', stdout);
+ console.error('stderr:', stderr);
+ console.error('message:', error.message);
+ process.exit(1);
+}
+
+console.log('========================================');
+console.log('πŸŽ‰ All tests passed!');
+console.log('========================================');
+process.exit(0);
diff --git a/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/tsconfig.json b/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/tsconfig.json
new file mode 100644
index 000000000..7758999f1
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext/tsconfig.json
@@ -0,0 +1,14 @@
+{
+ "compilerOptions": {
+ "target": "es2022",
+ "module": "nodenext",
+ "moduleResolution": "nodenext",
+ "declaration": true,
+ "outDir": "./dist",
+ "rootDir": "./generated",
+ "strict": true,
+ "esModuleInterop": true,
+ "skipLibCheck": true
+ },
+ "include": ["generated"]
+}
diff --git a/ts/packages/cli/src/commands/ts/commands/ts.generate.cmd.ts b/ts/packages/cli/src/commands/ts/commands/ts.generate.cmd.ts
index 22e1ea788..89cf7771a 100644
--- a/ts/packages/cli/src/commands/ts/commands/ts.generate.cmd.ts
+++ b/ts/packages/cli/src/commands/ts/commands/ts.generate.cmd.ts
@@ -211,7 +211,7 @@ export function generateTypescriptTypeStubs({
outputDir,
emitSingleFile: Boolean(compact), // Ensure boolean type
banner: BANNER,
- importExtension: 'mjs',
+ importExtension: 'js',
})(index);
// Write all generated files
diff --git a/ts/packages/cli/src/generation/typescript/generate-index-source.ts b/ts/packages/cli/src/generation/typescript/generate-index-source.ts
index da313d77a..e7779021c 100644
--- a/ts/packages/cli/src/generation/typescript/generate-index-source.ts
+++ b/ts/packages/cli/src/generation/typescript/generate-index-source.ts
@@ -32,7 +32,7 @@ const BARREL_OBJECT_NAME = 'Toolkits';
export type GenerateTypeScriptIndexMapSourceParams = {
banner: string;
emitSingleFile: boolean;
- importExtension: 'ts' | 'mjs';
+ importExtension: 'ts' | 'js';
};
export function generateIndexSource(params: GenerateTypeScriptIndexMapSourceParams) {
diff --git a/ts/packages/cli/src/generation/typescript/generate.ts b/ts/packages/cli/src/generation/typescript/generate.ts
index 67c5d37c6..9562d5fb2 100644
--- a/ts/packages/cli/src/generation/typescript/generate.ts
+++ b/ts/packages/cli/src/generation/typescript/generate.ts
@@ -12,7 +12,7 @@ type GenerateTypeScriptSourcesParams = {
banner: string;
emitSingleFile: boolean;
outputDir: string;
- importExtension: 'ts' | 'mjs';
+ importExtension: 'ts' | 'js';
};
export function generateTypeScriptSources(params: GenerateTypeScriptSourcesParams) {
diff --git a/ts/packages/cli/src/generation/typescript/transpile.ts b/ts/packages/cli/src/generation/typescript/transpile.ts
index 7668ba3d6..4ef1ae94f 100644
--- a/ts/packages/cli/src/generation/typescript/transpile.ts
+++ b/ts/packages/cli/src/generation/typescript/transpile.ts
@@ -27,7 +27,7 @@ export function transpileTypeScriptSources({ sources, outputDir }: TranspileType
rootDir: outputDir,
declaration: true,
emitDeclarationOnly: false,
- noEmitOnError: false,
+ noEmitOnError: true,
} satisfies ts.CompilerOptions;
const virtualFileMap = new Map(
@@ -56,13 +56,6 @@ export function transpileTypeScriptSources({ sources, outputDir }: TranspileType
return ogGetSourceFile(filename, languageVersion, onError, shouldCreateNewSourceFile);
};
- // Override writeFile to emit .mjs files directly instead of .js
- const ogWriteFile = tsHost.writeFile;
- tsHost.writeFile = (fileName, data, writeByteOrderMark, onError, sourceFiles, info) => {
- const mjsFileName = fileName.replace(/\.js$/, '.mjs');
- return ogWriteFile(mjsFileName, data, writeByteOrderMark, onError, sourceFiles, info);
- };
-
const program = ts.createProgram(virtualFileNames, compilerOptions, tsHost);
const emitResult = program.emit();
diff --git a/ts/packages/cli/test/src/commands/ts/ts.generate.cmd.test.ts b/ts/packages/cli/test/src/commands/ts/ts.generate.cmd.test.ts
index a3d2be2b8..85dfbefb4 100644
--- a/ts/packages/cli/test/src/commands/ts/ts.generate.cmd.test.ts
+++ b/ts/packages/cli/test/src/commands/ts/ts.generate.cmd.test.ts
@@ -191,8 +191,8 @@ describe('CLI: composio ts generate', () => {
* Auto-generated by Composio CLI. Do not modify manually.
*/
- import { GMAIL } from "./gmail.mjs"
- import { SLACK } from "./slack.mjs"
+ import { GMAIL } from "./gmail.js"
+ import { SLACK } from "./slack.js"
/**
* Map of Composio toolkits to actions.
@@ -432,8 +432,8 @@ describe('CLI: composio ts generate', () => {
* Auto-generated by Composio CLI. Do not modify manually.
*/
- import { GMAIL } from "./gmail.mjs"
- import { SLACK } from "./slack.mjs"
+ import { GMAIL } from "./gmail.js"
+ import { SLACK } from "./slack.js"
/**
* Map of Composio toolkits to actions.
@@ -638,8 +638,8 @@ describe('CLI: composio ts generate', () => {
* Auto-generated by Composio CLI. Do not modify manually.
*/
- import { GMAIL } from "./gmail.mjs"
- import { SLACK } from "./slack.mjs"
+ import { GMAIL } from "./gmail.js"
+ import { SLACK } from "./slack.js"
/**
* Map of Composio toolkits to actions.
@@ -722,12 +722,14 @@ describe('CLI: composio ts generate', () => {
const fileNames = files.map(file => path.basename(file));
// Should have both .ts and .js files
- const tsFiles = fileNames.filter(name => name.endsWith('.ts'));
- const mjsFiles = fileNames.filter(name => name.endsWith('.mjs'));
+ const tsFiles = fileNames.filter(
+ name => name.endsWith('.ts') && !name.endsWith('.d.ts')
+ );
+ const jsFiles = fileNames.filter(name => name.endsWith('.js'));
const dtsFiles = fileNames.filter(name => name.endsWith('.d.ts'));
expect(tsFiles.length).toBeGreaterThan(0);
- expect(mjsFiles.length).toBeGreaterThan(0);
+ expect(jsFiles.length).toBeGreaterThan(0);
expect(dtsFiles.length).toBeGreaterThan(0);
// Verify the files are valid TypeScript
@@ -753,17 +755,19 @@ describe('CLI: composio ts generate', () => {
const args = ['ts', 'generate'];
yield* cli(args);
- // Check if the output directory contains both .ts and .mjs files
+ // Check if the output directory contains both .ts and .js files
const files = yield* fs.readDirectory(generatedDir);
const fileNames = files.map(file => path.basename(file));
- // Should have both .ts and .mjs files since compiled is true by default for @composio/core/generated
- const tsFiles = fileNames.filter(name => name.endsWith('.ts'));
- const mjsFiles = fileNames.filter(name => name.endsWith('.mjs'));
+ // Should have both .ts and .js files since compiled is true by default for @composio/core/generated
+ const tsFiles = fileNames.filter(
+ name => name.endsWith('.ts') && !name.endsWith('.d.ts')
+ );
+ const jsFiles = fileNames.filter(name => name.endsWith('.js'));
const dtsFiles = fileNames.filter(name => name.endsWith('.d.ts'));
expect(tsFiles.length).toBeGreaterThan(0);
- expect(mjsFiles.length).toBeGreaterThan(0);
+ expect(jsFiles.length).toBeGreaterThan(0);
expect(dtsFiles.length).toBeGreaterThan(0);
})
);
@@ -814,8 +818,8 @@ describe('CLI: composio ts generate', () => {
* Auto-generated by Composio CLI. Do not modify manually.
*/
- import { GMAIL } from "./gmail.mjs"
- import { SLACK } from "./slack.mjs"
+ import { GMAIL } from "./gmail.js"
+ import { SLACK } from "./slack.js"
/**
* Map of Composio toolkits to actions.
diff --git a/ts/packages/core/pack/generated/index.mjs b/ts/packages/core/pack/generated/index.js
similarity index 100%
rename from ts/packages/core/pack/generated/index.mjs
rename to ts/packages/core/pack/generated/index.js
diff --git a/ts/packages/core/package.json b/ts/packages/core/package.json
index 06d752c78..0ac7368ea 100644
--- a/ts/packages/core/package.json
+++ b/ts/packages/core/package.json
@@ -82,7 +82,7 @@
},
"./generated": {
"types": "./generated/index.d.ts",
- "default": "./generated/index.mjs"
+ "default": "./generated/index.js"
}
},
"files": [