Consolidate dependencies into its own file.
This commit is contained in:
parent
16c37b028e
commit
61445591e4
|
@ -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";
|
import { runCommand } from "./run.ts";
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
async function main(): Promise<void> {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { Command } from "https://deno.land/x/cliffy@v0.25.7/command/mod.ts";
|
import { Command, prompt } from "../dependencies.ts";
|
||||||
import * as prompt from "https://deno.land/x/cliffy@v0.25.7/prompt/mod.ts";
|
|
||||||
|
|
||||||
export const runCommand = new Command()
|
export const runCommand = new Command()
|
||||||
.name("run")
|
.name("run")
|
||||||
|
|
|
@ -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";
|
import { runAndReturnStdout } from "./utilities.ts";
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
async function main(): Promise<void> {
|
||||||
|
|
|
@ -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";
|
import { runAndReturnStdout } from "./utilities.ts";
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
async function main(): Promise<void> {
|
||||||
|
|
|
@ -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;
|
const imagePath = new URL("../data/wallpaper.jpg", import.meta.url).pathname;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import { Command } from "https://deno.land/x/cliffy@v0.25.7/command/mod.ts";
|
import { Command, prompt } from "./dependencies.ts";
|
||||||
import * as prompt from "https://deno.land/x/cliffy@v0.25.7/prompt/mod.ts";
|
|
||||||
|
|
||||||
import { stringifyJsonPretty } from "./utilities.ts";
|
import { stringifyJsonPretty } from "./utilities.ts";
|
||||||
|
|
||||||
const CaveComplexity = [1, 2, 3] as const;
|
const CaveComplexity = [1, 2, 3] as const;
|
||||||
|
|
|
@ -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";
|
import { tomlFrontmatter } from "./utilities.ts";
|
||||||
|
|
||||||
type Frontmatter = {
|
type Frontmatter = {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { Command } from "https://deno.land/x/cliffy@v0.25.7/command/mod.ts";
|
import { Command, nodeFs } from "./dependencies.ts";
|
||||||
import { existsSync } from "https://deno.land/std@0.167.0/node/fs.ts";
|
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
async function main(): Promise<void> {
|
||||||
const { args, options } = await new Command()
|
const { args, options } = await new Command()
|
||||||
|
@ -21,7 +20,7 @@ async function main(): Promise<void> {
|
||||||
|
|
||||||
const [file, text] = args;
|
const [file, text] = args;
|
||||||
|
|
||||||
if (existsSync(file)) {
|
if (nodeFs.existsSync(file)) {
|
||||||
if (options.overwrite) {
|
if (options.overwrite) {
|
||||||
await Deno.remove(file);
|
await Deno.remove(file);
|
||||||
} else {
|
} else {
|
||||||
|
@ -45,7 +44,7 @@ async function main(): Promise<void> {
|
||||||
],
|
],
|
||||||
}).status();
|
}).status();
|
||||||
|
|
||||||
if (!existsSync(file)) {
|
if (!nodeFs.existsSync(file)) {
|
||||||
console.log("Something went wrong with GEGL.");
|
console.log("Something went wrong with GEGL.");
|
||||||
Deno.exit(1);
|
Deno.exit(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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";
|
import { runAndReturnStdout } from "./utilities.ts";
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
async function main(): Promise<void> {
|
||||||
|
|
|
@ -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 hiddenApi = "http://127.0.0.1:7813";
|
||||||
const remoteApi = "http://127.0.0.1:7814/api1";
|
const remoteApi = "http://127.0.0.1:7814/api1";
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { parse } from "https://deno.land/std@0.167.0/encoding/toml.ts";
|
import { nodeUtil, toml } from "./dependencies.ts";
|
||||||
import { TextDecoder } from "https://deno.land/std@0.167.0/node/util.ts";
|
|
||||||
|
|
||||||
export function stringifyJsonPretty(input: unknown): string {
|
export function stringifyJsonPretty(input: unknown): string {
|
||||||
return JSON.stringify(input, null, 2);
|
return JSON.stringify(input, null, 2);
|
||||||
|
@ -9,7 +8,7 @@ export async function runAndReturnStdout(
|
||||||
options: Deno.RunOptions,
|
options: Deno.RunOptions,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const process = Deno.run({ stdout: "piped", ...options });
|
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>(
|
export function tomlFrontmatter<T>(
|
||||||
|
@ -34,5 +33,5 @@ export function tomlFrontmatter<T>(
|
||||||
|
|
||||||
end += endMarker.length;
|
end += endMarker.length;
|
||||||
const extra = data.slice(end);
|
const extra = data.slice(end);
|
||||||
return [parse(frontmatter) as T, extra.trimStart()];
|
return [toml.parse(frontmatter) as T, extra.trimStart()];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue