@@ -6,8 +6,7 @@ const { spawn } = require("child_process");
66const readline = require ( "readline" ) ;
77const semver = require ( "semver" ) ;
88
9- const RELEASE_BRANCH = "release" ;
10- const MAIN_BRANCH = "main" ;
9+ const MAIN_BRANCH = "v1" ;
1110
1211/**
1312 * Handles execSync errors and logs them in a readable format.
@@ -51,11 +50,7 @@ function getWorkspaceVersion(workspaceDirectory) {
5150 * @returns {Array<{ dir: string, packageJSON: Record<string, any>}> }
5251 */
5352function getAllWorkspaces ( ) {
54- const possibleWorkspaceDirectories = [
55- "./libs/*" ,
56- "./langchain" ,
57- "./langchain-core" ,
58- ] ;
53+ const possibleWorkspaceDirectories = [ "./libs/*" , "./libs/providers/*" ] ;
5954 const allWorkspaces = possibleWorkspaceDirectories . flatMap (
6055 ( workspaceDirectory ) => {
6156 if ( workspaceDirectory . endsWith ( "*" ) ) {
@@ -64,22 +59,30 @@ function getAllWorkspaces() {
6459 path . join ( process . cwd ( ) , workspaceDirectory . replace ( "*" , "" ) )
6560 ) ;
6661 const subDirs = allDirs . map ( ( dir ) => {
62+ const packageJSONPath = path . join (
63+ process . cwd ( ) ,
64+ `${ workspaceDirectory . replace ( "*" , "" ) } ${ dir } ` ,
65+ "package.json"
66+ ) ;
67+ if ( ! fs . existsSync ( packageJSONPath ) ) {
68+ return null ;
69+ }
6770 return {
6871 dir : `${ workspaceDirectory . replace ( "*" , "" ) } ${ dir } ` ,
69- packageJSON : require ( path . join (
70- process . cwd ( ) ,
71- `${ workspaceDirectory . replace ( "*" , "" ) } ${ dir } ` ,
72- "package.json"
73- ) ) ,
72+ packageJSON : require ( packageJSONPath ) ,
7473 } ;
7574 } ) ;
76- return subDirs ;
75+ return subDirs . filter ( ( dir ) => dir !== null ) ;
7776 }
78- const packageJSON = require ( path . join (
77+ const packageJSONPath = path . join (
7978 process . cwd ( ) ,
8079 workspaceDirectory ,
8180 "package.json"
82- ) ) ;
81+ ) ;
82+ if ( ! fs . existsSync ( packageJSONPath ) ) {
83+ return null ;
84+ }
85+ const packageJSON = require ( packageJSONPath ) ;
8386 return {
8487 dir : workspaceDirectory ,
8588 packageJSON,
@@ -342,26 +345,6 @@ function commitAndPushChanges(workspaceName, version, onlyPush) {
342345 console . log ( "Successfully committed and pushed changes." ) ;
343346}
344347
345- /**
346- * Verifies the current branch is main, then checks out a new release branch
347- * and pushes an empty commit.
348- *
349- * @returns {void }
350- * @throws {Error } If the current branch is not main.
351- */
352- function checkoutReleaseBranch ( ) {
353- const currentBranch = execSync ( "git branch --show-current" ) . toString ( ) . trim ( ) ;
354- if ( currentBranch === MAIN_BRANCH || currentBranch === RELEASE_BRANCH ) {
355- console . log ( `Checking out '${ RELEASE_BRANCH } ' branch.` ) ;
356- execSyncWithErrorHandling ( `git checkout -B ${ RELEASE_BRANCH } ` ) ;
357- execSyncWithErrorHandling ( `git push -u origin ${ RELEASE_BRANCH } ` ) ;
358- } else {
359- throw new Error (
360- `Current branch is not ${ MAIN_BRANCH } or ${ RELEASE_BRANCH } . Current branch: ${ currentBranch } `
361- ) ;
362- }
363- }
364-
365348/**
366349 * Prompts the user for input and returns the input. This is used
367350 * for requesting an OTP from the user for NPM 2FA.
@@ -456,9 +439,6 @@ async function main() {
456439 throw new Error ( `Could not find workspace ${ options . workspace } ` ) ;
457440 }
458441
459- // Checkout new "release" branch & push
460- checkoutReleaseBranch ( ) ;
461-
462442 // Run build, lint, tests
463443 console . log ( "Running build, lint, and tests." ) ;
464444 execSyncWithErrorHandling (
0 commit comments