In order to generate html from terminal output, you can use this tool https://github.com/buildkite/terminal-to-html to do it in two steps.
Capture
First, run your command, and save it to a raw output file.
$ mycommand > output.term
interface Node { | |
id: ID! | |
} | |
interface Entity implements Node | |
@loads(from: "catalog") | |
@discriminates(with: "kind") { | |
id: ID! | |
kind: String! | |
} |
import type { Observer, Resolve } from "../types.ts"; | |
import { shift } from "../deps.ts"; | |
export function createObservable<T>() { | |
let observers = new Map<Observer<T>, Resolve<T>>(); | |
return { | |
notify(value: T) { | |
for (let dispatch of observers.values()) { |
import type { Operation } from "./types.ts"; | |
import { action, resource, spawn } from "./mod.ts"; | |
export function all<T>(operations: Operation<T>[]): Operation<T[]> { | |
return resource(function* All(provide) { | |
let scope = yield* useScope(); | |
let tasks = operations.map(op => scope.run(() => op)); | |
let results = yield* map(tasks, task => task); |
import { useState, useRef, useEffect } from "preact/hooks"; | |
import { useCSP } from "$fresh/runtime.ts"; | |
const monacoSrc = 'https://esm.sh/v102/monaco-editor@0.34.1/es2021/monaco-editor.js'; | |
export function Editor() { | |
useCSP(csp => { | |
let scriptSrc = csp.directives.scriptSrc = csp.directives.scriptSrc ?? []; | |
scriptSrc.push(monacoSrc); | |
}); |
export interface ScopeOptions { | |
maxConcurrency: number; | |
} | |
export interface Scope { | |
(operation: Operation<T>): Operation<void>; | |
} | |
export function createScope(options: ScopeOptions): Operation<Scope> { | |
let { maxConcurrency = Infinity } = options; |
// requires deno > 1.25.1 | |
// deno run --allow-env --unstable nunjucks.ts | |
import nunjucks from "npm:nunjucks"; | |
// we use nunjucks itself to create the wrapper function | |
let wrapperFn = nunjucks.compile(` | |
(function() { | |
return function appendTemplates(precompiled) { | |
{% for template in templates %} |
import { google } from 'googleapis' | |
import { Firestore } from '@google-cloud/firestore' | |
import { main, createQueue } from 'effection'; | |
import "path" | |
import _ from "lodash" | |
class DB { |
import { useCallback, useMemo } from 'react'; | |
import { Task, Operation, createQueue, spawn } from 'effection'; | |
import { useOperation } from './use-operation'; | |
/** | |
* Create an event handler that can be used for UI events safely. | |
* If the handler is invoked more than once, the existing task is halted | |
* and a new one is spawned. E.g. | |
* | |
* const AutoCompleter = ({ searchFn }) => { |
import { Operation, run, effect, sleep } from "./mod.ts"; | |
interface Num { | |
value: number; | |
incrementSlowly(): Operation<void>; | |
} | |
function useNum(initial: number) { | |
return effect<Num>(function*(provide) { | |
let value = initial; |
In order to generate html from terminal output, you can use this tool https://github.com/buildkite/terminal-to-html to do it in two steps.
First, run your command, and save it to a raw output file.
$ mycommand > output.term