|
| 1 | +import nodes from './nodes.js' |
| 2 | +import tags from './tags.js' |
| 3 | +import { siteConfig } from '../lib/config' |
| 4 | + |
| 5 | +// Extract version from workspace Cargo.toml |
| 6 | +// This should be kept in sync with the workspace version |
| 7 | +const ACTON_VERSION = '0.7.0' |
| 8 | + |
| 9 | +// Helper function to build dependency string |
| 10 | +function buildDep(features) { |
| 11 | + return `acton-reactive = { version = "${ACTON_VERSION}", features = [${features.map(f => `"${f}"`).join(', ')}] }` |
| 12 | +} |
| 13 | + |
| 14 | +const config = { |
| 15 | + nodes, |
| 16 | + tags, |
| 17 | + functions: { |
| 18 | + // Markdoc function to build cargo dependency with current version |
| 19 | + dep: { |
| 20 | + transform(parameters) { |
| 21 | + const features = parameters[0] || [] |
| 22 | + if (typeof features === 'string') { |
| 23 | + return `acton-reactive = { version = "${ACTON_VERSION}", features = ["${features}"] }` |
| 24 | + } |
| 25 | + return buildDep(features) |
| 26 | + } |
| 27 | + }, |
| 28 | + // Function to build GitHub URLs |
| 29 | + githubUrl: { |
| 30 | + transform(parameters) { |
| 31 | + const path = parameters[0] || '' |
| 32 | + return siteConfig.repositoryUrl + path |
| 33 | + } |
| 34 | + } |
| 35 | + }, |
| 36 | + variables: { |
| 37 | + version: { |
| 38 | + acton: ACTON_VERSION, |
| 39 | + }, |
| 40 | + github: { |
| 41 | + repositoryUrl: siteConfig.repositoryUrl, |
| 42 | + repositoryName: siteConfig.repositoryName, |
| 43 | + }, |
| 44 | + dep: { |
| 45 | + base: `acton-reactive = "${ACTON_VERSION}"`, |
| 46 | + ipc: `acton-reactive = { version = "${ACTON_VERSION}", features = ["ipc"] }`, |
| 47 | + ipcMessagepack: `acton-reactive = { version = "${ACTON_VERSION}", features = ["ipc-messagepack"] }`, |
| 48 | + }, |
| 49 | + }, |
| 50 | +} |
| 51 | + |
| 52 | +export default config |
0 commit comments