mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(core): Lazy-load nodes and credentials to reduce baseline memory usage (#4577)
This commit is contained in:
committed by
GitHub
parent
f63cd3b89e
commit
b6c57e19fc
19
packages/core/bin/common.js
Normal file
19
packages/core/bin/common.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const path = require('path');
|
||||
const { mkdir, writeFile } = require('fs/promises');
|
||||
|
||||
const packageDir = process.cwd();
|
||||
const distDir = path.join(packageDir, 'dist');
|
||||
|
||||
const writeJSON = async (file, data) => {
|
||||
const filePath = path.resolve(distDir, file);
|
||||
await mkdir(path.dirname(filePath), { recursive: true });
|
||||
const payload = Array.isArray(data)
|
||||
? `[\n${data.map((entry) => JSON.stringify(entry)).join(',\n')}\n]`
|
||||
: JSON.stringify(data, null, 2);
|
||||
await writeFile(filePath, payload, { encoding: 'utf-8' });
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
packageDir,
|
||||
writeJSON,
|
||||
};
|
||||
Reference in New Issue
Block a user