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

ci[minor]: Start building on windows #6188

Merged
merged 29 commits into from
Jul 24, 2024
Merged

ci[minor]: Start building on windows #6188

merged 29 commits into from
Jul 24, 2024

Conversation

bracesproul
Copy link
Member

@bracesproul bracesproul commented Jul 23, 2024

Fixes build when running on windows
Renames build script (npm deals with : in a funny way for scripts)
Added CI test for building @langchain/core in macos, windows and ubuntu

Copy link

vercel bot commented Jul 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2024 9:31pm
langchainjs-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2024 9:31pm

@bracesproul bracesproul marked this pull request as ready for review July 24, 2024 19:21
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 24, 2024
import { Command } from "commander";
import { rollup } from "rollup";
import { rollup } from "@rollup/wasm-node";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rollup does not work the same on windows, see here

@@ -27,6 +28,50 @@ async function asyncSpawn(command: string, args: string[]) {
});
}

const deleteFolderRecursive = async function (inputPath: string) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleting directories on windows does not act the same as mac. Need this recursive func to manage deleting directories w/ contents.

@@ -16,6 +16,7 @@ async function asyncSpawn(command: string, args: string[]) {
...process.env,
NODE_OPTIONS: "--max-old-space-size=4096",
},
shell: true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required for windows

Comment on lines +665 to +668
if (process.platform === "win32") {
// windows, must resolve path with file://
langchainConfigPath = `file:///${langchainConfigPath}`;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can not import modules (langchain.config.js) on windows with the protocol d:

Full error:

Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'd:'

rimraf("dist"),
rimraf(".turbo"),
deleteFolderRecursive("dist").catch((e) => {
console.error("Error removing dist (pre && shouldGenMaps)");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added logs to make debugging a little easier

Comment on lines +726 to +727
// Required for cross-platform compatibility.
// Windows does not manage globs the same as Max/Linux when deleting directories.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the comment says...

@@ -43,3 +43,20 @@ jobs:
uses:
./.github/workflows/test-exports.yml
secrets: inherit

platform-compatibility:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will now try and build @langchain/core on windows, macos and ubuntu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:improvement Medium size change to existing code to handle new use-cases size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant