Make WordPress Core

Opened 9 years ago

Closed 6 years ago

#35105 closed task (blessed) (fixed)

Specifiy minimum node and npm version in package.json

Reported by: jorbin's profile jorbin Owned by:
Milestone: 5.0 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch commit
Focuses: Cc:

Description

Currently, package.json doesn't specify the engine property in package.json. Some of the dependencies though have minimum versions of node. This can lead to notices when a developer does an npm install. Specifying the minimum will make it easier for developers to know that the node and npm versions they should have installed are supported.

Attachments (6)

35105.diff (370 bytes) - added by netweb 9 years ago.
35105.2.diff (760 bytes) - added by netweb 8 years ago.
35105.3.diff (1.0 KB) - added by netweb 8 years ago.
stranger-node-things.diff (23.1 KB) - added by netweb 8 years ago.
35105.4.diff (363 bytes) - added by netweb 7 years ago.
35105.4-travis.diff (308 bytes) - added by netweb 7 years ago.

Download all attachments as: .zip

Change History (61)

#1 @netweb
9 years ago

My notes from #30787 ( Shrinkwrap NPM dependencies):

Also we should be using at least NodeJS v0.12.x as PostCSS requires this v0.12.x or greater, and WordPress includes two node modules that use PostCSS, Autoprefixer and RTLCSS.

I'd be tempted to actually recommend that we bump up our minimum supported NodeJS version to v4.x LTS per the LTS announcment, this brings back compatibility of IO.JS and NodeJS branches and gives us a somewhat more dependable NodeJS base that module owners are aware of for maintaining backcompat for this NodeJS version.

I just hit upon the NodeJS LTS document: https://github.com/nodejs/LTS/blob/master/README.md which details the LTS plan and roadmap which clears things up a bit on whats whats in regard to the timelines of NodeJS versions


Grepping the /node_modules folder shows the vast majority of packages require NodeJS >=0.10, and 4 require >=0.12

  • PostCSS requires NodeJS >=0.12 so that includes autoprefixer, grunt-rtlcss, and grunt-postcss.
  • get-stdin is a dependant in the grunt-contrib-imagemin tree and also requires NodeJS >=0.12

None required NodeJS v4.x or greater so we can use NodeJS >=0.12 for now, and switch to v4.x LTS once that need arises.


Complimentary to this ticket could be to add grunt-check-dependencies via check-dependencies:

The checkDependencies task checks if the package has all necessary dependencies installed in right versions. If that's not the case, the task fails and advises to run npm install.

It was added to BuddyPress in changeset:10399 and the Grunt task is run before any other Grunt tasks, if it fails your prompted with the advisory to run npm install, works quite well and takes some of the pain out of working out maintaining your npm workflow.

@netweb
9 years ago

#2 @netweb
9 years ago

  • Keywords has-patch added

@jorbin I've added { "engines" : { "node" : ">=0.12" } } in the 35105.diff patch.

This ticket was mentioned in Slack in #core by jorbin. View the logs.


9 years ago

#4 @jorbin
9 years ago

  • Type changed from enhancement to task (blessed)

#5 @kirasong
9 years ago

  • Owner set to jorbin
  • Status changed from new to assigned

This ticket was mentioned in Slack in #core by chriscct7. View the logs.


9 years ago

#7 @jorbin
9 years ago

  • Milestone 4.5 deleted

This requires some coordination with the .org infrastructure team to make sure the build server is updated. Going to punt until I get a chance to do that as.

#8 @jorbin
9 years ago

  • Milestone set to Future Release

@netweb
8 years ago

#9 @netweb
8 years ago

In 35105.2.diff

  • Minimum NodeJS version is set as 4.2.1 which was the first LTS version of the 4.x branch released per the LTS announcement here
  • The latest NodeJS 4.x.x LTS version is installed using NVM for Travis CI (bbPress Travis CI job example)

#10 follow-up: @netweb
8 years ago

NPM Roadmap https://github.com/npm/npm/wiki/Roadmap#tactical-roadmap

npm is currently supporting two release series. npm@3 is the current stable release series, and is included with Node.js 5. npm@2 is the legacy / long-term support release series, and will be supported for the Node.js 0.10, 0.12 and 4 LTS releases.

#11 in reply to: ↑ 10 @netweb
8 years ago

Replying to netweb:

NPM Roadmap https://github.com/npm/npm/wiki/Roadmap#tactical-roadmap

npm is currently supporting two release series. npm@3 is the current stable release series, and is included with Node.js 5. npm@2 is the legacy / long-term support release series, and will be supported for the Node.js 0.10, 0.12 and 4 LTS releases.

Currently we overwrite the default Travis NPM installed version of NPM with npm install -g npm in our .travis.yml here, this installs the latest version which is the NPM v3 branch, this has been the case for quite some time, so we can either lock down v2 of NPM or continue to use v3. I think sticking to the v2 LTS branch might be the best option, less chance of it coming back to haunt us.

#12 @netweb
8 years ago

We are also installing the latest Grunt-CLI via npm install -g grunt-cli,

At the time of writing this is currently version 1.1.0, the version 1.x branch was only released yesterday (22nd March 2016), this is the first release in over 2 years.

The Grunt-CLI 1.x branch nows installs grunt-cli as part of grunt as documented here

As part of this ticket we should also determine the Grunt version we use, as such removing npm install -g grunt-cli from .travis.yml here at the same time.

#14 @netweb
8 years ago

  • Keywords needs-refresh added

Related: There is some NPM and NodeJS version checks added in #37116 hence the patch here will need a refresh once that ticked is resolved

@netweb
8 years ago

#15 @netweb
8 years ago

  • Keywords needs-refresh removed

See https://core.trac.wordpress.org/ticket/37116#comment:8 for further details on the related issue and resolution.

  • The patch contains NPM & NodeJS version checks before and after installing the new NodeJS version, makes things a little easier to debug knowing before and after NPM & NodeJS versions

This ticket was mentioned in Slack in #core by netweb. View the logs.


8 years ago

This ticket was mentioned in Slack in #core by netweb. View the logs.


8 years ago

#18 @nacin
8 years ago

In 39478:

Build/Test Tools: Specify exact node version in package.json.

Enforce it in the tests.

see #35105.

#19 @nacin
8 years ago

In 39480:

Build/Test Tools: Specify exact node version in package.json.

Enforce it in the tests.

Merges [39478] to the 4.7 branch.

see #35105, #38657.

#20 @nacin
8 years ago

To explain [39478], on the build server we have specific versions of node available -- currently 6.9.1 and 0.10.48. Pulling this out into a separate environment will be much easier to maintain long term, but in the meantime this is marginally better. I think we could probably make it so we don't need to bump patch releases in package.json, at least.

#21 @netweb
8 years ago

  • Keywords commit added
  • Milestone changed from Future Release to 4.8

Lets get the Travis CI branch jobs no longer erroring or failing.

Adding commit for committing stranger-node-things.diff for branches back to 3.7 please, and thank you.

This ticket was mentioned in Slack in #core by netweb. View the logs.


8 years ago

This ticket was mentioned in Slack in #core by netweb. View the logs.


8 years ago

#24 @ocean90
8 years ago

  • Owner changed from jorbin to ocean90
  • Status changed from assigned to accepted

#25 @ocean90
8 years ago

In 40258:

Build/Test Tools: On Travis CI install and use the node version which is specified in package.json.

Props netweb.
See #35105.

#26 @ocean90
8 years ago

In 40260:

Build/Test Tools: Update .travis.yml to include latest improvements from trunk.

  • Explicitly use PHPUnit 5.7 for the PHP 7 builds on Travis.
  • On Travis CI install and use the node version which is specified in package.json.
  • Add some more debugging to Travis and bring the format of the Xdebug fix inline with branches.

Merge of [40255] and [40257-40259] to the 4.7 branch.

Props netweb, johnbillion.
See #35105, #39822, #40086.

#27 @ocean90
8 years ago

In 40261:

Build/Test Tools: Update .travis.yml to include latest improvements from trunk.

  • Explicitly use PHPUnit 5.7 for the PHP 7 builds on Travis.
  • On Travis CI install and use the node version which is specified in package.json.
  • Add some more debugging to Travis and bring the format of the Xdebug fix inline with branches.

Merge of [40255] and [40257-40259] to the 4.6 branch.

Props netweb, johnbillion.
See #35105, #39822, #40086.

#28 follow-up: @ocean90
8 years ago

In 40262:

Build/Test Tools: Update .travis.yml to include latest improvements from trunk.

  • Explicitly use PHPUnit 5.7 for the PHP 7 builds on Travis.
  • On Travis CI install and use the node version which is specified in package.json.
  • Add some more debugging to Travis and bring the format of the Xdebug fix inline with branches.

Merge of [40255] and [40257-40259] to the 4.5 branch.

Props netweb, johnbillion.
See #35105, #39822, #40086.

#29 in reply to: ↑ 28 ; follow-up: @ocean90
8 years ago

The idea is to change only the Travis CI config since the additional tests and the package.json changes (which may break the build server) shouldn't be the cause of the failures.


Replying to ocean90:

In 40262:

Build/Test Tools: Update .travis.yml to include latest improvements from trunk.

  • Explicitly use PHPUnit 5.7 for the PHP 7 builds on Travis.
  • On Travis CI install and use the node version which is specified in package.json.
  • Add some more debugging to Travis and bring the format of the Xdebug fix inline with branches.

Merge of [40255] and [40257-40259] to the 4.5 branch.

Props netweb, johnbillion.
See #35105, #39822, #40086.

This one is still failing, see https://travis-ci.org/ocean90/develop.wordpress/jobs/209556548.

Removing the shrinkwrap file will let the build pass: https://github.com/ocean90/develop.wordpress/commit/0803f7d91fd345971b3ec38c7c92c708b2bce7c0

#30 in reply to: ↑ 29 ; follow-up: @netweb
8 years ago

Replying to ocean90:

This one is still failing, see https://travis-ci.org/ocean90/develop.wordpress/jobs/209556548.

Removing the shrinkwrap file will let the build pass: https://github.com/ocean90/develop.wordpress/commit/0803f7d91fd345971b3ec38c7c92c708b2bce7c0

For the 4.5 and earlier branches I had to drop the version of NodeJS to the 4.x branch to satisfy the dependencies version requirements in the legacy package.json files, see stranger-node-things.diff

#31 in reply to: ↑ 30 @ocean90
8 years ago

Replying to netweb:

For the 4.5 and earlier branches I had to drop the version of NodeJS to the 4.x branch to satisfy the dependencies version requirements in the legacy package.json files

Thanks, didn't notice that the patch uses different node versions. 😴

#32 @johnbillion
8 years ago

In 40266:

Build/Test tools: Switch to Node 4.7.2 when testing the 4.5 branch.

This avoids errors with older dependencies in package.json.

Props netweb

See #35105

#33 @johnbillion
8 years ago

In 40276:

Build/Test tools: Update .travis.yml to include latest improvements from trunk.

  • Explicitly use PHPUnit 5.7 for the PHP 7 builds on Travis.
  • On Travis CI install and use the node version which is specified in package.json.
  • Add some more debugging to Travis and bring the format of the Xdebug fix inline with branches.
  • Get Travis builds working on HHVM again.

Merges [40255], [40257], [40258], [40259], [40269], and [40271] to the 4.4 branch.

See #35105, #40100

#34 @johnbillion
8 years ago

In 40277:

Build/Test tools: Update .travis.yml to include latest improvements from trunk.

  • Explicitly use PHPUnit 5.7 for the PHP 7 builds on Travis.
  • On Travis CI install and use the node version which is specified in package.json.
  • Add some more debugging to Travis and bring the format of the Xdebug fix inline with branches.
  • Get Travis builds working on HHVM again.
  • In addition, brings the Slack notification settings up to date.

Merges [40255], [40257], [40258], [40259], [40269], and [40271] to the 4.3 branch.

See #35105, #40100, #30755

#35 @ocean90
8 years ago

In 40282:

Build/Test Tools: Update .travis.yml to include latest improvements from trunk.

  • Explicitly use PHPUnit 5.7 for the PHP 7 builds on Travis.
  • On Travis CI install and use the node version which is specified in package.json.
  • Add some more debugging to Travis and bring the format of the Xdebug fix inline with branches.
  • Get Travis builds working on HHVM again.
  • In addition, brings the Slack notification settings up to date and allows Travis CI to cache the node_modules directory.

Merge of [40255], [40257-40259], [40269], and [40271] to the 4.2 branch.

See #35105, #40100, #30755, #36291, #36490.

#36 follow-up: @ocean90
8 years ago

@netweb Looks like Node 4.7.2 doesn't work for the 4.2 branch: https://travis-ci.org/aaronjorbin/develop.wordpress/jobs/210162438. Neither does 4.5.0 or 6.9.1. But 0.12.18 works.

Looking at https://travis-ci.org/aaronjorbin/develop.wordpress/branches, all the failed builds seem to be unrelated to the node version so I think we can stick with the node version which Travis is currently using.

#37 in reply to: ↑ 36 @netweb
8 years ago

Replying to ocean90:

@netweb Looks like Node 4.7.2 doesn't work for the 4.2 branch: https://travis-ci.org/aaronjorbin/develop.wordpress/jobs/210162438. Neither does 4.5.0 or 6.9.1. But 0.12.18 works.

Cool, let's go with 0.12.x then

Replying to ocean90:

Looking at https://travis-ci.org/aaronjorbin/develop.wordpress/branches, all the failed builds seem to be unrelated to the node version so I think we can stick with the node version which Travis is currently using.

Up until these recent commits being merged we weren't able to determine if the builds were passing or failing as the jobs were reporting errrored by Travis before PHPUnit or the JS Grunt tasks could be run, everything would error before any testing would commence.

The NodeJS versions I chose were an attempt to mimic the timeline of core's releases to the timeline of the NodeJS releases aiming for some glimmer of hope of compatibility with the branches package.json files /shrug

I'm travelling for the remainder of today, I can take a look at updating a patch and testing tomorrow if no one beats me to it

#38 @ocean90
8 years ago

To get the right node version we have to check which grunt-sass version is installed and what its node-sass dependency is. For example 4.2 has "grunt-sass": "~0.18.0" and the "node-sass": "^2.0.1" dependency. Based on this version we can check https://github.com/sass/node-sass-binaries/tree/v2.0.1 for the latest native binding. In this case it's node 0.12.

#39 @jorbin
8 years ago

@nacin would be able to speak with complete certainty, but I'm fairly certain the build server was only updated to use 4.7.2 for 4.7+ . We should lock in the old version of node on the older installs so they match the build server. We have in the past avoided updating packages (which is why we have the shrinkwrap file) so that we didn't update CSS/JS in the old versions unintentionally.

#40 @ocean90
8 years ago

In 40285:

Build/Test Tools: Switch to Node 0.12.18 when testing the 4.2 branch.

This ensures that the node-sass binary from https://github.com/sass/node-sass-binaries/tree/v2.0.1 is used which matches our older dependencies. Avoids errors when building node-sass on Travis CI.

See #35105.

#41 @ocean90
8 years ago

In 40286:

Build/Test Tools: Update .travis.yml to include latest improvements from trunk.

  • On Travis CI install and use node version 0.10.48 to ensure correct node-sass builds.
  • Explicitly use PHPUnit 5.7 for the PHP 7 builds on Travis.
  • Add some more debugging to Travis and bring the format of the Xdebug fix inline with branches.
  • Get Travis builds working on HHVM again.
  • In addition, brings the Slack notification settings up to date and allows Travis CI to cache the node_modules directory.

Merge of [40255], [40257],[40259], [40269], and [40271] to the 4.1 branch.

See #35105, #40100, #30755, #36291, #36490.

#42 @ocean90
8 years ago

In 40288:

Build/Test Tools: Update .travis.yml to include latest improvements from trunk.

  • On Travis CI install and use node version 0.10.48 to ensure correct node-sass builds.
  • Explicitly use PHPUnit 5.7 for the PHP 7 builds on Travis.
  • Add some more debugging to Travis and bring the format of the Xdebug fix inline with branches.
  • Get Travis builds working on HHVM again.
  • In addition, brings the Slack notification settings up to date and allows Travis CI to cache the node_modules directory.

Merge of [40255], [40257],[40259], [40269], and [40271] to the 4.0 branch.

See #35105, #40100, #30755, #36291, #36490.

#43 @ocean90
8 years ago

4.1 is now the latest branch which is green on Travis CI. All the other branches won't get green until someone is going to fix all the test failures. Most of the tests seem to be invalid though, see #30284.

#44 @ocean90
7 years ago

  • Milestone changed from 4.8 to Future Release
  • Owner ocean90 deleted
  • Status changed from accepted to assigned

Related: #40463

#45 @netweb
7 years ago

Related: #40938 Add npm package-lock.json for npm v5.x

#46 @netweb
7 years ago

  • Keywords needs-refresh added; commit removed

#47 @netweb
7 years ago

  • Milestone changed from Future Release to 5.0

@netweb
7 years ago

#48 @netweb
7 years ago

  • Keywords commit added; needs-refresh removed

Refreshed patch for /trunk in 35105.4.diff

Will follow up with applicable branch patches next week

Version 0, edited 7 years ago by netweb (next)

This ticket was mentioned in Slack in #core by netweb. View the logs.


7 years ago

#50 @dd32
7 years ago

In 42461:

Build: Use Node 8.x for trunk.

Props netweb.
See #35105.

#51 @dd32
7 years ago

Node 8.9.3 is now in use for Trunk.
As expected, changing the node version has caused CSS minification to change, see https://build.trac.wordpress.org/changeset/42290

#52 @dd32
7 years ago

Travis is still using Node 6.x

I ran a test on my own Travis to see if changing it works as expected, and ran into this:

$ grunt $WP_TRAVISCI
Loading "sass.js" tasks...ERROR
>> Error: Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (57)
>> For more information on which environments are supported please see:
>> https://github.com/sass/node-sass/releases/tag/v3.13.1

https://travis-ci.org/dd32/wordpress-develop/jobs/329316882#L844

Node 8.x is supported as of node-sass v4.5.3

#53 @dd32
7 years ago

In 42463:

Build: Bump grunt-sass to v2.0.0 from v1.2.1 for Node 8.x support.

Changes: https://github.com/sindresorhus/grunt-sass/compare/v1.2.1...v2.0.0

Props netweb.
See #35105.
Fixes #43097.

#54 @dd32
7 years ago

In 42464:

Build: Bump the version of node used on Travis to match WordPress.org.

Props netweb, dd32.
See #35105

#55 @jorbin
6 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

done for 5.0 in [43684] and trunk in [43320]

Note: See TracTickets for help on using tickets.