n8n/packages/cli/bin/n8n
कारतोफ्फेलस्क्रिप्ट™ 52f740b9e8
refactor(core): Use an IoC container to manage singleton classes [Part-1] (no-changelog) (#5509)
* add typedi

* convert ActiveWorkflowRunner into an injectable service

* convert ExternalHooks into an injectable service

* convert InternalHooks into an injectable service

* convert LoadNodesAndCredentials into an injectable service

* convert NodeTypes and CredentialTypes into an injectable service

* convert ActiveExecutions into an injectable service

* convert WaitTracker into an injectable service

* convert Push into an injectable service

* convert ActiveWebhooks and  TestWebhooks into an injectable services

* handle circular references, and log errors when a circular dependency is found
2023-02-21 19:21:56 +01:00

43 lines
1.2 KiB
JavaScript
Executable file

#!/usr/bin/env node
const path = require('path');
// 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
const versionFlags = ['-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');
}
const nodeVersion = process.versions.node;
const nodeVersionMajor = require('semver').major(nodeVersion);
if (![14, 16, 18].includes(nodeVersionMajor)) {
console.log(`
Your Node.js version (${nodeVersion}) is currently not supported by n8n.
Please use Node.js v14, v16 (recommended), or v18 instead!
`);
process.exit(1);
}
// Prevent oclif from loading ts-node and typescript
process.env.OCLIF_TS_NODE = '0';
require('express-async-errors');
require('source-map-support').install();
require('reflect-metadata');
require('@oclif/command')
.run()
.then(require('@oclif/command/flush'))
.catch(require('@oclif/errors/handle'));