@@ -6,8 +6,7 @@ const { spawn } = require("child_process");
6
6
const readline = require ( "readline" ) ;
7
7
const semver = require ( "semver" ) ;
8
8
9
- const RELEASE_BRANCH = "release" ;
10
- const MAIN_BRANCH = "main" ;
9
+ const MAIN_BRANCH = "v1" ;
11
10
12
11
/**
13
12
* Handles execSync errors and logs them in a readable format.
@@ -51,11 +50,7 @@ function getWorkspaceVersion(workspaceDirectory) {
51
50
* @returns {Array<{ dir: string, packageJSON: Record<string, any>}> }
52
51
*/
53
52
function getAllWorkspaces ( ) {
54
- const possibleWorkspaceDirectories = [
55
- "./libs/*" ,
56
- "./langchain" ,
57
- "./langchain-core" ,
58
- ] ;
53
+ const possibleWorkspaceDirectories = [ "./libs/*" , "./libs/providers/*" ] ;
59
54
const allWorkspaces = possibleWorkspaceDirectories . flatMap (
60
55
( workspaceDirectory ) => {
61
56
if ( workspaceDirectory . endsWith ( "*" ) ) {
@@ -64,22 +59,30 @@ function getAllWorkspaces() {
64
59
path . join ( process . cwd ( ) , workspaceDirectory . replace ( "*" , "" ) )
65
60
) ;
66
61
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
+ }
67
70
return {
68
71
dir : `${ workspaceDirectory . replace ( "*" , "" ) } ${ dir } ` ,
69
- packageJSON : require ( path . join (
70
- process . cwd ( ) ,
71
- `${ workspaceDirectory . replace ( "*" , "" ) } ${ dir } ` ,
72
- "package.json"
73
- ) ) ,
72
+ packageJSON : require ( packageJSONPath ) ,
74
73
} ;
75
74
} ) ;
76
- return subDirs ;
75
+ return subDirs . filter ( ( dir ) => dir !== null ) ;
77
76
}
78
- const packageJSON = require ( path . join (
77
+ const packageJSONPath = path . join (
79
78
process . cwd ( ) ,
80
79
workspaceDirectory ,
81
80
"package.json"
82
- ) ) ;
81
+ ) ;
82
+ if ( ! fs . existsSync ( packageJSONPath ) ) {
83
+ return null ;
84
+ }
85
+ const packageJSON = require ( packageJSONPath ) ;
83
86
return {
84
87
dir : workspaceDirectory ,
85
88
packageJSON,
@@ -342,26 +345,6 @@ function commitAndPushChanges(workspaceName, version, onlyPush) {
342
345
console . log ( "Successfully committed and pushed changes." ) ;
343
346
}
344
347
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
-
365
348
/**
366
349
* Prompts the user for input and returns the input. This is used
367
350
* for requesting an OTP from the user for NPM 2FA.
@@ -456,9 +439,6 @@ async function main() {
456
439
throw new Error ( `Could not find workspace ${ options . workspace } ` ) ;
457
440
}
458
441
459
- // Checkout new "release" branch & push
460
- checkoutReleaseBranch ( ) ;
461
-
462
442
// Run build, lint, tests
463
443
console . log ( "Running build, lint, and tests." ) ;
464
444
execSyncWithErrorHandling (
0 commit comments