Skip to content

Commit

Permalink
refactor(project): migrate js to ts and update tooling
Browse files Browse the repository at this point in the history
Migrated the existing JavaScript codebase to TypeScript, including
the addition of type definitions and interfaces for better type
safety and developer experience. Updated package.json to include
necessary TypeScript dependencies and scripts for building and
linting the project. Removed old JavaScript files and their
references, and set up Jest for unit testing with TypeScript
support. This change aims to leverage TypeScript's static typing
features for more robust code.
  • Loading branch information
yiwenlu66 committed Dec 2, 2024
1 parent 35c56a3 commit ca5eb64
Show file tree
Hide file tree
Showing 25 changed files with 208 additions and 453 deletions.
16 changes: 16 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'plugin:@typescript-eslint/recommended',
'prettier'
],
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }]
}
}
9 changes: 9 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/src', '<rootDir>/test'],
testMatch: ['**/*.test.ts'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
}
};
52 changes: 28 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,41 @@
"name": "eko",
"version": "1.0.0",
"description": "Empowering language to transform human words into action.",
"main": "src/eko.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"directories": {
"test": "test"
},
"scripts": {
"test": "node test/index.js"
"build": "tsc",
"dev": "tsc --watch",
"clean": "rimraf dist",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"lint": "eslint src/**/*.ts",
"lint:fix": "eslint src/**/*.ts --fix",
"format": "prettier --write \"src/**/*.ts\"",
"prepublishOnly": "npm run build",
"docs": "typedoc src/index.ts"
},
"repository": {
"type": "git",
"url": "git+https://github.com/FellouAI/eko.git"
"dependencies": {
"zod": "^3.22.4"
},
"keywords": [
"agent",
"rpa",
"browser",
"computer-use",
"AI",
"automation",
"natural language programming",
"propmt engineering"
],
"author": "Fellou AI Browser",
"license": "MIT",
"bugs": {
"url": "https://github.com/FellouAI/eko/issues"
"devDependencies": {
"@types/jest": "^29.5.12",
"@types/node": "^20.11.24",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"@typescript-eslint/parser": "^7.1.0",
"eslint": "^8.57.0",
"jest": "^29.7.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"ts-jest": "^29.1.2",
"typescript": "^5.3.3"
},
"homepage": "https://github.com/FellouAI/eko#readme",
"dependencies": {
"@langchain/anthropic": "^0.3.8",
"@langchain/core": "^0.3.18",
"langchain": "^0.3.6"
"engines": {
"node": ">=18.0.0"
}
}
69 changes: 0 additions & 69 deletions src/eko.js

This file was deleted.

Empty file added src/index.ts
Empty file.
Empty file added src/models/action.ts
Empty file.
30 changes: 30 additions & 0 deletions src/models/workflow.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Workflow, WorkflowNode } from '../types';

export class WorkflowImpl implements Workflow {
constructor(
public id: string,
public name: string,
public nodes: WorkflowNode[] = [],
public variables: Map<string, unknown> = new Map()
) {}

async execute(): Promise<void> {
throw new Error('Not implemented');
}

addNode(node: WorkflowNode): void {
throw new Error('Not implemented');
}

removeNode(nodeId: string): void {
throw new Error('Not implemented');
}

getNode(nodeId: string): WorkflowNode {
throw new Error('Not implemented');
}

validateDAG(): boolean {
throw new Error('Not implemented');
}
}
38 changes: 0 additions & 38 deletions src/mq.js

This file was deleted.

Loading

0 comments on commit ca5eb64

Please sign in to comment.