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

Fix Node 8 Build #98

Merged
merged 3 commits into from
Oct 15, 2020

Conversation

martinfrancois
Copy link
Contributor

See #97

I tried running the build on master in my fork and noticed that it was failing too.

After trying out different versions for different dependencies I found that the culprit was the prettier dependency, which causes the master to fail since the version is specified as ^2.0.5, which means it will use any 2.x.x version which is >=2.0.5. Specifically, every version >2.0.5, so for instance 2.1.0 causes the build to fail.

To fix the issue, I set the version of prettier to 2.0.5, since this is the last version which works with Node 8.

I also updated all of the dependencies to their latest versions which still work with Node 8.
In particular, the following dependencies and versions are NOT working with Node 8:

  • Jest from >=26.0.0
  • Prettier from >2.0.5
  • Eslint from >=7.0.0

To prevent an issue like in #97 from happening again in the future, I commited the package-lock.json file, as is recommended by npm, shown in a message on every run:

npm notice created a lockfile as package-lock.json. You should commit this file.

By doing so, Travis CI will use npm ci instead of npm install, which will read the dependency information from there, which is reproducible (in contrast to package.json, which has version ranges defined) since it exactly defines which version of which dependency and sub-dependency is used.
This means, as long as the package-lock.json file is not changed, someone making a PR in any amount of months where a dependency introduces a breaking change in a minor / patch version accidentally, it will not cause the build to fail, as long as package-lock.json is not changed.

All versions higher than 2.0.5 are NOT compatible with Node 8 and result in the build failing.

Signed-off-by: martinfrancois <[email protected]>
Versions not supported by Node 8:
- Jest from >=26.0.0
- Prettier from >2.0.5
- Eslint from >=7.0.0

Signed-off-by: martinfrancois <[email protected]>
This is recommended by npm, when running `npm install`:
```
npm notice created a lockfile as package-lock.json. You should commit this file.
```

This enables running `npm ci` on CI to consistently use the same dependency versions as of the state of `package-lock.json`.
This makes builds more reproducible, since they cannot break due to updated dependencies, which introduce breaking changes in minor or patch version upgrades.

Signed-off-by: martinfrancois <[email protected]>
Copy link
Contributor

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

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

Thanks a lot! 👍

@christian-bromann christian-bromann merged commit 24b0d6e into saucelabs:master Oct 15, 2020
@martinfrancois martinfrancois deleted the fix-node-8-build branch October 15, 2020 10:43
@martinfrancois
Copy link
Contributor Author

@christian-bromann Thanks for merging! Could you please add a label for hacktoberfest-accepted? Thanks!

@christian-bromann christian-bromann added the Hacktoberfest Curated issues which are well scoped and ready to be worked on as part of Hacktoberfest label Oct 15, 2020
@christian-bromann
Copy link
Contributor

@martinfrancois is it needed given that the repo already has a hacktoberfest topic?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hacktoberfest Curated issues which are well scoped and ready to be worked on as part of Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants