You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: libs/langchain-scripts/README.md
+51Lines changed: 51 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -7,3 +7,54 @@ This package contains the LangChain.js shared scripts for our packages.
7
7
```bash npm2yarn
8
8
npm install @langchain/scripts
9
9
```
10
+
11
+
## Usage
12
+
13
+
### Build Script
14
+
15
+
The build script supports both traditional TypeScript compilation and modern tsup-based builds.
16
+
17
+
```bash
18
+
npx lc_build
19
+
```
20
+
21
+
#### Traditional TypeScript Build
22
+
23
+
By default, the build script uses TypeScript's compiler (tsc) to build both ESM and CJS versions of your package.
24
+
25
+
#### tsup-based Build
26
+
27
+
The build script can also use [tsup](https://github.com/egoist/tsup) (a zero-config TypeScript bundler powered by esbuild) which offers significant performance improvements (10-100x faster builds).
28
+
29
+
To migrate your package to use tsup:
30
+
31
+
```bash
32
+
npx lc_build --migrate-build
33
+
```
34
+
35
+
This command performs several migration steps:
36
+
1. Creates a `tsup.config.ts` file with sensible defaults for LangChain packages
37
+
2. Updates TypeScript to the latest version in your package.json
38
+
3. Ensures your package.json has a `type-check` script
39
+
4. Backs up the tsconfig.cjs.json file (which is no longer needed with tsup)
40
+
5. Provides guidance on updating build scripts if needed
41
+
42
+
After migration, simply run the build script normally:
43
+
44
+
```bash
45
+
npx lc_build
46
+
```
47
+
48
+
The script will automatically detect the presence of a tsup configuration file and use it for building.
0 commit comments