-
Notifications
You must be signed in to change notification settings - Fork 7
/
.bundlewatch.config.js
54 lines (48 loc) · 1.13 KB
/
.bundlewatch.config.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
const fs = require("fs");
const root = "./.next/static/chunks/";
const files = fs.readdirSync(root);
const checkList = [
// page _app
{
path: "./.next/static/chunks/pages/_app*.js",
maxSize: "180KB",
},
// other pages
{
path: "./.next/static/chunks/pages/**/!(_app)*.js",
maxSize: "50KB",
},
// CSS
{
path: "./.next/static/css/*.css",
maxSize: "15KB",
},
];
files.forEach((file) => {
if (file.replace(/\..{16}\.js$/, "").match(/^(?=.*\d).{8}$/)) {
// node modules
checkList.push({
path: root + file,
maxSize: "120KB",
});
} else if (file.match(/\.js$/)) {
// other chunks
checkList.push({
path: root + file,
maxSize: "50KB",
});
}
});
const bundleWatchConfig = {
files: checkList,
ci: {
trackBranches: ["main"],
githubAccessToken: process.env.BUNDLEWATCH_GITHUB_TOKEN,
repoOwner: process.env.CI_REPO_OWNER,
repoName: process.env.CI_REPO_NAME,
repoCurrentBranch: process.env.CI_BRANCH,
repoBranchBase: process.env.CI_BRANCH_BASE || "main",
commitSha: process.env.CI_COMMIT_SHA,
},
};
module.exports = bundleWatchConfig;