laxy-verify 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/badge.d.ts CHANGED
@@ -1 +1 @@
1
- export declare function generateBadge(grade: string): string;
1
+ export declare function generateBadge(grade: string): string;
package/dist/badge.js CHANGED
@@ -1,11 +1,14 @@
1
- export function generateBadge(grade) {
2
- const gradeLower = grade.toLowerCase();
3
- const colors = {
4
- gold: "yellow",
5
- silver: "brightgreen",
6
- bronze: "blue",
7
- unverified: "lightgrey",
8
- };
9
- const color = colors[gradeLower] ?? "lightgrey";
10
- return `![Laxy Verify: ${grade}](https://img.shields.io/badge/laxy_verify-${gradeLower}-${color})`;
11
- }
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateBadge = generateBadge;
4
+ function generateBadge(grade) {
5
+ const gradeLower = grade.toLowerCase();
6
+ const colors = {
7
+ gold: "yellow",
8
+ silver: "brightgreen",
9
+ bronze: "blue",
10
+ unverified: "lightgrey",
11
+ };
12
+ const color = colors[gradeLower] ?? "lightgrey";
13
+ return `![Laxy Verify: ${grade}](https://img.shields.io/badge/laxy_verify-${gradeLower}-${color})`;
14
+ }
package/dist/build.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- export interface BuildResult {
2
- success: boolean;
3
- durationMs: number;
4
- errors: string[];
5
- }
6
- export declare class BuildError extends Error {
7
- errors: string[];
8
- timedOut: boolean;
9
- constructor(message: string, errors: string[], timedOut?: boolean);
10
- }
11
- export declare function runBuild(command: string, timeoutSec: number): Promise<BuildResult>;
1
+ export interface BuildResult {
2
+ success: boolean;
3
+ durationMs: number;
4
+ errors: string[];
5
+ }
6
+ export declare class BuildError extends Error {
7
+ errors: string[];
8
+ timedOut: boolean;
9
+ constructor(message: string, errors: string[], timedOut?: boolean);
10
+ }
11
+ export declare function runBuild(command: string, timeoutSec: number): Promise<BuildResult>;
package/dist/build.js CHANGED
@@ -1,59 +1,67 @@
1
- import { spawn } from "node:child_process";
2
- import treeKill from "tree-kill";
3
- export class BuildError extends Error {
4
- errors;
5
- timedOut;
6
- constructor(message, errors, timedOut = false) {
7
- super(message);
8
- this.errors = errors;
9
- this.timedOut = timedOut;
10
- this.name = "BuildError";
11
- }
12
- }
13
- export function runBuild(command, timeoutSec) {
14
- return new Promise((resolve, reject) => {
15
- const startTime = Date.now();
16
- const stderrLines = [];
17
- const errorLines = [];
18
- console.log(`\n Building: ${command}`);
19
- const proc = spawn(command, { shell: true, stdio: ["ignore", "pipe", "pipe"] });
20
- let timedOut = false;
21
- const timer = setTimeout(() => {
22
- timedOut = true;
23
- if (proc.pid) {
24
- treeKill(proc.pid, "SIGKILL");
25
- }
26
- reject(new BuildError(`Build timed out after ${timeoutSec}s`, errorLines, true));
27
- }, timeoutSec * 1000);
28
- proc.stdout?.on("data", (chunk) => {
29
- // Print build output to console
30
- const lines = chunk.toString().split("\n").filter(Boolean);
31
- for (const line of lines) {
32
- console.log(` ${line}`);
33
- }
34
- });
35
- proc.stderr?.on("data", (chunk) => {
36
- const text = chunk.toString();
37
- const lines = text.split("\n").filter(Boolean);
38
- stderrLines.push(...lines);
39
- errorLines.push(...lines);
40
- for (const line of lines) {
41
- console.error(` ${line}`);
42
- }
43
- });
44
- proc.on("exit", (code) => {
45
- clearTimeout(timer);
46
- const durationMs = Date.now() - startTime;
47
- const success = code === 0;
48
- resolve({
49
- success,
50
- durationMs,
51
- errors: success ? [] : errorLines,
52
- });
53
- });
54
- proc.on("error", (err) => {
55
- clearTimeout(timer);
56
- reject(new BuildError(`Build process failed: ${err.message}`, errorLines));
57
- });
58
- });
59
- }
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.BuildError = void 0;
7
+ exports.runBuild = runBuild;
8
+ const node_child_process_1 = require("node:child_process");
9
+ const tree_kill_1 = __importDefault(require("tree-kill"));
10
+ class BuildError extends Error {
11
+ errors;
12
+ timedOut;
13
+ constructor(message, errors, timedOut = false) {
14
+ super(message);
15
+ this.errors = errors;
16
+ this.timedOut = timedOut;
17
+ this.name = "BuildError";
18
+ }
19
+ }
20
+ exports.BuildError = BuildError;
21
+ function runBuild(command, timeoutSec) {
22
+ return new Promise((resolve, reject) => {
23
+ const startTime = Date.now();
24
+ const stderrLines = [];
25
+ const errorLines = [];
26
+ console.log(`\n Building: ${command}`);
27
+ const proc = (0, node_child_process_1.spawn)(command, { shell: true, stdio: ["ignore", "pipe", "pipe"] });
28
+ let timedOut = false;
29
+ const timer = setTimeout(() => {
30
+ timedOut = true;
31
+ if (proc.pid) {
32
+ (0, tree_kill_1.default)(proc.pid, "SIGKILL");
33
+ }
34
+ reject(new BuildError(`Build timed out after ${timeoutSec}s`, errorLines, true));
35
+ }, timeoutSec * 1000);
36
+ proc.stdout?.on("data", (chunk) => {
37
+ // Print build output to console
38
+ const lines = chunk.toString().split("\n").filter(Boolean);
39
+ for (const line of lines) {
40
+ console.log(` ${line}`);
41
+ }
42
+ });
43
+ proc.stderr?.on("data", (chunk) => {
44
+ const text = chunk.toString();
45
+ const lines = text.split("\n").filter(Boolean);
46
+ stderrLines.push(...lines);
47
+ errorLines.push(...lines);
48
+ for (const line of lines) {
49
+ console.error(` ${line}`);
50
+ }
51
+ });
52
+ proc.on("exit", (code) => {
53
+ clearTimeout(timer);
54
+ const durationMs = Date.now() - startTime;
55
+ const success = code === 0;
56
+ resolve({
57
+ success,
58
+ durationMs,
59
+ errors: success ? [] : errorLines,
60
+ });
61
+ });
62
+ proc.on("error", (err) => {
63
+ clearTimeout(timer);
64
+ reject(new BuildError(`Build process failed: ${err.message}`, errorLines));
65
+ });
66
+ });
67
+ }
package/dist/cli.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- #!/usr/bin/env node
2
- export {};
1
+ #!/usr/bin/env node
2
+ export {};