Skip to content

Commit

Permalink
Print error and exit early with Node 6 (#1349)
Browse files Browse the repository at this point in the history
* increase engines to node >= 8; engineStrict is deprecated

* add error if node version does not satisfy engine version

* drop testing on 6, test hosting on 8

* update message for error

* add note to changelog about breaking CLI

* put breaking change at the top of the changelog
  • Loading branch information
bkendall committed May 30, 2019
1 parent 08f053e commit bbcf0dd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: node_js
node_js:
- "6"
- "8"
- "10"
after_script:
Expand All @@ -9,7 +8,7 @@ jobs:
include:
- stage: hosting functional test
if: repo == head_repo OR type == push
node_js: "6"
node_js: "8"
before_script: ./scripts/decrypt-app-credentials.sh
script: ./scripts/test-hosting.sh
after_script: skip
Expand Down
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* **BREAKING** The CLI no longer suppport being run in Node 6 environments.
* Fixed bug in Firestore emulator where some FieldTransforms were sending back incorrect results.
* Fixed bug where read-only transactions would cause errors in the Firestore emulator.
* Fixed bug where collection group query listeners would cause errors in the Firestore emulator.
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@
],
"preferGlobal": true,
"engines": {
"node": ">= 6.0.0"
"node": ">= 8.0.0"
},
"engineStrict": true,
"author": "Firebase (https://firebase.google.com/)",
"license": "MIT",
"bugs": {
Expand Down
15 changes: 15 additions & 0 deletions src/bin/firebase.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
#!/usr/bin/env node
"use strict";

// Make check for Node 6, which is no longer supported by the CLI.
var semver = require("semver");
var pkg = require("../../package.json");
var nodeVersion = process.version;
if (!semver.satisfies(nodeVersion, pkg.engines.node)) {
console.error(
"Firebase CLI v" +
pkg.version +
" is incompatible with Node.js " +
nodeVersion +
" Please upgrade Node.js to version " +
pkg.engines.node
);
process.exit(1);
}

var updateNotifier = require("update-notifier")({ pkg: pkg });
updateNotifier.notify({ defer: true, isGlobal: true });

Expand Down

0 comments on commit bbcf0dd

Please sign in to comment.