forked from harvard-lil/js-wacz
/
constants.js
57 lines (49 loc) · 1.17 KB
/
constants.js
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import fs from 'fs/promises'
import { dirname, sep } from 'path'
import { fileURLToPath } from 'url'
import chalk from 'chalk'
/**
* Path to the library.
* @constant
*/
export const BASE_PATH = dirname(fileURLToPath(import.meta.url))
/**
* Path to the fixtures folder.
* @constant
*/
export const FIXTURES_PATH = `${BASE_PATH}${sep}fixtures${sep}`
/**
* Path to the fixtures folder pages sub-directory.
* @constant
*/
export const PAGES_DIR_FIXTURES_PATH = `${FIXTURES_PATH}pages${sep}`
/**
* Path to the pages.jsonl fixture
* @constant
*/
export const PAGES_FIXTURE_PATH = `${PAGES_DIR_FIXTURES_PATH}pages.jsonl`
/**
* Path to the extraPages.jsonl fixture
* @constant
*/
export const EXTRA_PAGES_FIXTURE_PATH = `${PAGES_DIR_FIXTURES_PATH}extraPages.jsonl`
/**
* Colors scheme for log level.
* @constant
*/
export const LOGGING_COLORS = {
DEFAULT: chalk.gray,
TRACE: chalk.magenta,
DEBUG: chalk.cyan,
INFO: chalk.blue,
WARN: chalk.yellow,
ERROR: chalk.red
}
/**
* This project's package.json as a frozen object.
* @constant
* @type {Object}
*/
export const PACKAGE_INFO = Object.freeze(
JSON.parse(await fs.readFile(`${BASE_PATH}${sep}package.json`))
)