-
Notifications
You must be signed in to change notification settings - Fork 14
/
code-pushup.config.ts
73 lines (67 loc) · 1.66 KB
/
code-pushup.config.ts
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
import 'dotenv/config';
import { z } from 'zod';
import {
coverageCoreConfigNx,
eslintCoreConfigNx,
jsPackagesCoreConfig,
lighthouseCoreConfig,
} from './code-pushup.preset';
import {
fileSizePlugin,
fileSizeRecommendedRefs,
packageJsonDocumentationGroupRef,
packageJsonPerformanceGroupRef,
packageJsonPlugin,
} from './dist/examples/plugins';
import { mergeConfigs } from './dist/packages/utils';
import type { CoreConfig } from './packages/models/src';
// load upload configuration from environment
const envSchema = z.object({
CP_SERVER: z.string().url(),
CP_API_KEY: z.string().min(1),
CP_ORGANIZATION: z.string().min(1),
CP_PROJECT: z.string().min(1),
});
const { data: env } = await envSchema.safeParseAsync(process.env);
const config: CoreConfig = {
...(env && {
upload: {
server: env.CP_SERVER,
apiKey: env.CP_API_KEY,
organization: env.CP_ORGANIZATION,
project: env.CP_PROJECT,
},
}),
plugins: [
fileSizePlugin({
directory: './dist/packages',
pattern: /\.js$/,
budget: 174_080, // 170 kB
}),
packageJsonPlugin({
directory: './dist/packages',
license: 'MIT',
type: 'module',
}),
],
categories: [
{
slug: 'custom-checks',
title: 'Custom checks',
refs: [
...fileSizeRecommendedRefs,
packageJsonPerformanceGroupRef,
packageJsonDocumentationGroupRef,
],
},
],
};
export default mergeConfigs(
config,
await coverageCoreConfigNx(),
await jsPackagesCoreConfig(),
await lighthouseCoreConfig(
'https://github.com/code-pushup/cli?tab=readme-ov-file#code-pushup-cli/',
),
await eslintCoreConfigNx(),
);