-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathholypack.config.mjs
More file actions
135 lines (118 loc) · 3.42 KB
/
holypack.config.mjs
File metadata and controls
135 lines (118 loc) · 3.42 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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// When building holypack, it uses itself during the process.
// As a result, some extensions might not be available during the bootstrap phase.
// For this reason, avoid importing extensions directly.
// Use `suppressErrorSync` to safely fall back to `undefined`.
//
// Holypack supports both synchronous and asynchronous execution modes.
// When running, if at least one integration using this config file does not
// support asynchronous execution, ensure that only synchronous operations are
// performed here. Thus both synchronous and asynchronous contexts can safely
// make use of this config file.
import { createRequire } from "node:module";
import { fileURLToPath } from "node:url";
import { requireDefaultExport } from "@holypack/core/lib/module/requireDefaultExport";
import { suppressErrorSync } from "@holypack/core/lib/runtime/suppressErrorSync";
import { defineConfig } from "holypack/config";
const __filename = fileURLToPath(import.meta.url);
const require = createRequire(__filename);
/**
* @import {
* type ESLintIntegration,
* type ESLintIntegrationOptions,
* } from "@holypack/integration-eslint";
* @import {
* type MarkdownFlavor,
* } from "@holypack/integration-eslint/plugins/eslint/markdown/flavor/MarkdownFlavor";
*/
const CI = process.env.CI === "true" || process.env.CI === "1";
const DEBUG = process.env.DEBUG === "true" || process.env.DEBUG === "1";
/**
* @template T
* @param {T} value
* @returns {T | undefined}
*/
const disableOnCI = (value) =>
{
return CI ? undefined : value;
};
/**
* @template T
* @param {T} value
* @returns {T | undefined}
*/
const enableOnlyForDebugging = (value) =>
{
return DEBUG ? value : undefined;
};
export default defineConfig(
(context) =>
{
return {
extensions: [
disableOnCI(
enableOnlyForDebugging(
suppressErrorSync(
requireDefaultExport,
require,
"@holypack/tracing/plugins/hook-tracer",
),
),
),
suppressErrorSync(
requireDefaultExport,
require,
"@holypack/integration-babel",
),
suppressErrorSync(
requireDefaultExport,
require,
"@holypack/integration-typescript",
),
suppressErrorSync(
requireDefaultExport,
require,
"@holypack/integration-jest",
),
suppressErrorSync(
() =>
{
/**
* @type {ESLintIntegration}
*/
const eslint = requireDefaultExport(
require,
"@holypack/integration-eslint",
);
/**
* @type {MarkdownFlavor}
*/
const MARKDOWN_FLAVOR_GFM = requireDefaultExport(
require,
"@holypack/integration-eslint/plugins/eslint/markdown/flavor/MARKDOWN_FLAVOR_GFM",
);
/**
* @satisfies {ESLintIntegrationOptions}
*/
const options = {
plugins: {
ignores: {
extra: [
"**/.build/",
"e2e/",
],
},
markdown: {
flavor: MARKDOWN_FLAVOR_GFM,
},
},
};
return [
eslint,
options,
];
},
),
],
};
},
);