-
Notifications
You must be signed in to change notification settings - Fork 4
/
constants.js
75 lines (64 loc) · 1.57 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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`
/**
* Path to the fixtures folder cdxj sub-directory.
* @constant
*/
export const CDXJ_DIR_FIXTURES_PATH = `${FIXTURES_PATH}cdxj${sep}`
/**
* Path to the fixtures folder log directory sub-directory.
* @constant
*/
export const LOG_DIR_FIXTURES_PATH = `${FIXTURES_PATH}logs${sep}`
/**
* Path to the log.txt fixture
* @constant
*/
export const LOG_FILE_FIXTURE_PATH = `${LOG_DIR_FIXTURES_PATH}sample.log`
/**
* 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`))
)