« get me outta code hell

static-page.js « files « data « src - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/files/static-page.js
blob: c7622bc801edf105a6d653c09b8efd41af85c4bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import * as path from 'node:path';

import {traverse} from '#node-utils';
import {sortAlphabetically} from '#sort';

export default ({
  documentModes: {onePerFile},
  thingConstructors: {StaticPage},
}) => ({
  title: `Process static page files`,

  files: dataPath =>
    traverse(path.join(dataPath, 'static-page'), {
      filterFile: name => path.extname(name) === '.yaml',
      prefixPath: 'static-page',
    }),

  documentMode: onePerFile,
  documentThing: StaticPage,

  sort({staticPageData}) {
    sortAlphabetically(staticPageData);
  },
});