n8n-nodes-teamorouter/scripts/copy-assets.mjs

19 lines
712 B
JavaScript

// tsc does not copy static assets: icons next to compiled nodes are required by `icon: 'file:...'`.
import { cp, mkdir } from 'node:fs/promises';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
const assets = [
['nodes/LmChatTeamRouter/teamorouter.svg', 'dist/nodes/LmChatTeamRouter/teamorouter.svg'],
['nodes/Teamorouter/teamorouter.svg', 'dist/nodes/Teamorouter/teamorouter.svg'],
];
for (const [from, to] of assets) {
const target = join(root, to);
await mkdir(dirname(target), { recursive: true });
await cp(join(root, from), target);
}
console.log(`Copied ${assets.length} asset(s) to dist/`);