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