Skip to content

Commit 3d87090

Browse files
committed
use require
1 parent 9ca1f38 commit 3d87090

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

utils/generate-metadata.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
import fs from 'fs'
2-
import path from 'path'
3-
import { fileURLToPath } from 'url'
4-
import matter from 'gray-matter'
5-
import glob from 'glob'
6-
7-
const __filename = fileURLToPath(import.meta.url)
8-
const __dirname = path.dirname(__filename)
1+
const fs = require('fs')
2+
const path = require('path')
3+
const matter = require('gray-matter')
4+
const glob = require('glob')
95

106
// Get list of all article and commentary folders
117
const articles = fs
@@ -74,9 +70,15 @@ const supplementMetadata = glob
7470

7571
// Generate the metadata file content
7672
const fileContent = `// This file is auto-generated. Do not edit it manually.
77-
export const articleMetadata = ${JSON.stringify(articleMetadata, null, 2)}
78-
export const commentaryMetadata = ${JSON.stringify(commentaryMetadata, null, 2)}
79-
export const supplementMetadata = ${JSON.stringify(supplementMetadata, null, 2)}
73+
const articleMetadata = ${JSON.stringify(articleMetadata)}
74+
const commentaryMetadata = ${JSON.stringify(commentaryMetadata)}
75+
const supplementMetadata = ${JSON.stringify(supplementMetadata)}
76+
77+
module.exports = {
78+
articleMetadata,
79+
commentaryMetadata,
80+
supplementMetadata,
81+
}
8082
`
8183

8284
// Write the metadata file

0 commit comments

Comments
 (0)