1 | 'use strict'
|
2 | const pkg = require('./package.json')
|
3 | const MIN_VER = pkg.engines.node.match(/(\d+(\.\d+)?)/)[1]
|
4 | const fmin = parseFloat(MIN_VER)
|
5 | const nver = process.version
|
6 |
|
7 | if (parseFloat(nver.slice(1)) < fmin) {
|
8 | console.error(`
|
9 | +-------------------------------------------------------+
|
10 | | The cbor package REQUIRES Node.js v${MIN_VER} or higher. ${' '.repeat(7 - MIN_VER.length)}|
|
11 | | You are currently running Node.js ${nver} ${' '.repeat(19 - nver.length)}|
|
12 | | Please upgrade node, or pin cbor to version 5.2.x: |
|
13 | | \`npm install --save cbor@5.2\` |
|
14 | +-------------------------------------------------------+
|
15 | `)
|
16 | process.exit(1)
|
17 | }
|