From 4361f29319df4ebafd8f84886142dae45733a71d Mon Sep 17 00:00:00 2001 From: sugoidogo Date: Mon, 1 Dec 2025 05:21:16 -0800 Subject: [PATCH] initial commit --- .gitignore | 2 + package-lock.json | 208 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 8 ++ src/cli.ts | 0 src/logLevel.ts | 33 ++++++++ tsconfig.json | 7 ++ 6 files changed, 258 insertions(+) create mode 100644 .gitignore create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 src/cli.ts create mode 100644 src/logLevel.ts create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9e87c05 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +bin \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..bdb4c13 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,208 @@ +{ + "name": "packwiz-extras-cli", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "bun": "^1.3.3" + }, + "devDependencies": { + "@types/node": "^24.10.1" + } + }, + "node_modules/@oven/bun-darwin-aarch64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@oven/bun-darwin-aarch64/-/bun-darwin-aarch64-1.3.3.tgz", + "integrity": "sha512-eJopQrUk0WR7jViYDC29+Rp50xGvs4GtWOXBeqCoFMzutkkO3CZvHehA4JqnjfWMTSS8toqvRhCSOpOz62Wf9w==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oven/bun-darwin-x64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64/-/bun-darwin-x64-1.3.3.tgz", + "integrity": "sha512-xGDePueVFrNgkS+iN0QdEFeRrx2MQ5hQ9ipRFu7N73rgoSSJsFlOKKt2uGZzunczedViIfjYl0ii0K4E9aZ0Ow==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oven/bun-darwin-x64-baseline": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64-baseline/-/bun-darwin-x64-baseline-1.3.3.tgz", + "integrity": "sha512-1ij4wQ9ECLFf1XFry+IFUN+28if40ozDqq6+QtuyOhIwraKzXOlAUbILhRMGvM3ED3yBex2mTwlKpA4Vja/V2g==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oven/bun-linux-aarch64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64/-/bun-linux-aarch64-1.3.3.tgz", + "integrity": "sha512-DabZ3Mt1XcJneWdEEug8l7bCPVvDBRBpjUIpNnRnMFWFnzr8KBEpMcaWTwYOghjXyJdhB4MPKb19MwqyQ+FHAw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oven/bun-linux-aarch64-musl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64-musl/-/bun-linux-aarch64-musl-1.3.3.tgz", + "integrity": "sha512-XWQ3tV/gtZj0wn2AdSUq/tEOKWT4OY+Uww70EbODgrrq00jxuTfq5nnYP6rkLD0M/T5BHJdQRSfQYdIni9vldw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oven/bun-linux-x64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64/-/bun-linux-x64-1.3.3.tgz", + "integrity": "sha512-7eIARtKZKZDtah1aCpQUj/1/zT/zHRR063J6oAxZP9AuA547j5B9OM2D/vi/F4En7Gjk9FPjgPGTSYeqpQDzJw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oven/bun-linux-x64-baseline": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-baseline/-/bun-linux-x64-baseline-1.3.3.tgz", + "integrity": "sha512-IU8pxhIf845psOv55LqJyL+tSUc6HHMfs6FGhuJcAnyi92j+B1HjOhnFQh9MW4vjoo7do5F8AerXlvk59RGH2w==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oven/bun-linux-x64-musl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-musl/-/bun-linux-x64-musl-1.3.3.tgz", + "integrity": "sha512-xNSDRPn1yyObKteS8fyQogwsS4eCECswHHgaKM+/d4wy/omZQrXn8ZyGm/ZF9B73UfQytUfbhE7nEnrFq03f0w==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oven/bun-linux-x64-musl-baseline": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-musl-baseline/-/bun-linux-x64-musl-baseline-1.3.3.tgz", + "integrity": "sha512-JoRTPdAXRkNYouUlJqEncMWUKn/3DiWP03A7weBbtbsKr787gcdNna2YeyQKCb1lIXE4v1k18RM3gaOpQobGIQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oven/bun-windows-x64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@oven/bun-windows-x64/-/bun-windows-x64-1.3.3.tgz", + "integrity": "sha512-kWqa1LKvDdAIzyfHxo3zGz3HFWbFHDlrNK77hKjUN42ycikvZJ+SHSX76+1OW4G8wmLETX4Jj+4BM1y01DQRIQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@oven/bun-windows-x64-baseline": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@oven/bun-windows-x64-baseline/-/bun-windows-x64-baseline-1.3.3.tgz", + "integrity": "sha512-u5eZHKq6TPJSE282KyBOicGQ2trkFml0RoUfqkPOJVo7TXGrsGYYzdsugZRnVQY/WEmnxGtBy4T3PAaPqgQViA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/node": { + "version": "24.10.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", + "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "node_modules/bun": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/bun/-/bun-1.3.3.tgz", + "integrity": "sha512-2hJ4ocTZ634/Ptph4lysvO+LbbRZq8fzRvMwX0/CqaLBxrF2UB5D1LdMB8qGcdtCer4/VR9Bx5ORub0yn+yzmw==", + "cpu": [ + "arm64", + "x64" + ], + "hasInstallScript": true, + "license": "MIT", + "os": [ + "darwin", + "linux", + "win32" + ], + "bin": { + "bun": "bin/bun.exe", + "bunx": "bin/bunx.exe" + }, + "optionalDependencies": { + "@oven/bun-darwin-aarch64": "1.3.3", + "@oven/bun-darwin-x64": "1.3.3", + "@oven/bun-darwin-x64-baseline": "1.3.3", + "@oven/bun-linux-aarch64": "1.3.3", + "@oven/bun-linux-aarch64-musl": "1.3.3", + "@oven/bun-linux-x64": "1.3.3", + "@oven/bun-linux-x64-baseline": "1.3.3", + "@oven/bun-linux-x64-musl": "1.3.3", + "@oven/bun-linux-x64-musl-baseline": "1.3.3", + "@oven/bun-windows-x64": "1.3.3", + "@oven/bun-windows-x64-baseline": "1.3.3" + } + }, + "node_modules/undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "dev": true, + "license": "MIT" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..e722237 --- /dev/null +++ b/package.json @@ -0,0 +1,8 @@ +{ + "devDependencies": { + "@types/node": "^24.10.1" + }, + "dependencies": { + "bun": "^1.3.3" + } +} diff --git a/src/cli.ts b/src/cli.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/logLevel.ts b/src/logLevel.ts new file mode 100644 index 0000000..26dda95 --- /dev/null +++ b/src/logLevel.ts @@ -0,0 +1,33 @@ +// Source - https://stackoverflow.com/a/71945252 +// Posted by haschtl, modified by community. See post 'Timeline' for change history +// Retrieved 2025-11-28, License - CC BY-SA 4.0 + +export const logLevels = ["debug", "log", "warn", "error", "none"] as const; +type LogLevel = (typeof logLevels)[number]; + +declare global { + var logLevel: LogLevel; +} + +const shouldLog = (level: LogLevel) => { + return logLevels.indexOf(level) >= logLevels.indexOf(global.logLevel); +}; + +global.logLevel = "debug"; + +const _console = console +global.console = { + ...global.console, + log: (message?: any, ...optionalParams: any[]) => { + shouldLog("log") && _console.log(message, ...optionalParams); + }, + warn: (message?: any, ...optionalParams: any[]) => { + shouldLog("warn") && _console.warn(message, ...optionalParams); + }, + error: (message?: any, ...optionalParams: any[]) => { + shouldLog("error") && _console.error(message, ...optionalParams); + }, + debug: (message?: any, ...optionalParams: any[]) => { + shouldLog("debug") && _console.debug(message, ...optionalParams); + }, +}; diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..2f0bf55 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "target": "es2022", + "module": "es2022", + "moduleResolution": "node" + } +} \ No newline at end of file