[READ-ONLY] Mirror of https://github.com/andrioid/n8n-nodes-atproto. atproto node for n8n
2.2 kB
66 lines
1/**
2 * Vite build config for the n8n community node package.
3 *
4 * Bundles all runtime dependencies (@atproto/*) into the output so the
5 * published package has zero `dependencies` — required by n8n's
6 * verification guidelines. Only `n8n-workflow` is externalized (provided
7 * by n8n at runtime).
8 *
9 * Uses Vite in library mode (already installed via vitest).
10 */
11
12import { defineConfig } from 'vite';
13import { resolve } from 'node:path';
14import { cpSync, mkdirSync } from 'node:fs';
15
16export default defineConfig({
17 build: {
18 lib: {
19 entry: {
20 'nodes/Atproto/Atproto.node': resolve(__dirname, 'nodes/Atproto/Atproto.node.ts'),
21 'nodes/Atproto/AtprotoTrigger.node': resolve(__dirname, 'nodes/Atproto/AtprotoTrigger.node.ts'),
22 'nodes/Bluesky/AtprotoBluesky.node': resolve(__dirname, 'nodes/Bluesky/AtprotoBluesky.node.ts'),
23 'credentials/AtprotoApi.credentials': resolve(
24 __dirname,
25 'credentials/AtprotoApi.credentials.ts',
26 ),
27 },
28 formats: ['cjs'],
29 fileName: (_format, entryName) => `${entryName}.js`,
30 },
31 rollupOptions: {
32 external: [
33 'n8n-workflow',
34 // Node.js builtins — provided by the runtime
35 /^node:/,
36 ],
37 output: {
38 // Keep shared chunks next to entry points with stable names
39 chunkFileNames: '_chunks/[name].js',
40 exports: 'named',
41 },
42 },
43 outDir: 'dist',
44 sourcemap: true,
45 minify: false,
46 // Don't clear dist before build — we copy static files first
47 emptyOutDir: true,
48 },
49 plugins: [
50 {
51 name: 'copy-static-assets',
52 writeBundle() {
53 // Copy icons and codex JSON files to dist/
54 const staticPatterns = [
55 { src: 'nodes/Atproto/atproto.svg', dest: 'dist/nodes/Atproto/atproto.svg' },
56 { src: 'nodes/Atproto/zstd_dictionary', dest: 'dist/nodes/Atproto/zstd_dictionary' },
57 { src: 'nodes/Bluesky/bluesky.svg', dest: 'dist/nodes/Bluesky/bluesky.svg' },
58 ];
59 for (const { src, dest } of staticPatterns) {
60 mkdirSync(resolve(__dirname, dest, '..'), { recursive: true });
61 cpSync(resolve(__dirname, src), resolve(__dirname, dest));
62 }
63 },
64 },
65 ],
66});