Skip to content

Commit

Permalink
Require NodeJS v8+ and NPM v5+
Browse files Browse the repository at this point in the history
This updates our build requirements to NodeJS v8+ and NPM v5+, both
released in 2017.

This also clarifies our support for Python 3 (not well-documented
before) to the version we are using on Debian, v3.5.

Requiring NodeJS v8+ means our node tools (like our extern generator)
no longer need shims for compatibility.  This allows us to drop the
"es6-shim" and "array-includes" modules.

In NPM v5+, the "prepublish" script has been deprecated, and replaced
with "prepublishOnly" (which is what we want) and "prepare" (the old
behavior we had to work around).  This allows us to drop the
"in-publish" module.

Change-Id: Ied189c76a58fe981c12d41155b834f2d6ea73bbd
  • Loading branch information
joeyparrish committed May 15, 2019
1 parent d16e1a4 commit 42b40bd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 25 deletions.
8 changes: 0 additions & 8 deletions build/generateExterns.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@ const fs = require('fs');
// The annotations we will consider "exporting" a symbol.
const EXPORT_REGEX = /@(?:export|exportInterface|expose)\b/;

// Install ES6/ES7 polyfills for old versions of nodejs.
if (!global.Set) {
require('es6-shim');
}
if (!Array.prototype.includes) {
require('array-includes').shim();
}


/**
* Topological sort of general objects using a DFS approach.
Expand Down
8 changes: 4 additions & 4 deletions build/install-linux-prereqs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ sudo apt -y update
sudo apt -y install git python2.7 default-jre-headless apache2

# NodeJS in Ubuntu and Debian is often out of date, so we may need to grab a
# newer version. We require v6+.
# newer version. We require v8+.

if node --version 2>/dev/null | grep -q 'v\([6-9]\|1[0-9]\)'; then
if node --version 2>/dev/null | grep -q 'v\([89]\|1[0-9]\)'; then
echo "*****" 1>&2
echo "NodeJS v6+ detected. No update needed." 1>&2
echo "NodeJS v8+ detected. No update needed." 1>&2
echo "*****" 1>&2
else
if node --version &>/dev/null; then
Expand Down Expand Up @@ -99,7 +99,7 @@ else
fi
else
echo "*****" 1>&2
echo "You will need to upgrade NodeJS yourself to v6+." 1>&2
echo "You will need to upgrade NodeJS yourself to v8+." 1>&2
echo "*****" 1>&2
exit 1
fi
Expand Down
11 changes: 4 additions & 7 deletions build/shakaBuildHelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def update_node_modules():
# Check the version of npm.
version = execute_get_output([cmd, '-v']).decode('utf8')

if _parse_version(version) < _parse_version('1.3.12'):
if _parse_version(version) < _parse_version('5.0.0'):
logging.error('npm version is too old, please upgrade. e.g.:')
logging.error(' npm install -g npm')
return False
Expand All @@ -295,12 +295,9 @@ def update_node_modules():
# Actually change directories instead of using npm --prefix.
# See npm/npm#17027 and google/shaka-player#776 for more details.
with InDir(base):
if _parse_version(version) >= _parse_version('5.0.0'):
# npm update seems to be the wrong thing in npm v5, so use install.
# See google/shaka-player#854 for more details.
execute_get_output([cmd, 'install'])
else:
execute_get_output([cmd, 'update'])
# npm update seems to be the wrong thing in npm v5, so use install.
# See google/shaka-player#854 for more details.
execute_get_output([cmd, 'install'])

# Update the timestamp of the file that tracks when we last updated.
open(_node_modules_last_update_path(), 'w').close()
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/welcome.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ externs have been generated.
You can build Shaka on Linux, Windows, or Mac.
To get the sources and compile the library, you will need:
* {@link https://git-scm.com/downloads Git v1.9+}
* {@link https://www.python.org/downloads/ Python v2.7}
* {@link https://www.python.org/downloads/ Python v2.7 or v3.5+}
* {@link https://java.com/en/download/ Java Runtime Environment v8+}
* {@link https://nodejs.org/en/download/ NodeJS v6+}
* {@link https://nodejs.org/en/download/ NodeJS v8+}
* A local web server, such as {@link https://httpd.apache.org/ Apache}
* _NOTE: A local web server is required because browsers place restrictions
on applications from file:/// URLs._
Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,17 @@
}
],
"devDependencies": {
"array-includes": "^3.0.3",
"awesomplete": "^1.1.4",
"babel-core": "^6.26.3",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"cajon": "^0.4.4",
"dialog-polyfill": "^0.5.0",
"es6-promise-polyfill": "^1.2.0",
"es6-shim": "^0.35.5",
"eslint": "^5.16.0",
"eslint-config-google": "^0.13.0",
"esprima": "^4.0.1",
"htmlhint": "^0.11.0",
"in-publish": "^2.0.0",
"jasmine-ajax": "^4.0.0",
"jasmine-core": "^3.4.0",
"jsdoc": "github:joeyparrish/jsdoc#45c271fa",
Expand Down Expand Up @@ -62,6 +59,6 @@
},
"license": "Apache-2.0",
"scripts": {
"prepublish": "in-publish && python build/checkversion.py && python build/all.py --force || not-in-publish"
"prepublishOnly": "python build/checkversion.py && python build/all.py --force"
}
}

0 comments on commit 42b40bd

Please sign in to comment.