Skip to content

Instantly share code, notes, and snippets.

@MariusRumpf
Last active July 31, 2023 14:46
Show Gist options
  • Save MariusRumpf/3a231c011714ac2e82cc871482593112 to your computer and use it in GitHub Desktop.
Save MariusRumpf/3a231c011714ac2e82cc871482593112 to your computer and use it in GitHub Desktop.
n8n community module loading
import glob from 'fast-glob';
const main = async () => {
const nodeModulesDir = 'node_modules';
const installedPackagePaths = await glob(['n8n-nodes-*', '@*/n8n-nodes-*'], {
cwd: nodeModulesDir,
onlyDirectories: true,
deep: 1, // try with deep: 2 to fix
});
console.log(installedPackagePaths);
};
await main();
{
"name": "glob-test",
"version": "1.0.0",
"description": "",
"main": "index.mjs",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@telepilotco/n8n-nodes-kv-storage": "^0.0.1",
"fast-glob": "^3.2.5",
"n8n-nodes-base": "^0.220.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment