-
Notifications
You must be signed in to change notification settings - Fork 8
/
constants.js
87 lines (72 loc) · 1.96 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
76
77
78
79
80
81
82
83
84
85
86
87
import fs from 'fs/promises'
import { dirname, join, sep } from 'path'
import { fileURLToPath } from 'url'
import chalk from 'chalk'
/**
* Description of this software.
* Used in provenance data to indicate which software made the capture.
*/
export const SOFTWARE = 'Scoop @ Harvard Library Innovation Lab'
/**
* The version of WARC this library exports
*/
export const WARC_VERSION = '1.1'
/**
* The version of WACZ this library exports
*/
export const WACZ_VERSION = '1.1.1'
/**
* Label to be used in WARC to keep trace of ScoopExchange.id.
*/
export const EXCHANGE_ID_HEADER_LABEL = 'Scoop-Exchange-ID'
/**
* Label to be used in WARC to keep trace of ScoopGeneratedExchange.description.
*/
export const EXCHANGE_DESCRIPTION_HEADER_LABEL = 'Scoop-Exchange-Description'
/**
* Path to the Scoop library.
*/
export const BASE_PATH = dirname(fileURLToPath(import.meta.url))
/**
* Location of the directory in which assets may be rendered (ex: the provenance summary)
*/
export const ASSETS_PATH = join(BASE_PATH, 'assets', sep)
/**
* Path to the executables folder.
*/
export const EXECUTABLES_PATH = join(BASE_PATH, 'executables', sep)
/**
* Path to the templates folder.
*/
export const TEMPLATES_PATH = join(ASSETS_PATH, 'templates', sep)
/**
* Path to the temporary folder.
*/
export const TMP_PATH = join(BASE_PATH, 'tmp', sep)
/**
* Location of the testing fixtures folder.
*/
export const FIXTURES_PATH = join(ASSETS_PATH, 'fixtures', sep)
/**
* Colors used by the logging function
*/
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(join(BASE_PATH, 'package.json')))
)
/**
* The current version of Scoop. Also used in provenance data.
*/
export const VERSION = PACKAGE_INFO.version