lvr.js 0.0.0

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/README.md ADDED
@@ -0,0 +1,87 @@
1
+ # Lvr.js: Lvr for JS/TS
2
+
3
+ [![License](https://img.shields.io/badge/license-Public%20Domain-blue.svg)](https://unlicense.org)
4
+ [![Compatibility](https://img.shields.io/badge/typescript-5.4%2B-blue)](https://typescriptlang.org/docs/handbook/release-notes/typescript-5-4.html)
5
+ [![Package](https://img.shields.io/npm/v/lvr.js)](https://npmjs.com/package/lvr.js)
6
+
7
+ **[Lvr] for [JavaScript]/[TypeScript].**
8
+
9
+ > [!TIP]
10
+ > 🚧 _We are building in public. This is presently under heavy construction._
11
+
12
+ <sub>
13
+
14
+ [[Features](#-features)] |
15
+ [[Prerequisites](#%EF%B8%8F-prerequisites)] |
16
+ [[Installation](#%EF%B8%8F-installation)] |
17
+ [[Examples](#-examples)] |
18
+ [[Reference](#-reference)] |
19
+ [[Development](#%E2%80%8D-development)]
20
+
21
+ </sub>
22
+
23
+ ## ✨ Features
24
+
25
+ - 100% pure and safe TypeScript with zero dependencies and no bloat.
26
+ - Cuts red tape: 100% free and unencumbered public domain software.
27
+ - Polyglot software also available for Dart, Python, Ruby, and Rust.
28
+
29
+ ## 🛠️ Prerequisites
30
+
31
+ - [TypeScript] 5.4+
32
+ - [Node.js] 24+ (LTS)
33
+
34
+ ## ⬇️ Installation
35
+
36
+ ### Installation with Bun
37
+
38
+ ```bash
39
+ bun add --dev lvr.js
40
+ ```
41
+
42
+ ### Installation with NPM
43
+
44
+ ```bash
45
+ npm install --save-dev lvr.js
46
+ ```
47
+
48
+ ### Installation with pnpm
49
+
50
+ ```bash
51
+ pnpm add --save-dev lvr.js
52
+ ```
53
+
54
+ ### Installation with yarn
55
+
56
+ ```bash
57
+ yarn add --dev lvr.js
58
+ ```
59
+
60
+ ## 👉 Examples
61
+
62
+ ### Importing the Library
63
+
64
+ ```typescript
65
+ import * as Lvr from 'lvr.js'
66
+ ```
67
+
68
+ ## 📚 Reference
69
+
70
+ ## 👨‍💻 Development
71
+
72
+ ```bash
73
+ git clone https://github.com/artob/lvr.git
74
+ ```
75
+
76
+ ---
77
+
78
+ [![Share on X](https://img.shields.io/badge/share%20on-x-03A9F4?logo=x)](https://x.com/intent/post?url=https://github.com/artob/lvr&text=Lvr)
79
+ [![Share on Reddit](https://img.shields.io/badge/share%20on-reddit-red?logo=reddit)](https://reddit.com/submit?url=https://github.com/artob/lvr&title=Lvr)
80
+ [![Share on Hacker News](https://img.shields.io/badge/share%20on-hn-orange?logo=ycombinator)](https://news.ycombinator.com/submitlink?u=https://github.com/artob/lvr&t=Lvr)
81
+ [![Share on Facebook](https://img.shields.io/badge/share%20on-fb-1976D2?logo=facebook)](https://www.facebook.com/sharer/sharer.php?u=https://github.com/artob/lvr)
82
+ [![Share on LinkedIn](https://img.shields.io/badge/share%20on-linkedin-3949AB?logo=linkedin)](https://www.linkedin.com/sharing/share-offsite/?url=https://github.com/artob/lvr)
83
+
84
+ [Lvr]: https://lvr.dev
85
+ [JavaScript]: https://developer.mozilla.org/en-US/docs/Web/JavaScript
86
+ [Node.js]: https://nodejs.org
87
+ [TypeScript]: https://typescriptlang.org
@@ -0,0 +1,15 @@
1
+ type RunResult = {
2
+ stdout: string;
3
+ stderr: string;
4
+ code: number | null;
5
+ };
6
+ /**
7
+ * Run an external CLI and capture its output.
8
+ * This is intentionally minimal — real callers should add timeouts, retries and streaming as needed.
9
+ */
10
+ declare function runCLI(command: string, args?: string[]): Promise<RunResult>;
11
+ declare const _default: {
12
+ runCLI: typeof runCLI;
13
+ };
14
+
15
+ export { type RunResult, _default as default, runCLI };
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ // src/index.ts
2
+ import { spawn } from "child_process";
3
+ async function runCLI(command, args = []) {
4
+ return new Promise((resolve, reject) => {
5
+ const child = spawn(command, args, { stdio: ["ignore", "pipe", "pipe"] });
6
+ let stdout = "";
7
+ let stderr = "";
8
+ child.stdout?.on("data", (chunk) => {
9
+ stdout += chunk.toString();
10
+ });
11
+ child.stderr?.on("data", (chunk) => {
12
+ stderr += chunk.toString();
13
+ });
14
+ child.on("error", (err) => reject(err));
15
+ child.on(
16
+ "close",
17
+ (code) => resolve({ stdout, stderr, code })
18
+ );
19
+ });
20
+ }
21
+ var index_default = {
22
+ runCLI
23
+ };
24
+ export {
25
+ index_default as default,
26
+ runCLI
27
+ };
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "lvr.js",
3
+ "version": "0.0.0",
4
+ "description": "Lvr for JS/TS",
5
+ "homepage": "https://lvr.dev",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/artob/lvr.git"
9
+ },
10
+ "bugs": {
11
+ "url": "https://github.com/artob/lvr/issues"
12
+ },
13
+ "author": {
14
+ "name": "Arto Bendiken",
15
+ "email": "arto@bendiken.net",
16
+ "url": "https://ar.to"
17
+ },
18
+ "license": "Unlicense",
19
+ "keywords": [
20
+ "lvr"
21
+ ],
22
+ "main": "dist/index.js",
23
+ "module": "dist/index.js",
24
+ "types": "dist/index.d.ts",
25
+ "type": "module",
26
+ "exports": {
27
+ ".": {
28
+ "import": "./dist/index.js",
29
+ "types": "./dist/index.d.ts"
30
+ },
31
+ "./package.json": "./package.json"
32
+ },
33
+ "files": [
34
+ "dist",
35
+ "src",
36
+ "README.md",
37
+ "UNLICENSE"
38
+ ],
39
+ "scripts": {
40
+ "build": "tsup src/index.ts --format esm --dts --out-dir dist",
41
+ "clean": "rm -rf dist",
42
+ "prepare": "bun run build"
43
+ },
44
+ "devDependencies": {
45
+ "@types/bun": "latest",
46
+ "@types/node": "latest",
47
+ "tsup": "latest",
48
+ "typescript": "^5.4.0"
49
+ },
50
+ "peerDependencies": {
51
+ "typescript": "^5"
52
+ },
53
+ "engines": {
54
+ "node": ">=24"
55
+ },
56
+ "publishConfig": {
57
+ "access": "public"
58
+ }
59
+ }
package/src/index.ts ADDED
@@ -0,0 +1,40 @@
1
+ // This is free and unencumbered software released into the public domain.
2
+
3
+ import { spawn } from "child_process";
4
+
5
+ export type RunResult = {
6
+ stdout: string;
7
+ stderr: string;
8
+ code: number | null;
9
+ };
10
+
11
+ /**
12
+ * Run an external CLI and capture its output.
13
+ * This is intentionally minimal — real callers should add timeouts, retries and streaming as needed.
14
+ */
15
+ export async function runCLI(
16
+ command: string,
17
+ args: string[] = [],
18
+ ): Promise<RunResult> {
19
+ return new Promise((resolve, reject) => {
20
+ const child = spawn(command, args, { stdio: ["ignore", "pipe", "pipe"] });
21
+ let stdout = "";
22
+ let stderr = "";
23
+
24
+ child.stdout?.on("data", (chunk: Buffer | string) => {
25
+ stdout += chunk.toString();
26
+ });
27
+ child.stderr?.on("data", (chunk: Buffer | string) => {
28
+ stderr += chunk.toString();
29
+ });
30
+
31
+ child.on("error", (err: Error) => reject(err));
32
+ child.on("close", (code: number | null) =>
33
+ resolve({ stdout, stderr, code }),
34
+ );
35
+ });
36
+ }
37
+
38
+ export default {
39
+ runCLI,
40
+ };