♻️ Refactor import statements and update script metadata for improved readability and dependency management
This commit is contained in:
@@ -6,15 +6,7 @@ import { encodeBase32 } from "jsr:@std/encoding/base32";
|
||||
import {dirname, fromFileUrl} from "jsr:@std/path";
|
||||
import {toArrayBuffer} from "jsr:@std/streams";
|
||||
import {spawn, SpawnOptionsWithoutStdio} from "node:child_process";
|
||||
import {
|
||||
createWriteStream,
|
||||
mkdir,
|
||||
readFile,
|
||||
readFileSync,
|
||||
rm,
|
||||
stat,
|
||||
writeFile,
|
||||
} from "node:fs";
|
||||
import {createWriteStream, mkdir, readFile, readFileSync, rm, stat, writeFile,} from "node:fs";
|
||||
import {pipeline} from "node:stream";
|
||||
import {promisify} from "node:util";
|
||||
import {getRandomValues} from "node:crypto";
|
||||
@@ -1029,7 +1021,9 @@ async function __getMasterEncryptionKey1(): Promise<string> {
|
||||
|
||||
async function __getMasterEncryptionKey2(): Promise<string> {
|
||||
if (!__masterEncryptionKey2) {
|
||||
const filename = "~/.deno-common-mod-master-encryption-key-2";
|
||||
const filename = resolveFilename(
|
||||
"~/.deno-common-mod-master-encryption-key-2",
|
||||
);
|
||||
__masterEncryptionKey2 = await readFileToString(filename);
|
||||
if (!__masterEncryptionKey2) {
|
||||
__masterEncryptionKey2 = encodeBase64(random(4096));
|
||||
@@ -1124,7 +1118,9 @@ export async function readWithLocalCache<T>(
|
||||
throw new Error("Key and read callback function are both required.");
|
||||
}
|
||||
const cacheKeyHash = await sha256AndBase32OfString(cacheKey);
|
||||
const basePath = options?.basePath ?? "~/.cache/local-cache";
|
||||
const basePath = resolveFilename(
|
||||
options?.basePath ?? "~/.cache/local-cache",
|
||||
);
|
||||
const cacheDir = joinPath(
|
||||
basePath,
|
||||
cacheKeyHash.substring(0, 2),
|
||||
|
||||
@@ -118,11 +118,11 @@
|
||||
"get-secret.ts": {
|
||||
"script_name": "get-secret.ts",
|
||||
"script_length": 739,
|
||||
"script_sha256": "e036f5411904d53f7525f4830eb51282df3a9f07a3e6f8b23d5385b4f24ec676",
|
||||
"script_sha256": "0d4123bc38361c42044050eb46296c443168dd9c882db8b1282e858043096e63",
|
||||
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/get-secret.ts",
|
||||
"single_script_file": true,
|
||||
"publish_time": 1775239056991,
|
||||
"update_time": 1775453129788
|
||||
"update_time": 1775487544902
|
||||
},
|
||||
"git-check.ts": {
|
||||
"script_name": "git-check.ts",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env -S deno run -A
|
||||
|
||||
import {args, exit, getSecretValue,} from "https://script.hatter.ink/@66/deno-commons-mod.ts";
|
||||
import {args, exit, getSecretValue,} from "https://script.hatter.ink/@67/deno-commons-mod.ts";
|
||||
import {parseArgs} from "jsr:@std/cli/parse-args";
|
||||
|
||||
const flags = parseArgs(args(), {
|
||||
|
||||
Reference in New Issue
Block a user