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

build: Add Node 12, fix cache, discontinue Node 8 #159

Merged
merged 3 commits into from Apr 12, 2020
Merged

Conversation

Krinkle
Copy link
Contributor

@Krinkle Krinkle commented Apr 11, 2020

Add Node 12 testing, discontinue Node 8 and earlier

  • The Node 4 LTS reached end-of-life in April 2018.
  • The Node 6 LTS reached end-of-life in April 2019.
  • The Node 8 LTS reached enf-of-life in December 2019.

https://nodejs.org/en/about/releases/
https://github.com/nodejs/Release#end-of-life-releases

This is done as preparation before other contributions I plan to make to update dependencies (some of which no longer support older versions), and some simplifications (some of which would
require additional packages be added to support older versions).

The previous versions of this package naturally conitinue to be available for those using them on older Node.js versions, and in the event of a critical bug we could even create an v0.x-release" branch or something and create a new patch release from there against the older code.


Minor CI changes

  • Remove 'sudo: false'. This was to make Travis use a fast container, instead of a VM. But, this option no longer exits. Travis now always uses a VM, and they're relatively fast.

  • Use 'cache: npm'.

    This repo has package-lock.json, which is great! (thank you). When package-lock.json exists, the installer deletes node_modules completely and rebuilds it fresh, based on the lock file.
    During local development, this is very fast because npm also has a cache at $HOME/.npm (which is not deleted).

    The 'cache: npm' shortcut will cache "$HOME/.npm" instead of "node_modules". Otherwise, this directory is copied by Travis from the cache but then immediately deleted by npm-install/npm-ci.

    https://docs.travis-ci.com/user/languages/javascript-with-nodejs/#caching-with-npm

  • Make 'npm test' include lint checks.

    This project uses ESLint and it can be run manually via 'npm run lint'. It is also run automatically by Travis.

    Make ESLint also executed by default when developers run 'npm test' locally. That makes it easier to contribute by not having to learn about lint issues after submitting a patch, and not having to read .travis.yaml or package.json in detail.

* The Node 4 LTS reached end-of-life in April 2018.
* The Node 6 LTS reached end-of-life in April 2019.
* The Node 8 LTS reached enf-of-life in December 2019.

<https://nodejs.org/en/about/releases/>
<https://github.com/nodejs/Release#end-of-life-releases>

This is done as preparation before other contributions I plan
to make to update dependencies (some of which no longer support
older versions), and some simplifications (some of which would
require additional packages be added to support older versions).

The previous versions of this package naturally conitinue to
be available for those using them on older Node.js versions,
and in the event of a critical bug we could even create an
"v0.x-release" branch or something and create a new patch release
from there against the older code.
* Remove 'sudo: false'. This was to make Travis use a fast container,
  instead of a VM. But, this option no longer exits.
  Travis now always uses a VM, and they're relatively fast.

* Use 'cache: npm'.

  This repo has package-lock.json, which is great! (thank you).
  When package-lock.json exists, the installer deletes node_modules
  completely and rebuilds it fresh, based on the lock file.
  During local development, this is very fast because npm also has a
  cache at $HOME/.npm (which is not deleted).

  The 'cache: npm' shortcut will cache "$HOME/.npm" instead of
  "node_modules". Otherwise, this directory is copied by Travis
  from the cache but then immediately deleted by npm-install/npm-ci.

  <https://docs.travis-ci.com/user/languages/javascript-with-nodejs/#caching-with-npm>

* Make 'npm test' include lint checks.

  This project uses ESLint and it can be run manually via 'npm run lint'.
  It is also run automatically by Travis.

  Make ESLint also executed by default when developers run 'npm test'
  locally. That makes it easier to contribute by not having to learn
  about lint issues after submitting a patch, and not having to read
  .travis.yaml or package.json in detail.
* Update from wikimedia eslint 0.8 to 0.15
  - eslint-config-wikimedia now extends eslint, thus eslint is no
    longer needed as explicit dependency.
  - The eslint settings are now separate for browser JS and
    Node.js. Update eslintrc to make this work correctly.

* Use 'Buffer.from(string, encoding)' instead of 'new Buffer()'.

  The Buffer constructor has been deprecated as it had too manu
  ambiguous purposes. In this case, the purpose was to convert
  a utf-8 string, for which the explicit method is now Buffer.from().

  > new Buffer() is deprecated. Use Buffer.from(), Buffer.alloc(),
  > or Buffer.allocUnsafe() instead
  > [no-buffer-constructor]
  > https://nodejs.org/docs/v10.15.0/api/buffer.html#buffer_new_buffer_string_encoding

* Add line break in 'if (…) { … }'

  > This line has 2 statements. Maximum allowed is 1
  > [max-statements-per-line]

  This is a style rule part of eslint-config-wikimedia which
  has become stricter. The code mostly followed this style already,
  except for a few cases in examples/, which have been updated
  for consistency.

* Remove redundant '(function (){ …}())' in lib/ files.

  This pattern is an Immediate-Invoked-Function-Expression (IIFE),
  which exists mainly for the purpose of creating a private scope
  for variables.

  This is useful in client-side JS for a web browser, but not
  in Node.js because every file already has its own private scope
  by default.

  This change might be easier to review by setting
  "[x] Hide whitespace changes" in diff settings.
  (Or add ?w=1 to the URL.)
@macbre
Copy link
Owner

macbre commented Apr 11, 2020

@Krinkle - this look really good! Thanks! Will give it a more in-depth review soon and merge it.

@macbre macbre added this to the v0.13 milestone Apr 11, 2020
@macbre macbre self-requested a review April 11, 2020 20:47
package.json Show resolved Hide resolved
@macbre macbre merged commit 8c94d36 into macbre:devel Apr 12, 2020
@macbre
Copy link
Owner

macbre commented Apr 12, 2020

@Krinkle - v0.13.0 puished to npm. Thanks once again for this change and your future plans regarding nodemw.

Looking forward to your next commits :)

@Krinkle Krinkle deleted the build branch April 12, 2020 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants