Skip to content

Commit

Permalink
use @langchain/scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
bracesproul committed Apr 13, 2024
1 parent 98d4fb3 commit e0be710
Show file tree
Hide file tree
Showing 7 changed files with 393 additions and 242 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,15 @@ cython_debug/
.DS_Store

.envrc

js/.turbo
js/.eslintcache
js/.env
js/yarn-error.log

js/.yarn/*
!js/.yarn/patches
!js/.yarn/plugins
!js/.yarn/releases
!js/.yarn/sdks
!js/.yarn/versions
89 changes: 27 additions & 62 deletions js/.gitignore
Original file line number Diff line number Diff line change
@@ -1,62 +1,27 @@
.vscode
node_modules/
dist/
dist-cjs/
lib/
.turbo
.eslintcache
.env
yarn-error.log

.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

langchain/docs/

.idea/

.DS_Store

Chinook.db
Chinook_Sqlite.sql

.envrc
*.swp
*.swo

.node-version

## GENERATED create-entrypoints.js
/client.cjs
/client.js
/client.d.ts
/client.d.cts
/run_trees.cjs
/run_trees.js
/run_trees.d.ts
/run_trees.d.cts
/traceable.cjs
/traceable.js
/traceable.d.ts
/traceable.d.cts
/evaluation.cjs
/evaluation.js
/evaluation.d.ts
/evaluation.d.cts
/schemas.cjs
/schemas.js
/schemas.d.ts
/schemas.d.cts
/wrappers.cjs
/wrappers.js
/wrappers.d.ts
/wrappers.d.cts
/index.cjs
/index.js
/index.d.ts
/index.d.cts
## END GENERATED create-entrypoints.js
client.cjs
client.js
client.d.ts
client.d.cts
run_trees.cjs
run_trees.js
run_trees.d.ts
run_trees.d.cts
traceable.cjs
traceable.js
traceable.d.ts
traceable.d.cts
evaluation.cjs
evaluation.js
evaluation.d.ts
evaluation.d.cts
schemas.cjs
schemas.js
schemas.d.ts
schemas.d.cts
wrappers.cjs
wrappers.js
wrappers.d.ts
wrappers.d.cts
node_modules
dist
.yarn
26 changes: 26 additions & 0 deletions js/langchain.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { resolve, dirname } from "node:path";
import { fileURLToPath } from "node:url";

/**
* @param {string} relativePath
* @returns {string}
*/
function abs(relativePath) {
return resolve(dirname(fileURLToPath(import.meta.url)), relativePath);
}

export const config = {
internals: [/node\:/],
entrypoints: {
client: "client",
run_trees: "run_trees",
traceable: "traceable",
evaluation: "evaluation/index",
schemas: "schemas",
wrappers: "wrappers",
},
tsConfigPath: resolve("./tsconfig.json"),
cjsSource: "./dist-cjs",
cjsDestination: "./dist",
abs,
}
23 changes: 6 additions & 17 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,20 @@
"wrappers.cjs",
"wrappers.js",
"wrappers.d.ts",
"wrappers.d.cts",
"index.cjs",
"index.js",
"index.d.ts",
"index.d.cts"
"wrappers.d.cts"
],
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"build": "yarn clean && yarn build:esm && yarn build:cjs && node scripts/create-entrypoints.js",
"build": "yarn clean && yarn build:esm && yarn build:cjs && yarn create-entrypoints",
"bump-version": "node scripts/bump-version.js",
"check-version": "node scripts/check-version.js",
"check-npm-version": "node scripts/check-npm-version.js",
"clean": "rm -rf dist/ && node scripts/create-entrypoints.js clean",
"create-entrypoints": "yarn lc-build --config ./langchain.config.js --create-entrypoints",
"clean": "rm -rf dist/ && yarn lc-build --config ./langchain.config.js --create-entrypoints --pre",
"build:esm": "tsc --outDir dist/ && rm -rf dist/tests dist/**/tests",
"build:cjs": "tsc --outDir dist-cjs/ -p tsconfig.cjs.json && node scripts/move-cjs-to-dist.js && rm -r dist-cjs",
"build:cjs": "tsc --outDir dist-cjs/ -p tsconfig.cjs.json && yarn lc-build --config ./langchain.config.js --move-cjs-dist && rm -r dist-cjs",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --passWithNoTests --testPathIgnorePatterns='\\.int\\.test.[tj]s' --testTimeout 30000",
"test:integration": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --testPathPattern=\\.int\\.test.ts --testTimeout 100000",
"test:single": "NODE_OPTIONS=--experimental-vm-modules yarn run jest --config jest.config.cjs --testTimeout 100000",
Expand Down Expand Up @@ -75,6 +72,7 @@
"@jest/globals": "^29.5.0",
"@langchain/core": "^0.1.32",
"@langchain/langgraph": "^0.0.8",
"@langchain/scripts": "^0.0.11",
"@tsconfig/recommended": "^1.0.2",
"@types/jest": "^29.5.1",
"@typescript-eslint/eslint-plugin": "^5.59.8",
Expand Down Expand Up @@ -108,15 +106,6 @@
]
},
"exports": {
".": {
"types": {
"import": "./index.d.ts",
"require": "./index.d.cts",
"default": "./index.d.ts"
},
"import": "./index.js",
"require": "./index.cjs"
},
"./client": {
"types": {
"import": "./client.d.ts",
Expand Down
124 changes: 0 additions & 124 deletions js/scripts/create-entrypoints.js

This file was deleted.

38 changes: 0 additions & 38 deletions js/scripts/move-cjs-to-dist.js

This file was deleted.

Loading

0 comments on commit e0be710

Please sign in to comment.