1
Fork 0

Consolidate dependencies into its own file.

This commit is contained in:
Bauke 2023-02-26 12:34:26 +01:00
parent 16c37b028e
commit 61445591e4
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
11 changed files with 15 additions and 23 deletions

View File

@ -1,5 +1,4 @@
import { Command } from "https://deno.land/x/cliffy@v0.25.7/command/mod.ts";
import { Command } from "../dependencies.ts";
import { runCommand } from "./run.ts";
async function main(): Promise<void> {

View File

@ -1,5 +1,4 @@
import { Command } from "https://deno.land/x/cliffy@v0.25.7/command/mod.ts";
import * as prompt from "https://deno.land/x/cliffy@v0.25.7/prompt/mod.ts";
import { Command, prompt } from "../dependencies.ts";
export const runCommand = new Command()
.name("run")

View File

@ -1,5 +1,4 @@
import { Command } from "https://deno.land/x/cliffy@v0.25.7/command/mod.ts";
import { Command } from "./dependencies.ts";
import { runAndReturnStdout } from "./utilities.ts";
async function main(): Promise<void> {

View File

@ -1,4 +1,4 @@
import { Command } from "https://deno.land/x/cliffy@v0.25.7/command/mod.ts";
import { Command } from "./dependencies.ts";
import { runAndReturnStdout } from "./utilities.ts";
async function main(): Promise<void> {

View File

@ -1,4 +1,4 @@
import { Command } from "https://deno.land/x/cliffy@v0.25.7/command/mod.ts";
import { Command } from "./dependencies.ts";
const imagePath = new URL("../data/wallpaper.jpg", import.meta.url).pathname;

View File

@ -1,6 +1,4 @@
import { Command } from "https://deno.land/x/cliffy@v0.25.7/command/mod.ts";
import * as prompt from "https://deno.land/x/cliffy@v0.25.7/prompt/mod.ts";
import { Command, prompt } from "./dependencies.ts";
import { stringifyJsonPretty } from "./utilities.ts";
const CaveComplexity = [1, 2, 3] as const;

View File

@ -1,4 +1,4 @@
import { Command } from "https://deno.land/x/cliffy@v0.25.7/command/mod.ts";
import { Command } from "./dependencies.ts";
import { tomlFrontmatter } from "./utilities.ts";
type Frontmatter = {

View File

@ -1,5 +1,4 @@
import { Command } from "https://deno.land/x/cliffy@v0.25.7/command/mod.ts";
import { existsSync } from "https://deno.land/std@0.167.0/node/fs.ts";
import { Command, nodeFs } from "./dependencies.ts";
async function main(): Promise<void> {
const { args, options } = await new Command()
@ -21,7 +20,7 @@ async function main(): Promise<void> {
const [file, text] = args;
if (existsSync(file)) {
if (nodeFs.existsSync(file)) {
if (options.overwrite) {
await Deno.remove(file);
} else {
@ -45,7 +44,7 @@ async function main(): Promise<void> {
],
}).status();
if (!existsSync(file)) {
if (!nodeFs.existsSync(file)) {
console.log("Something went wrong with GEGL.");
Deno.exit(1);
}

View File

@ -1,5 +1,4 @@
import { Command } from "https://deno.land/x/cliffy@v0.25.7/command/mod.ts";
import { Command } from "./dependencies.ts";
import { runAndReturnStdout } from "./utilities.ts";
async function main(): Promise<void> {

View File

@ -1,4 +1,4 @@
import { Command } from "https://deno.land/x/cliffy@v0.25.7/command/mod.ts";
import { Command } from "./dependencies.ts";
const hiddenApi = "http://127.0.0.1:7813";
const remoteApi = "http://127.0.0.1:7814/api1";

View File

@ -1,5 +1,4 @@
import { parse } from "https://deno.land/std@0.167.0/encoding/toml.ts";
import { TextDecoder } from "https://deno.land/std@0.167.0/node/util.ts";
import { nodeUtil, toml } from "./dependencies.ts";
export function stringifyJsonPretty(input: unknown): string {
return JSON.stringify(input, null, 2);
@ -9,7 +8,7 @@ export async function runAndReturnStdout(
options: Deno.RunOptions,
): Promise<string> {
const process = Deno.run({ stdout: "piped", ...options });
return new TextDecoder().decode(await process.output());
return new nodeUtil.TextDecoder().decode(await process.output());
}
export function tomlFrontmatter<T>(
@ -34,5 +33,5 @@ export function tomlFrontmatter<T>(
end += endMarker.length;
const extra = data.slice(end);
return [parse(frontmatter) as T, extra.trimStart()];
return [toml.parse(frontmatter) as T, extra.trimStart()];
}