FluidFramework
FluidFramework copied to clipboard
Require at least node >=14.13.0
Description
Enforce that the version of node used is at least 14.13.0 (released on 2020-09-29), which according to https://www.the-guild.dev/blog/support-nodejs-esm means it should support ESM. This uses the mechanism documented in https://docs.npmjs.com/cli/v8/configuring-npm/package-json#engines.
This produces an error when running npm i in the root if using an older version of node.
Note that the 14 branch of node is the oldest supported branch (see https://nodejs.org/en/about/releases/), no one should be one node older than 14, so updating to at least 14.13.0 should be a non-breaking change.
Additionally, our .nvmrc file specifies node 14, and our readme says to use that version.
Since this is in the root package.json, not one we ship to users, it should have no impact on consumers of our packages.
Reviewer Guidance
I'm not aware of us placing any restrictions on node versions within the 14 range in the past. This change is intended to introduce a new approach for being explicit about how old of Node we support for development.
I'd like opinions on if this is a good approach to take, and if this is a good version to start with. I'm not aware of any other specific features that were added to 14 after release that we might care about: if you have a reason to pick some other version let me know.
Example Error
If I force requiring version 15 instead (so my system errors) the error looks like:
$ npm i
npm ERR! code ENOTSUP
npm ERR! notsup Unsupported engine for [email protected]: wanted: {"node":">=15.13.0"} (current: {"node":"14.19.3","npm":"6.14.17"})
npm ERR! notsup Not compatible with your version of node/npm: [email protected]
npm ERR! notsup Not compatible with your version of node/npm: [email protected]
npm ERR! notsup Required: {"node":">=15.13.0"}
npm ERR! notsup Actual: {"npm":"6.14.17","node":"14.19.3"}
I have confirmed npm ci also produces this error.
Build is failing due to modified .npmrc:
modified: .npmrc
##[error]Build should not create extraenous files
I'm not sure what to do about that. Is there any way to see what modifications it found?
I'm not sure what to do about that. Is there any way to see what modifications it found?
I don't think there's an easy way to see the file content unless it wound up in a build artifact. Ideally the build task that checks for modified files would output the necessary stuff to debug, but it doesn't. Code is here:
https://github.com/microsoft/FluidFramework/blob/fcdbc91381d3ffe179a611a7f55ed418018be4e2/tools/pipelines/templates/build-npm-package.yml#L382-L392
Quick and dirty fix might be to exclude .npmrc.
My guess is that the CI pipeline itself is responsible for the changes. We add/update .npmrc in order to publish to private feeds:
https://github.com/microsoft/FluidFramework/blob/fcdbc91381d3ffe179a611a7f55ed418018be4e2/tools/pipelines/templates/include-publish-npm-package-steps.yml#L28-L62
However, that step is only after we pack, and seems to be in a subfolder so it should be isolated. I didn't look at the code very deeply, though.
Possibly relevant discussion: https://github.com/microsoft/FluidFramework/issues/7820#issuecomment-1064233169