-
Notifications
You must be signed in to change notification settings - Fork 307
Expand file tree
/
Copy pathconfig.js
More file actions
30 lines (28 loc) · 1.3 KB
/
config.js
File metadata and controls
30 lines (28 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const subYears = require('date-fns/subYears');
const errorJsonFile = path.join(process.cwd(), '/data/errors.json');
const stackbitJsonFile = path.join(process.cwd(), '/data/stackbit.json');
const stackbitJsonData = fs.existsSync(stackbitJsonFile) ? JSON.parse(fs.readFileSync(stackbitJsonFile)) : {};
const themesMarkdownFolder = path.join(process.cwd(), '/content/theme')
const themesMarkdownFiles = fs.readdirSync(themesMarkdownFolder).map(relFilename => path.resolve(themesMarkdownFolder, relFilename))
const themesJsonFile = path.join(process.cwd(), '/data/themes.json');
const themesJsonData = fs.existsSync(themesJsonFile) ? JSON.parse(fs.readFileSync(themesJsonFile)) : {};
const hiresImagesFolder = path.join(process.cwd(), '/static/capture');
const thumbnailImagesFolder = path.join(process.cwd(), '/static/images/theme/thumbnail')
const thumbnailImagesFolder2x = path.join(process.cwd(), '/static/images/theme/thumbnail/2x')
const staleBeforeDate = subYears(new Date(), 1);
module.exports = {
errorJsonFile,
themesJsonFile,
themesMarkdownFolder,
themesMarkdownFiles,
themesJsonData,
stackbitJsonFile,
stackbitJsonData,
hiresImagesFolder,
thumbnailImagesFolder,
thumbnailImagesFolder2x,
staleBeforeDate
}