Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all[major]: Better release workflow #3717

Merged
merged 52 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
993b27e
all[minor]: Better release workflow
bracesproul Dec 19, 2023
8f231c1
cr
bracesproul Dec 19, 2023
cf56b77
added release-it & config files to all pkgs, and template
bracesproul Dec 19, 2023
1d62cd7
tmp: rename mistralai to brace from langchain
bracesproul Dec 19, 2023
10fd9d3
tmp: rename mistralai to brace from langchain
bracesproul Dec 19, 2023
a79a22d
add missing test infra to libs
bracesproul Dec 19, 2023
b36f4f8
cr
bracesproul Dec 19, 2023
b9aa0f3
cr
bracesproul Dec 20, 2023
c681102
cr
bracesproul Dec 20, 2023
a9c84c0
cr
bracesproul Dec 20, 2023
ccd842e
cr
bracesproul Dec 20, 2023
4f86a60
chore: lint files
bracesproul Dec 20, 2023
ddab99c
cr
bracesproul Dec 20, 2023
91785c1
Merge branch 'main' of https://github.com/langchain-ai/langchainjs in…
bracesproul Dec 20, 2023
ff0ed24
revert mistral workspace name change
bracesproul Dec 20, 2023
3d21ae8
chore: lint files
bracesproul Dec 20, 2023
87220e6
update pkg json script
bracesproul Dec 20, 2023
c91724b
tmp change names
bracesproul Dec 20, 2023
26fd4e3
cr
bracesproul Dec 20, 2023
fe41b01
cr
bracesproul Dec 20, 2023
611c788
cr
bracesproul Dec 20, 2023
040e018
cr
bracesproul Dec 20, 2023
0112b28
cr
bracesproul Dec 20, 2023
6e01960
cr
bracesproul Dec 20, 2023
269b89f
try/catch around yarn install
bracesproul Dec 20, 2023
473e595
cr
bracesproul Dec 20, 2023
a1c3232
cr
bracesproul Dec 20, 2023
a30225f
cr
bracesproul Dec 20, 2023
a311f3c
cr
bracesproul Dec 20, 2023
9f351e1
cr
bracesproul Dec 20, 2023
9b6c448
cr
bracesproul Dec 20, 2023
0b4feed
cr
bracesproul Dec 20, 2023
c18df4b
update scripts
bracesproul Dec 20, 2023
113870d
merge main
bracesproul Dec 20, 2023
c788d6b
tmp make mistral basproul npm
bracesproul Dec 20, 2023
0c704f5
account for npm 2fa
bracesproul Dec 20, 2023
12e8320
cr
bracesproul Dec 20, 2023
aa28610
cr
bracesproul Dec 20, 2023
b531b48
cr
bracesproul Dec 20, 2023
aa20aff
cr
bracesproul Dec 20, 2023
4314ce3
support for npm tags
bracesproul Dec 20, 2023
7e4b7d1
cr
bracesproul Dec 20, 2023
bf06d3f
revert basproul changes
bracesproul Dec 20, 2023
404a9d4
chore: lint files
bracesproul Dec 20, 2023
7e21927
cr
bracesproul Dec 20, 2023
d3924df
drop release it script
bracesproul Dec 20, 2023
1096398
verify version with semver
bracesproul Dec 21, 2023
fd14a8b
drop empty tests
bracesproul Dec 21, 2023
497b92c
fix dep
bracesproul Dec 21, 2023
bfbde50
docs
bracesproul Dec 21, 2023
6d7ffb1
Merge branch 'main' into brace/better-releases
bracesproul Dec 21, 2023
75b3462
Update CONTRIBUTING.md
jacoblee93 Dec 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,24 @@ even patch releases may contain [non-backwards-compatible changes](https://semve
If your contribution has made its way into a release, we will want to give you credit on Twitter (only if you want though)!
If you have a Twitter account you would like us to mention, please let us know in the PR or in another manner.

#### Integration releases

You can invoke the release flow by calling `yarn release` from the package root.

There are three parameters which can be passed to this script, one required and two optional.

- __Required__: `--workspace <workspace name>`. eg: `--workspace @langchain/core` (always appended as the first flag when running `yarn release`)
- __Optional__: `--version <version number>` eg: `--version 1.0.8`. Defaults to adding one to the patch version.
- __Optional__: `--bump-deps` eg `--bump-deps` Will find all packages in the repo which depend on this workspace and checkout a new branch, update the dep version, run yarn install, commit & push to new branch.
- __Optional__: `--tag <tag>` eg `--tag beta` Add a tag to the NPM release.
- __Optional__: `--inc <inc>` eg `--inc patch` The semver increment to apply to the version. Can be one of `major`, `minor`, `patch`, `premajor`, `preminor`, `prepatch`, or `prerelease`. Defaults to `patch`.

This script automatically bumps the package version, creates a new release branch with the changes, pushes the branch to GitHub, uses `release-it` to automatically release to NPM, and more depending on the flags passed.

Halfway through this script, you'll be prompted to enter an NPM OTP (typically from an authenticator app). This value is not stored anywhere and is only used to authenticate the NPM release.

Full example: `yarn release @langchain/core --version 2.0.0 --bump-deps --tag beta --inc major`.

### 🛠️ Tooling

This project uses the following tools, which are worth getting familiar
Expand Down
14 changes: 14 additions & 0 deletions libs/create-langchain-integration/helpers/default_file_contents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,17 @@ yarn lint && yarn format

If you add a new file to be exported, either import & re-export from \`src/index.ts\`, or add it to \`scripts/create-entrypoints.js\` and run \`yarn build\` to generate the new entrypoint.
`;

export const DEFAULT_RELEASE_IT = `{
"github": {
"release": true,
"autoGenerate": true,
"tokenRef": "GITHUB_TOKEN_RELEASE"
},
"npm": {
"versionArgs": [
"--workspaces-update=false"
]
}
}
`;
7 changes: 6 additions & 1 deletion libs/create-langchain-integration/helpers/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import fs from "fs/promises";
import os from "os";

import { copy } from "./copy";
import { DEFAULT_ESLINTRC, DEFAULT_README } from "./default_file_contents";
import {
DEFAULT_ESLINTRC,
DEFAULT_README,
DEFAULT_RELEASE_IT,
} from "./default_file_contents";

/**
* Install a internal template to a given `root` directory.
Expand Down Expand Up @@ -43,6 +47,7 @@ export async function installTemplate({ appName, root }: any) {

await fs.writeFile(path.join(root, ".eslintrc.cjs"), DEFAULT_ESLINTRC);
await fs.writeFile(path.join(root, "README.md"), DEFAULT_README);
await fs.writeFile(path.join(root, ".release-it.json"), DEFAULT_RELEASE_IT);

console.log("\nDone!\n");
}
2 changes: 1 addition & 1 deletion libs/create-langchain-integration/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"lint:fix": "yarn lint --fix",
"clean": "rm -rf dist/ && NODE_OPTIONS=--max-old-space-size=4096 node scripts/create-entrypoints.js pre",
"prepack": "yarn build",
"release": "release-it --only-version --config .release-it.json",
"test": "NODE_OPTIONS=--experimental-vm-modules jest --testPathIgnorePatterns=\\.int\\.test.ts --testTimeout 30000 --maxWorkers=50%",
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch --testPathIgnorePatterns=\\.int\\.test.ts",
"test:single": "NODE_OPTIONS=--experimental-vm-modules yarn run jest --config jest.config.cjs --testTimeout 100000",
Expand All @@ -44,6 +43,7 @@
"@typescript-eslint/parser": "^6.12.0",
"dotenv": "^16.3.1",
"dpdm": "^3.12.0",
"release-it": "^15.10.1",
"eslint": "^8.33.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.6.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
bracesproul marked this conversation as resolved.
Show resolved Hide resolved

afterAll(awaitAllCallbacks);
12 changes: 12 additions & 0 deletions libs/langchain-anthropic/.release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"github": {
"release": true,
"autoGenerate": true,
"tokenRef": "GITHUB_TOKEN_RELEASE"
},
"npm": {
"versionArgs": [
"--workspaces-update=false"
]
}
}
1 change: 1 addition & 0 deletions libs/langchain-anthropic/jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ module.exports = {
],
setupFiles: ["dotenv/config"],
testTimeout: 20_000,
passWithNoTests: true
};
1 change: 0 additions & 1 deletion libs/langchain-anthropic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"lint:fix": "yarn lint:eslint --fix && yarn lint:dpdm",
"clean": "rimraf .turbo/ dist/ && NODE_OPTIONS=--max-old-space-size=4096 node scripts/create-entrypoints.js pre",
"prepack": "yarn build",
"release": "release-it --only-version --config .release-it.json",
"test": "yarn run build:deps && NODE_OPTIONS=--experimental-vm-modules jest --testPathIgnorePatterns=\\.int\\.test.ts --testTimeout 30000 --maxWorkers=50%",
"test:watch": "yarn run build:deps && NODE_OPTIONS=--experimental-vm-modules jest --watch --testPathIgnorePatterns=\\.int\\.test.ts",
"test:single": "yarn run build:deps && NODE_OPTIONS=--experimental-vm-modules yarn run jest --config jest.config.cjs --testTimeout 100000",
Expand Down
3 changes: 3 additions & 0 deletions libs/langchain-anthropic/scripts/jest-setup-after-env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";

afterAll(awaitAllCallbacks);
12 changes: 12 additions & 0 deletions libs/langchain-community/.release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"github": {
"release": true,
"autoGenerate": true,
"tokenRef": "GITHUB_TOKEN_RELEASE"
},
"npm": {
"versionArgs": [
"--workspaces-update=false"
]
}
}
1 change: 0 additions & 1 deletion libs/langchain-community/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"lint:fix": "yarn lint --fix",
"clean": "rm -rf dist/ && NODE_OPTIONS=--max-old-space-size=4096 node scripts/create-entrypoints.js pre",
"prepack": "yarn build",
"release": "release-it --only-version --config .release-it.json",
"test": "yarn run build:deps && NODE_OPTIONS=--experimental-vm-modules jest --testPathIgnorePatterns=\\.int\\.test.ts --testTimeout 30000 --maxWorkers=50%",
"test:watch": "yarn run build:deps && NODE_OPTIONS=--experimental-vm-modules jest --watch --testPathIgnorePatterns=\\.int\\.test.ts",
"test:single": "yarn run build:deps && NODE_OPTIONS=--experimental-vm-modules yarn run jest --config jest.config.cjs --testTimeout 100000",
Expand Down
3 changes: 3 additions & 0 deletions libs/langchain-community/scripts/jest-setup-after-env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";

afterAll(awaitAllCallbacks);
12 changes: 12 additions & 0 deletions libs/langchain-google-genai/.release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"github": {
"release": true,
"autoGenerate": true,
"tokenRef": "GITHUB_TOKEN_RELEASE"
},
"npm": {
"versionArgs": [
"--workspaces-update=false"
]
}
}
2 changes: 1 addition & 1 deletion libs/langchain-google-genai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"lint:fix": "yarn lint --fix",
"clean": "rm -rf dist/ && NODE_OPTIONS=--max-old-space-size=4096 node scripts/create-entrypoints.js pre",
"prepack": "yarn build",
"release": "release-it --only-version --config .release-it.json",
"test": "NODE_OPTIONS=--experimental-vm-modules jest --testPathIgnorePatterns=\\.int\\.test.ts --testTimeout 30000 --maxWorkers=50%",
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch --testPathIgnorePatterns=\\.int\\.test.ts",
"test:single": "NODE_OPTIONS=--experimental-vm-modules yarn run jest --config jest.config.cjs --testTimeout 100000",
Expand Down Expand Up @@ -57,6 +56,7 @@
"jest": "^29.5.0",
"jest-environment-node": "^29.6.4",
"prettier": "^2.8.3",
"release-it": "^15.10.1",
"rollup": "^4.5.2",
"ts-jest": "^29.1.0",
"typescript": "<5.2.0"
Expand Down
3 changes: 3 additions & 0 deletions libs/langchain-google-genai/scripts/jest-setup-after-env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";

afterAll(awaitAllCallbacks);
12 changes: 12 additions & 0 deletions libs/langchain-mistralai/.release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"github": {
"release": true,
"autoGenerate": true,
"tokenRef": "GITHUB_TOKEN_RELEASE"
},
"npm": {
"versionArgs": [
"--workspaces-update=false"
]
}
}
1 change: 1 addition & 0 deletions libs/langchain-mistralai/jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ module.exports = {
],
setupFiles: ["dotenv/config"],
testTimeout: 20_000,
passWithNoTests: true
};
2 changes: 1 addition & 1 deletion libs/langchain-mistralai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"lint:fix": "yarn lint --fix",
"clean": "rm -rf dist/ && NODE_OPTIONS=--max-old-space-size=4096 node scripts/create-entrypoints.js pre",
"prepack": "yarn build",
"release": "release-it --only-version --config .release-it.json",
"test": "NODE_OPTIONS=--experimental-vm-modules jest --testPathIgnorePatterns=\\.int\\.test.ts --testTimeout 30000 --maxWorkers=50%",
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch --testPathIgnorePatterns=\\.int\\.test.ts",
"test:single": "NODE_OPTIONS=--experimental-vm-modules yarn run jest --config jest.config.cjs --testTimeout 100000",
Expand Down Expand Up @@ -55,6 +54,7 @@
"jest": "^29.5.0",
bracesproul marked this conversation as resolved.
Show resolved Hide resolved
"jest-environment-node": "^29.6.4",
"prettier": "^2.8.3",
"release-it": "^15.10.1",
"rollup": "^4.5.2",
"ts-jest": "^29.1.0",
"typescript": "<5.2.0"
Expand Down
3 changes: 3 additions & 0 deletions libs/langchain-mistralai/scripts/jest-setup-after-env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";

afterAll(awaitAllCallbacks);
12 changes: 12 additions & 0 deletions libs/langchain-openai/.release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"github": {
"release": true,
"autoGenerate": true,
"tokenRef": "GITHUB_TOKEN_RELEASE"
},
"npm": {
"versionArgs": [
"--workspaces-update=false"
]
}
}
1 change: 1 addition & 0 deletions libs/langchain-openai/jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ module.exports = {
setupFiles: ["dotenv/config"],
setupFilesAfterEnv: ["./scripts/jest-setup-after-env.js"],
testTimeout: 20_000,
passWithNoTests: true
};
1 change: 0 additions & 1 deletion libs/langchain-openai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"lint:fix": "yarn lint:eslint --fix && yarn lint:dpdm",
"clean": "rimraf .turbo/ dist/ && NODE_OPTIONS=--max-old-space-size=4096 node scripts/create-entrypoints.js pre",
"prepack": "yarn build",
"release": "release-it --only-version --config .release-it.json",
"test": "yarn run build:deps && NODE_OPTIONS=--experimental-vm-modules jest --testPathIgnorePatterns=\\.int\\.test.ts --testTimeout 30000 --maxWorkers=50%",
"test:watch": "yarn run build:deps && NODE_OPTIONS=--experimental-vm-modules jest --watch --testPathIgnorePatterns=\\.int\\.test.ts",
"test:single": "yarn run build:deps && NODE_OPTIONS=--experimental-vm-modules yarn run jest --config jest.config.cjs --testTimeout 100000",
Expand Down
2 changes: 1 addition & 1 deletion libs/langchain-openai/scripts/jest-setup-after-env.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { awaitAllCallbacks } from "../src/callbacks/promises.js";
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";

afterAll(awaitAllCallbacks);
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,20 @@
"example": "yarn workspace examples start",
bracesproul marked this conversation as resolved.
Show resolved Hide resolved
"precommit": "turbo run precommit",
"docs": "yarn workspace core_docs start",
"docs:api_refs": "yarn workspace api_refs start"
"docs:api_refs": "yarn workspace api_refs start",
"release": "node release_workspace.js --workspace"
},
"author": "LangChain",
"license": "MIT",
"devDependencies": {
"@tsconfig/recommended": "^1.0.2",
"@types/jest": "^29.5.3",
"@types/semver": "^7",
"commander": "^11.1.0",
"dotenv": "^16.0.3",
"lint-staged": "^13.1.1",
"prettier": "^2.8.3",
"semver": "^7.5.4",
"typescript": "~5.1.6"
},
"dependencies": {
Expand Down
Loading