-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.size-limit.js
60 lines (52 loc) · 1.76 KB
/
.size-limit.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
const sizeMap = {
xxs: '10 KB',
xs: '50 KB',
s: '100 KB',
m: '250 KB',
l: '1 MB',
xl: '2 MB',
xxl: '5 MB',
};
const getSizeFor = (packagePath, sizeType, isApp = false, packageNameOverride = null) => {
const size = sizeMap[sizeType];
if (!size) throw new Error(`Unknown size type ${sizeType}`);
const basePath = isApp ? './apps/' : './packages/';
const packageName = packageNameOverride || packagePath.split('/').pop();
const packagePrefix = packagePath.includes('toolboxes') ? 'toolbox-' : packagePath.includes('wallets') ? 'wallet-' : '';
return [
{
limit: size,
path: `${basePath}${packagePath}/dist/*.cjs`,
name: `@${packagePrefix}${packageName} - CommonJS`,
},
{
limit: size,
path: `${basePath}${packagePath}/dist/*.js`,
name: `@${packagePrefix}${packageName} - ES Modules`,
},
];
};
module.exports = [
// Pioneer
...getSizeFor('pioneer', 'xxl', true, 'pioneer-sdk/pioneer-react'),
...getSizeFor('pioneer/pioneer-sdk', 'xxl'),
// Other packages
...getSizeFor('coinmasters/api', 'xxs'),
...getSizeFor('coinmasters/core', 'xs'),
...getSizeFor('coinmasters/helpers', 'xs'),
...getSizeFor('coinmasters/sdk', 'xxl'),
...getSizeFor('coinmasters/tokens', 'xl'),
...getSizeFor('coinmasters/types', 'xxs'),
...getSizeFor('toolboxes/cosmos', 'l'),
...getSizeFor('toolboxes/evm', 'l'),
...getSizeFor('toolboxes/utxo', 'l'),
...getSizeFor('wallets/evm-extensions', 'xxs'),
...getSizeFor('wallets/keepkey', 'm'),
...getSizeFor('wallets/keplr', 'xxs'),
...getSizeFor('wallets/keystore', 'm'),
...getSizeFor('wallets/ledger', 'xl'),
...getSizeFor('wallets/okx', 'xxs'),
...getSizeFor('wallets/trezor', 's'),
...getSizeFor('wallets/wc', 'l'),
...getSizeFor('wallets/xdefi', 'xxs'),
];