Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Update Node.js version check, drop Node v13 support #2219

Merged
merged 1 commit into from
Jun 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 26 additions & 23 deletions packages/expo-cli/bin/expo.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,39 @@
#!/usr/bin/env node

var match = process.version.match(/v(\d+)\.(\d+)/);
function red(text) {
return '\u001b[31m' + text + '\u001b[39m';
}
function yellow(text) {
return '\u001b[33m' + text + '\u001b[39m';
}

var match = /v(\d+)\.(\d+)/.exec(process.version);
var major = parseInt(match[1], 10);
var minor = parseInt(match[2], 10);

// If older than 10.13, or if 11.x
if (major < 10 || (major === 10 && minor < 13) || major === 11) {
console.error(
'\x1B[31mERROR: Node.js ' +
process.version +
' is no longer supported.\x1B[39m\n' +
'\x1B[31m\x1B[39m\n' +
'\x1B[31mexpo-cli supports following Node.js versions:\x1B[39m\n' +
'\x1B[31m* >=10.13.0 <11.0.0 (Active LTS)\x1B[39m\n' +
'\x1B[31m* >=12.0.0 <13.0.0 (Active LTS)\x1B[39m\n' +
'\x1B[31m* >=13.0.0 <14.0.0 (Current Release)\x1B[39m'
);
process.exit(1);
}
var supportedVersions =
'expo-cli supports following Node.js versions:\n' +
'* >=10.13.0 <11.0.0 (Maintenance LTS)\n' +
'* >=12.13.0 <13.0.0 (Active LTS)\n' +
'* >=14.0.0 <15.0.0 (Current Release)\n';

// If newer than the current release
if (major > 14) {
console.warn(
yellow(
'WARNING: expo-cli has not yet been tested against Node.js ' +
process.version +
'.\n' +
'If you encounter any issues, please report them to https://github.com/expo/expo-cli/issues\n' +
'\n' +
supportedVersions
)
);
} else if (!((major === 10 && minor >= 13) || (major === 12 && minor >= 13) || major === 14)) {
console.error(
'\x1B[33mWARNING: expo-cli has not yet been tested against Node.js ' +
process.version +
'. If you encounter any issues, please report them to https://github.com/expo/expo-cli/issues\x1B[39m\n' +
'\x1B[33m\x1B[39m\n' +
'\x1B[33mexpo-cli supports following Node.js versions:\x1B[39m\n' +
'\x1B[33m* >=10.13.0 <11.0.0 (Active LTS)\x1B[39m\n' +
'\x1B[33m* >=12.0.0 <13.0.0 (Active LTS)\x1B[39m\n' +
'\x1B[33m* >=13.0.0 <14.0.0 (Current Release)\x1B[39m'
red('ERROR: Node.js ' + process.version + ' is no longer supported.\n\n' + supportedVersions)
);
process.exit(1);
}

require('../build/exp.js').run('expo');