Skip to content

Commit 13b505e

Browse files
committed
build: add and use "fs-extra"
build: add and use "@sablier/configs"
1 parent 9f5df98 commit 13b505e

File tree

7 files changed

+57
-74
lines changed

7 files changed

+57
-74
lines changed

.prettierrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const sharedConfig = require("@sablier/configs/prettier");
2+
3+
module.exports = sharedConfig;

.prettierrc.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

biome.jsonc

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,9 @@
11
{
22
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3+
"extends": ["@sablier/configs/biome"],
34
"files": {
4-
"ignoreUnknown": false,
55
"ignore": ["/dist/"],
6-
"include": ["*.js", "*.json", "*.jsonc", "*.ts"],
7-
"maxSize": 5242880 // 5MB
8-
},
9-
"formatter": {
10-
"enabled": true,
11-
"indentStyle": "space",
12-
"lineWidth": 120
13-
},
14-
"javascript": {
15-
"formatter": {
16-
"quoteStyle": "double"
17-
}
18-
},
19-
"linter": {
20-
"enabled": true,
21-
"rules": {
22-
"correctness": {
23-
"noUnusedImports": "off",
24-
"noUnusedVariables": "error"
25-
},
26-
"recommended": true
27-
}
28-
},
29-
"organizeImports": {
30-
"enabled": true
6+
"include": ["*.js", "*.json", "*.jsonc", "*.ts"]
317
},
328
"overrides": [
339
{
@@ -40,10 +16,5 @@
4016
}
4117
}
4218
}
43-
],
44-
"vcs": {
45-
"clientKind": "git",
46-
"enabled": true,
47-
"useIgnoreFile": true
48-
}
19+
]
4920
}

bun.lock

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@
44
"": {
55
"name": "@sablier/deployments",
66
"dependencies": {
7+
"@sablier/configs": "github:sablier-labs/configs",
78
"lodash": "^4.17",
8-
"winston": "^3.17",
99
},
1010
"devDependencies": {
1111
"@biomejs/biome": "1.9.4",
12+
"@types/fs-extra": "^11.0",
1213
"@types/lodash": "^4.17",
1314
"@types/node": "^22.14",
1415
"@vitest/ui": "^3.1",
1516
"axios": "^1.8",
17+
"fs-extra": "^11.3",
1618
"globby": "^14.1",
1719
"husky": "^9.1",
1820
"lint-staged": "^15.5",
@@ -22,6 +24,7 @@
2224
"viem": "^2.28",
2325
"vite-tsconfig-paths": "^5.1",
2426
"vitest": "^3.1",
27+
"winston": "^3.17",
2528
},
2629
},
2730
},
@@ -154,6 +157,8 @@
154157

155158
"@rollup/rollup-win32-x64-msvc": ["@rollup/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-lpPE1cLfP5oPzVjKMx10pgBmKELQnFJXHgvtHCtuJWOv8MxqdEIMNtgHgBFf7Ea2/7EuVwa9fodWUfXAlXZLZQ=="],
156159

160+
"@sablier/configs": ["@sablier/configs@github:sablier-labs/configs#d25b72b", {}, "sablier-labs-configs-d25b72b"],
161+
157162
"@scure/base": ["@scure/[email protected]", "", {}, "sha512-5Yy9czTO47mqz+/J8GM6GIId4umdCk1wc1q8rKERQulIoc8VP9pzDcghv10Tl2E7R96ZUx/PhND3ESYUQX8NuQ=="],
158163

159164
"@scure/bip32": ["@scure/[email protected]", "", { "dependencies": { "@noble/curves": "~1.8.1", "@noble/hashes": "~1.7.1", "@scure/base": "~1.2.2" } }, "sha512-t96EPDMbtGgtb7onKKqxRLfE5g05k7uHnHRM2xdE6BP/ZmxaLtPek4J4KfVn/90IQNrU1IOAqMgiDtUdtbe3nw=="],
@@ -164,6 +169,10 @@
164169

165170
"@types/estree": ["@types/[email protected]", "", {}, "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ=="],
166171

172+
"@types/fs-extra": ["@types/[email protected]", "", { "dependencies": { "@types/jsonfile": "*", "@types/node": "*" } }, "sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ=="],
173+
174+
"@types/jsonfile": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ=="],
175+
167176
"@types/lodash": ["@types/[email protected]", "", {}, "sha512-HX7Em5NYQAXKW+1T+FiuG27NGwzJfCX3s1GjOa7ujxZa52kjJLOr4FUxT+giF6Tgxv1e+/czV/iTtBw27WTU9g=="],
168177

169178
"@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw=="],
@@ -300,6 +309,8 @@
300309

301310
"form-data": ["[email protected]", "", { "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "es-set-tostringtag": "^2.1.0", "mime-types": "^2.1.12" } }, "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w=="],
302311

312+
"fs-extra": ["[email protected]", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew=="],
313+
303314
"fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
304315

305316
"function-bind": ["[email protected]", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="],
@@ -322,6 +333,8 @@
322333

323334
"gopd": ["[email protected]", "", {}, "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg=="],
324335

336+
"graceful-fs": ["[email protected]", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="],
337+
325338
"has-symbols": ["[email protected]", "", {}, "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ=="],
326339

327340
"has-tostringtag": ["[email protected]", "", { "dependencies": { "has-symbols": "^1.0.3" } }, "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw=="],
@@ -354,6 +367,8 @@
354367

355368
"isows": ["[email protected]", "", { "peerDependencies": { "ws": "*" } }, "sha512-lPHCayd40oW98/I0uvgaHKWCSvkzY27LjWLbtzOm64yQ+G3Q5npjjbdppU65iZXkK1Zt+kH9pfegli0AYfwYYw=="],
356369

370+
"jsonfile": ["[email protected]", "", { "dependencies": { "universalify": "^2.0.0" }, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ=="],
371+
357372
"kuler": ["[email protected]", "", {}, "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A=="],
358373

359374
"lilconfig": ["[email protected]", "", {}, "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw=="],
@@ -516,6 +531,8 @@
516531

517532
"unicorn-magic": ["[email protected]", "", {}, "sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA=="],
518533

534+
"universalify": ["[email protected]", "", {}, "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw=="],
535+
519536
"util-deprecate": ["[email protected]", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="],
520537

521538
"viem": ["[email protected]", "", { "dependencies": { "@noble/curves": "1.8.2", "@noble/hashes": "1.7.2", "@scure/bip32": "1.6.2", "@scure/bip39": "1.5.4", "abitype": "1.0.8", "isows": "1.0.6", "ox": "0.6.9", "ws": "8.18.1" }, "peerDependencies": { "typescript": ">=5.0.4" }, "optionalPeers": ["typescript"] }, "sha512-Z4W5O1pe+6pirYTFm451FcZmfGAUxUWt2L/eWC+YfTF28j/8rd7q6MBAi05lMN4KhLJjhN0s5YGIPB+kf1L20g=="],

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
},
1212
"devDependencies": {
1313
"@biomejs/biome": "1.9.4",
14+
"@sablier/configs": "github:sablier-labs/configs",
15+
"@types/fs-extra": "^11.0",
1416
"@types/lodash": "^4.17",
1517
"@types/node": "^22.14",
1618
"@vitest/ui": "^3.1",
1719
"axios": "^1.8",
20+
"fs-extra": "^11.3",
1821
"globby": "^14.1",
1922
"husky": "^9.1",
2023
"lint-staged": "^15.5",
@@ -23,8 +26,8 @@
2326
"typescript": "^5.8",
2427
"viem": "^2.28",
2528
"vite-tsconfig-paths": "^5.1",
26-
"winston": "^3.17",
27-
"vitest": "^3.1"
29+
"vitest": "^3.1",
30+
"winston": "^3.17"
2831
},
2932
"files": ["dist"],
3033
"keywords": [
@@ -33,7 +36,6 @@
3336
"deployments",
3437
"ethereum",
3538
"evm",
36-
"foundry",
3739
"sablier",
3840
"smart-contracts",
3941
"solidity",
@@ -50,9 +52,10 @@
5052
"scripts": {
5153
"biome:check": "biome check .",
5254
"biome:write": "biome check --write .",
55+
"biome:write:imports": "biome lint --write --only correctness/noUnusedImports .",
5356
"build": "bun run clean && bun run tsc:build",
5457
"clean": "rm -rf dist",
55-
"check": "bun run tsc:check && bun run biome:check && bun run prettier:check",
58+
"check": "bun run biome:check && bun run prettier:check && bun run tsc:check",
5659
"fix": "bun run biome:write && bun run prettier:write",
5760
"prepack": "bun run build",
5861
"prepare": "husky",

scripts/logger.ts

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import fs from "node:fs";
2-
import path from "node:path";
1+
import * as path from "node:path";
32
import type { Sablier } from "@src/types";
3+
import * as fs from "fs-extra";
44
import winston, { format } from "winston";
55

66
const LOG_FILE_PATH: string = process.env.LOG_FILE_PATH || "logs/debug.log";
@@ -18,25 +18,20 @@ const transports: winston.transport[] = [
1818
}),
1919
];
2020

21-
// Add file transport if LOG_FILE_PATH is set
2221
if (LOG_FILE_PATH) {
23-
// Ensure directory exists
2422
const logDir = path.dirname(LOG_FILE_PATH);
25-
if (!fs.existsSync(logDir)) {
26-
fs.mkdirSync(logDir, { recursive: true });
27-
}
23+
fs.ensureDirSync(logDir);
2824

29-
transports.push(
30-
new winston.transports.File({
31-
filename: LOG_FILE_PATH,
32-
format: format.combine(
33-
format.timestamp(),
34-
format.printf(({ timestamp, level, message }) => {
35-
return `${timestamp} ${level}: ${message}`;
36-
}),
37-
),
38-
}),
39-
);
25+
const fileTransport = new winston.transports.File({
26+
filename: LOG_FILE_PATH,
27+
format: format.combine(
28+
format.timestamp(),
29+
format.printf(({ timestamp, level, message }) => {
30+
return `${timestamp} ${level}: ${message}`;
31+
}),
32+
),
33+
});
34+
transports.push(fileTransport);
4035
}
4136

4237
/**
@@ -71,6 +66,13 @@ const logger = winston.createLogger({
7166
transports,
7267
});
7368

69+
export function logAndThrow(params: { msg: string; release?: Sablier.Release }): never {
70+
const { msg, release } = params;
71+
const errorMsg = release ? `${formatRelease(release)}\t${msg}` : msg;
72+
logger.error(errorMsg);
73+
throw new Error(errorMsg);
74+
}
75+
7476
export function logInfo(params: { msg: string; release?: Sablier.Release }): void {
7577
const { msg, release } = params;
7678
if (release) {
@@ -80,13 +82,6 @@ export function logInfo(params: { msg: string; release?: Sablier.Release }): voi
8082
}
8183
}
8284

83-
export function logAndThrow(params: { msg: string; release?: Sablier.Release }): never {
84-
const { msg, release } = params;
85-
const errorMsg = release ? `${formatRelease(release)}\t${msg}` : msg;
86-
logger.error(errorMsg);
87-
throw new Error(errorMsg);
88-
}
89-
9085
function formatRelease(release: Sablier.Release): string {
9186
return `${release.protocol}:${release.version}`;
9287
}

tsconfig.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@
1414
"moduleResolution": "NodeNext",
1515
"noImplicitAny": true,
1616
"outDir": "dist",
17+
"paths": {
18+
"@scripts": ["scripts"],
19+
"@scripts/*": ["scripts/*"],
20+
"@src": ["src"],
21+
"@src/*": ["src/*"]
22+
},
1723
"removeComments": true,
1824
"resolveJsonModule": true,
1925
"rootDir": ".",
2026
"skipLibCheck": true,
2127
"sourceMap": true,
2228
"strict": true,
2329
"target": "ES2020",
24-
"paths": {
25-
"@scripts": ["scripts"],
26-
"@scripts/*": ["scripts/*"],
27-
"@src": ["src"],
28-
"@src/*": ["src/*"]
29-
},
3030
"types": ["node"]
3131
},
3232
"exclude": ["/data", "/node_modules"],

0 commit comments

Comments
 (0)