n8n/packages/cli/bin/n8n
Jan Oberhauser c8e85b5d6d 👕 Fix lint issue
2020-10-25 11:26:27 +01:00

35 lines
1.1 KiB
JavaScript
Executable file

#!/usr/bin/env node
var path = require('path'); // tslint:disable-line:no-var-keyword
// Make sure that it also find the config folder when it
// did get started from another folder that the root one.
process.env.NODE_CONFIG_DIR = process.env.NODE_CONFIG_DIR || path.join(__dirname, 'config');
// Check if version should be displayed
var versionFlags = [ // tslint:disable-line:no-var-keyword
'-v',
'-V',
'--version',
];
if (versionFlags.includes(process.argv.slice(-1)[0])) {
console.log(require('../package').version);
process.exit(0);
}
if (process.argv.length === 2) {
// When no command is given choose by default start
process.argv.push('start');
}
var nodeVersion = process.versions.node.split('.');
if (parseInt(nodeVersion[0], 10) < 12 || parseInt(nodeVersion[0], 10) === 12 && parseInt(nodeVersion[1], 10) < 9) {
console.log(`\nYour Node.js version (${process.versions.node}) is too old to run n8n.\nPlease update to version 12.9 or later!\n`);
process.exit(0);
}
require('@oclif/command').run()
.then(require('@oclif/command/flush'))
.catch(require('@oclif/errors/handle'));