[READ-ONLY] Mirror of https://github.com/andrioid/n8n-nodes-atproto. atproto node for n8n
2.1 kB
64 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, 'src/nodes/Atproto/Atproto.node.ts'),
21 'nodes/Atproto/AtprotoJetstream.trigger': resolve(__dirname, 'src/nodes/Atproto/AtprotoJetstream.trigger.ts'),
22 'credentials/AtprotoApi.credentials': resolve(
23 __dirname,
24 'src/credentials/AtprotoApi.credentials.ts',
25 ),
26 },
27 formats: ['cjs'],
28 fileName: (_format, entryName) => `${entryName}.js`,
29 },
30 rollupOptions: {
31 external: [
32 'n8n-workflow',
33 // Node.js builtins — provided by the runtime
34 /^node:/,
35 ],
36 output: {
37 // Keep shared chunks next to entry points with stable names
38 chunkFileNames: '_chunks/[name].js',
39 exports: 'named',
40 },
41 },
42 outDir: 'dist',
43 sourcemap: true,
44 minify: false,
45 // Don't clear dist before build — we copy static files first
46 emptyOutDir: true,
47 },
48 plugins: [
49 {
50 name: 'copy-static-assets',
51 writeBundle() {
52 // Copy icons and codex JSON files to dist/
53 const staticPatterns = [
54 { src: 'src/nodes/Atproto/atproto.svg', dest: 'dist/nodes/Atproto/atproto.svg' },
55 { src: 'src/nodes/Atproto/zstd_dictionary', dest: 'dist/nodes/Atproto/zstd_dictionary' },
56 ];
57 for (const { src, dest } of staticPatterns) {
58 mkdirSync(resolve(__dirname, dest, '..'), { recursive: true });
59 cpSync(resolve(__dirname, src), resolve(__dirname, dest));
60 }
61 },
62 },
63 ],
64});