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

chore (package): Specify Node version and document versions. #3352

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shaper
Copy link
Contributor

@shaper shaper commented Oct 24, 2024

Developers can unintentionally install and build with Node or pnpm
versions we don't officially support. Currently our CI runs with Node
v18 and v20, and we're using pnpm v8.

This change adds an engines field to the top level package.json
file. This will output a warning on install/build if the engine
version doesn't match the specified range.

The pnpm version is already specified in packageManager to reflect
the version we use in CI, although it is not enforced or warned if,
for example, the developer is on v9.

This change also updates the README to note supported Node engine
versions and pnpm version used.

We can consider for the future but choose not to pursue for now:

  • placing engine-strict=true in the top level .npmrc to
    hard-fail on incompatible engine versions
  • adding a preinstall/prebuild command that checks versions with
    more explicit failures, messaging, etc.

@shaper shaper requested a review from lgrammel October 24, 2024 03:09
@shaper shaper force-pushed the pr/tool-versions branch 2 times, most recently from addb571 to 5e6ae5d Compare October 24, 2024 03:15
@shaper shaper changed the title chore (package): Specify and update engine/pnpm versions. chore (package): Specify Node version and document versions. Oct 24, 2024
Developers can unintentionally install and build with Node or `pnpm`
versions we don't officially support. Currently our CI runs with Node
v18 and v20, and we're using `pnpm` v8.

This change adds an `engines` field to the top level `package.json`
file. This will output a warning on install/build if the engine
version doesn't match the specified range.

The `pnpm` version is already specified in `packageManager` to reflect
the version we use in CI, although it is not enforced or warned if,
for example, the developer is on v9.

This change also updates the README to note supported Node engine
versions and `pnpm` version used.

We can consider for the future but choose not to pursue for now:
- placing `engine-strict=true` in the top level `.npmrc` to
  hard-fail on incompatible engine versions
- adding a preinstall/prebuild command that checks versions with
  more explicit failures, messaging, etc.
@@ -8,10 +8,15 @@ To learn more about how to use the AI SDK, check out our [API Reference](https:/

## Installation

You will need Node.js 18+ and pnpm installed on your local development machine.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This README is for using the AI SDK and should not be changed. We have a separate contribution guide ( CONTRIBUTING.md in root ) that should contain this information.


```shell
npm install ai
Copy link
Collaborator

Choose a reason for hiding this comment

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

NPM is fine for using the AI SDK ( as is pnpm, bun, etc) - only NPM here for illustration purposes.

Comment on lines +41 to +43
"engines": {
"node": "^18.0.0 || ^20.0.0"
},
Copy link
Collaborator

@lgrammel lgrammel Oct 24, 2024

Choose a reason for hiding this comment

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

What effect does the engine spec have on the root level in the day-to-day usage for maintainers, i.e. when will the warning show up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants