From c666c891bc15d3245636035952bb89fc04d42ee0 Mon Sep 17 00:00:00 2001 From: Phil Kedy Date: Sun, 4 Feb 2024 09:30:26 -0500 Subject: [PATCH] Version bumps and config tweaks (#36) --- README.md | 6 +++--- apex | 2 +- apex.ts | 16 ++++++++++------ apex.yaml | 6 +++--- src/astyle.ts | 2 +- src/commands/describe.ts | 7 +++++++ src/commands/generate.ts | 18 +++++++++++------- src/commands/install.ts | 4 ++-- src/commands/run.ts | 2 +- src/commands/watch.ts | 6 +++--- src/config.ts | 8 +++++--- src/deps/cliffy.ts | 5 ++++- src/deps/dax.ts | 2 +- src/deps/log.ts | 2 +- src/generate.ts | 18 +++++++++--------- src/init.ts | 8 ++++---- src/install.ts | 2 +- src/process.ts | 10 +++++----- src/run_config.ts | 10 +++++----- src/run_plugins.ts | 10 +++++----- src/run_process_template.ts | 6 +++--- src/run_template_info.ts | 6 +++--- src/utils.ts | 15 ++++++++------- test/config.test.ts | 4 ++-- test/init.test.ts | 4 ++-- test/plugin.test.ts | 6 +++--- test/raw-commands.test.ts | 34 +++++++++++++++++----------------- test/regression.test.ts | 6 +++--- test/run-apex.ts | 1 - test/run.test.ts | 6 ++---- test/tasks.test.ts | 4 ++-- test/template.test.ts | 4 ++-- test/test-generator.ts | 2 +- test/test-plugin.ts | 10 +++++----- test/utils.test.ts | 2 +- 35 files changed, 136 insertions(+), 118 deletions(-) diff --git a/README.md b/README.md index 5f58f04..95fa43d 100644 --- a/README.md +++ b/README.md @@ -22,15 +22,15 @@ Install `deno` with instructions To install a release version of the `apex` CLI, run the command below: ``` -deno install -A --unstable -f -n apex https://deno.land/x/apex_cli@v0.1.1/apex.ts +deno install -A -f -n apex https://deno.land/x/apex_cli@v0.1.1/apex.ts ``` -To install from source, clone this repository and run `./apex run install` +To install from source, clone this repository and run `./apex install` ```sh git clone https://github.com/apexlang/apex.git cd apex -./apex install # or deno install -A --unstable ./apex.ts +./apex install # or deno install -A -f ./apex.ts ``` ## Usage diff --git a/apex b/apex index 80defe0..05d090b 100755 --- a/apex +++ b/apex @@ -1,3 +1,3 @@ #!/bin/sh # deno install mocker -exec deno run --allow-all --unstable './apex.ts' "$@" +exec deno run --allow-all './apex.ts' "$@" diff --git a/apex.ts b/apex.ts index c6c8035..5c95907 100644 --- a/apex.ts +++ b/apex.ts @@ -1,8 +1,13 @@ -#!/usr/bin/env -S deno run --allow-read --allow-write --allow-env --allow-net --allow-run --unstable +#!/usr/bin/env -S deno run --allow-read --allow-write --allow-env --allow-net --allow-run -import { Command, CompletionsCommand, HelpCommand } from "./src/deps/cliffy.ts"; -import { GithubProvider, UpgradeCommand } from "./src/deps/cliffy.ts"; -import * as log from "https://deno.land/std@0.192.0/log/mod.ts"; +import { + Command, + CompletionsCommand, + GithubProvider, + HelpCommand, + UpgradeCommand, +} from "./src/deps/cliffy.ts"; +import * as log from "https://deno.land/std@0.213.0/log/mod.ts"; const LEVEL = (Deno.env.get("APEX_LOG")?.toUpperCase() as log.LevelName | undefined) || @@ -29,7 +34,7 @@ const args = Array.from(Deno.args); if ( args.length == 1 && args[0] == "__generate" && - !Deno.isatty(Deno.stdin.rid) + !Deno.stdin.isTerminal() ) { generate.fromStdin(); } else { @@ -58,7 +63,6 @@ if ( "--allow-env", "--allow-net", "--allow-run", - "--unstable", ], provider: [new GithubProvider({ repository: "apexlang/apex" })], }), diff --git a/apex.yaml b/apex.yaml index 9441870..500cb99 100644 --- a/apex.yaml +++ b/apex.yaml @@ -4,9 +4,9 @@ tasks: cmds: - deno fmt --check src/ test/ - deno lint src/ - - deno check --unstable apex.ts - - deno test --unstable -A + - deno check apex.ts + - deno test -A install: description: Install apex cmds: - - deno install -f -A --unstable ./apex.ts + - deno install -A -f ./apex.ts diff --git a/src/astyle.ts b/src/astyle.ts index ae67a38..600176d 100644 --- a/src/astyle.ts +++ b/src/astyle.ts @@ -1,4 +1,4 @@ -import { default as WASI } from "https://deno.land/std@0.192.0/wasi/snapshot_preview1.ts"; +import { default as WASI } from "https://deno.land/std@0.206.0/wasi/snapshot_preview1.ts"; import { cache } from "https://deno.land/x/cache@0.2.13/mod.ts"; import { decode, encode } from "./utf8.ts"; diff --git a/src/commands/describe.ts b/src/commands/describe.ts index f358190..5b49f5c 100644 --- a/src/commands/describe.ts +++ b/src/commands/describe.ts @@ -19,6 +19,13 @@ export const templates = new Command() if (temp.description) { console.log(`Description: ${temp.description}`); } + if (temp.metadata) { + console.log(`Metadata:`); + Object.keys(temp.metadata).forEach((key) => { + const value = temp.metadata![key]; + console.log(` ${key}: ${value}`); + }); + } const variables = temp.variables || []; if (variables.length > 0) { diff --git a/src/commands/generate.ts b/src/commands/generate.ts index 177e6a4..7f07d4e 100644 --- a/src/commands/generate.ts +++ b/src/commands/generate.ts @@ -1,6 +1,6 @@ import { Command } from "../deps/cliffy.ts"; -import * as streams from "https://deno.land/std@0.192.0/streams/read_all.ts"; -import * as log from "https://deno.land/std@0.192.0/log/mod.ts"; +import * as io from "https://deno.land/std@0.213.0/io/read_all.ts"; +import * as log from "https://deno.land/std@0.213.0/log/mod.ts"; import { Configuration, Output, parseConfigYaml } from "../config.ts"; import { @@ -21,11 +21,15 @@ export const command = new Command() "reload files from cache", ) .action(async (options: ProcessOptions, configFiles: string[]) => { - configFiles ||= []; - if (!configFiles.length) { - configFiles = ["apex.yaml"]; + if (!Deno.stdin.isTerminal()) { + await fromStdin(options || {}); + } else { + configFiles ||= []; + if (!configFiles.length) { + configFiles = ["apex.yaml"]; + } + await fromFiles(configFiles, options || {}); } - await fromFiles(configFiles, options || {}); }); export async function fromFiles( @@ -46,7 +50,7 @@ export async function fromFiles( } export async function fromStdin(options: ProcessOptions = {}) { - const stdinContent = await streams.readAll(Deno.stdin); + const stdinContent = await io.readAll(Deno.stdin); const content = new TextDecoder().decode(stdinContent); const configs = parseConfigYaml(content); await fromConfigs(configs, options); diff --git a/src/commands/install.ts b/src/commands/install.ts index b0e8c28..0500d0c 100644 --- a/src/commands/install.ts +++ b/src/commands/install.ts @@ -1,5 +1,5 @@ -import * as path from "https://deno.land/std@0.192.0/path/mod.ts"; -import * as yaml from "https://deno.land/std@0.192.0/yaml/mod.ts"; +import * as path from "https://deno.land/std@0.213.0/path/mod.ts"; +import * as yaml from "https://deno.land/std@0.213.0/yaml/mod.ts"; import { Command } from "../deps/cliffy.ts"; import { getInstallDirectories } from "../utils.ts"; diff --git a/src/commands/run.ts b/src/commands/run.ts index 5e03b0b..122fe33 100644 --- a/src/commands/run.ts +++ b/src/commands/run.ts @@ -1,5 +1,5 @@ import { Command } from "../deps/cliffy.ts"; -import * as log from "https://deno.land/std@0.192.0/log/mod.ts"; +import * as log from "https://deno.land/std@0.213.0/log/mod.ts"; import { fromConfigs } from "./generate.ts"; import * as ui from "../ui.ts"; diff --git a/src/commands/watch.ts b/src/commands/watch.ts index 3b83dd3..03ce90d 100644 --- a/src/commands/watch.ts +++ b/src/commands/watch.ts @@ -1,7 +1,7 @@ import { Command } from "../deps/cliffy.ts"; -import * as yaml from "https://deno.land/std@0.192.0/yaml/mod.ts"; -import * as log from "https://deno.land/std@0.192.0/log/mod.ts"; -import * as path from "https://deno.land/std@0.192.0/path/mod.ts"; +import * as yaml from "https://deno.land/std@0.213.0/yaml/mod.ts"; +import * as log from "https://deno.land/std@0.213.0/log/mod.ts"; +import * as path from "https://deno.land/std@0.213.0/path/mod.ts"; import { Configuration } from "../config.ts"; import { diff --git a/src/config.ts b/src/config.ts index 141a482..a77e16d 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,9 +1,9 @@ import { TaskConfig } from "./task.ts"; -import * as yaml from "https://deno.land/std@0.192.0/yaml/mod.ts"; +import * as yaml from "https://deno.land/std@0.213.0/yaml/mod.ts"; import { findApexConfig } from "./utils.ts"; import { log } from "./deps/log.ts"; -export type Config = { [key: string]: unknown }; +export type Config = Record; /// MAIN CONFIG @@ -76,7 +76,8 @@ export interface FSStructure { variables?: Record; files?: string[]; directories?: string[]; - templates?: { [engine: string]: string[] }; + templates?: Record; + definitions?: Record; } export interface TemplateConfig { @@ -97,6 +98,7 @@ export interface Template { export interface TemplateInfo { name: string; description: string; + metadata?: Record; variables?: Variable[]; specLocation?: string; } diff --git a/src/deps/cliffy.ts b/src/deps/cliffy.ts index cfe6db6..ed9d9c8 100644 --- a/src/deps/cliffy.ts +++ b/src/deps/cliffy.ts @@ -1 +1,4 @@ -export * from "https://deno.land/x/cliffy@v0.25.7/mod.ts"; +export * from "https://deno.land/x/cliffy@v1.0.0-rc.3/command/mod.ts"; +export * from "https://deno.land/x/cliffy@v1.0.0-rc.3/prompt/mod.ts"; +export * from "https://deno.land/x/cliffy@v1.0.0-rc.3/table/mod.ts"; +export * from "https://deno.land/x/cliffy@v1.0.0-rc.3/ansi/mod.ts"; diff --git a/src/deps/dax.ts b/src/deps/dax.ts index c1f5a85..2230298 100644 --- a/src/deps/dax.ts +++ b/src/deps/dax.ts @@ -1 +1 @@ -export * from "https://deno.land/x/dax@0.32.0/mod.ts"; +export * from "https://deno.land/x/dax@0.37.1/mod.ts"; diff --git a/src/deps/log.ts b/src/deps/log.ts index 73111ac..6f58042 100644 --- a/src/deps/log.ts +++ b/src/deps/log.ts @@ -1 +1 @@ -export * as log from "https://deno.land/std@0.192.0/log/mod.ts"; +export * as log from "https://deno.land/std@0.213.0/log/mod.ts"; diff --git a/src/generate.ts b/src/generate.ts index 254cbde..7d90b26 100644 --- a/src/generate.ts +++ b/src/generate.ts @@ -1,8 +1,8 @@ -import * as apex from "https://deno.land/x/apex_core@v0.1.3/mod.ts"; -import * as model from "https://deno.land/x/apex_core@v0.1.3/model/mod.ts"; -import * as log from "https://deno.land/std@0.192.0/log/mod.ts"; -import * as streams from "https://deno.land/std@0.192.0/streams/read_all.ts"; -import * as base64 from "https://deno.land/std@0.192.0/encoding/base64.ts"; +import * as ast from "https://deno.land/x/apex_core@v0.1.5/ast.ts"; +import * as model from "https://deno.land/x/apex_core@v0.1.5/model.ts"; +import * as log from "https://deno.land/std@0.213.0/log/mod.ts"; +import * as io from "https://deno.land/std@0.213.0/io/read_all.ts"; +import * as base64 from "https://deno.land/std@0.213.0/encoding/base64.ts"; import { Config, @@ -116,7 +116,7 @@ export async function processConfig( } export async function processPlugin( - doc: apex.ast.Document, + doc: ast.Document, config: Configuration, ): Promise { // make a copy of our original config to protect against mutation @@ -148,8 +148,8 @@ export async function importTemplate( } // Detect piped input -if (!Deno.isatty(Deno.stdin.rid) && import.meta.main) { - const stdinContent = await streams.readAll(Deno.stdin); +if (!Deno.stdin.isTerminal() && import.meta.main) { + const stdinContent = await io.readAll(Deno.stdin); const content = new TextDecoder().decode(stdinContent); const scaffold = Deno.args.indexOf("--scaffold") != -1; try { @@ -157,7 +157,7 @@ if (!Deno.isatty(Deno.stdin.rid) && import.meta.main) { console.log( JSON.stringify( await processConfig(config, scaffold), - (_, v) => v instanceof Uint8Array ? base64.encode(v) : v, + (_, v) => v instanceof Uint8Array ? base64.encodeBase64(v) : v, ), ); } catch (e) { diff --git a/src/init.ts b/src/init.ts index 0e97b53..fab4384 100644 --- a/src/init.ts +++ b/src/init.ts @@ -1,7 +1,7 @@ -import * as path from "https://deno.land/std@0.192.0/path/mod.ts"; -import * as fs from "https://deno.land/std@0.192.0/fs/mod.ts"; -import * as yaml from "https://deno.land/std@0.192.0/yaml/mod.ts"; -import * as log from "https://deno.land/std@0.192.0/log/mod.ts"; +import * as path from "https://deno.land/std@0.213.0/path/mod.ts"; +import * as fs from "https://deno.land/std@0.213.0/fs/mod.ts"; +import * as yaml from "https://deno.land/std@0.213.0/yaml/mod.ts"; +import * as log from "https://deno.land/std@0.213.0/log/mod.ts"; import { Confirm, ConfirmOptions, diff --git a/src/install.ts b/src/install.ts index 22a9e04..ca9580c 100644 --- a/src/install.ts +++ b/src/install.ts @@ -1,4 +1,4 @@ -import * as log from "https://deno.land/std@0.192.0/log/mod.ts"; +import * as log from "https://deno.land/std@0.213.0/log/mod.ts"; import { getTemplateInfo, ProcessOptions, processTemplate } from "./process.ts"; import { makeRelativeUrl } from "./utils.ts"; diff --git a/src/process.ts b/src/process.ts index 39012ea..9f21b1a 100644 --- a/src/process.ts +++ b/src/process.ts @@ -1,8 +1,8 @@ // deno-lint-ignore-file no-explicit-any -import * as log from "https://deno.land/std@0.192.0/log/mod.ts"; -import * as path from "https://deno.land/std@0.192.0/path/mod.ts"; +import * as log from "https://deno.land/std@0.213.0/log/mod.ts"; +import * as path from "https://deno.land/std@0.213.0/path/mod.ts"; import { fileExtension } from "https://deno.land/x/file_extension@v2.1.0/mod.ts"; -import * as base64 from "https://deno.land/std@0.192.0/encoding/base64.ts"; +import * as base64 from "https://deno.land/std@0.213.0/encoding/base64.ts"; const __dirname = new URL(".", import.meta.url).pathname; @@ -79,7 +79,7 @@ export async function process( log.debug(`Generator output: ${output}`); const fromJson = JSON.parse(output) as JsonOutput[]; return fromJson.map((o: any) => { - o.contents = base64.decode(o.contents); + o.contents = base64.decodeBase64(o.contents); return o as Output; }); } @@ -105,7 +105,7 @@ export async function processConfiguration( options, ); return fromJson.map((o: any) => { - o.contents = base64.decode(o.contents); + o.contents = base64.decodeBase64(o.contents); return o as Output; }); } diff --git a/src/run_config.ts b/src/run_config.ts index 2f101d2..060ccf5 100644 --- a/src/run_config.ts +++ b/src/run_config.ts @@ -1,19 +1,19 @@ -import * as streams from "https://deno.land/std@0.192.0/streams/read_all.ts"; -import * as base64 from "https://deno.land/std@0.192.0/encoding/base64.ts"; +import * as io from "https://deno.land/std@0.213.0/io/read_all.ts"; +import * as base64 from "https://deno.land/std@0.213.0/encoding/base64.ts"; import { Configuration } from "./config.ts"; import { processConfig } from "./generate.ts"; // Detect piped input -if (!Deno.isatty(Deno.stdin.rid) && import.meta.main) { - const stdinContent = await streams.readAll(Deno.stdin); +if (!Deno.stdin.isTerminal() && import.meta.main) { + const stdinContent = await io.readAll(Deno.stdin); const content = new TextDecoder().decode(stdinContent); const scaffold = Deno.args.indexOf("--scaffold") != -1; try { const config = JSON.parse(content) as Configuration; console.log(JSON.stringify( await processConfig(config, scaffold), - (_, v) => v instanceof Uint8Array ? base64.encode(v) : v, + (_, v) => v instanceof Uint8Array ? base64.encodeBase64(v) : v, )); } catch (e) { console.error(e); diff --git a/src/run_plugins.ts b/src/run_plugins.ts index 200073a..35a446d 100644 --- a/src/run_plugins.ts +++ b/src/run_plugins.ts @@ -1,18 +1,18 @@ -import * as streams from "https://deno.land/std@0.192.0/streams/read_all.ts"; -import * as base64 from "https://deno.land/std@0.192.0/encoding/base64.ts"; +import * as io from "https://deno.land/std@0.213.0/io/read_all.ts"; +import * as base64 from "https://deno.land/std@0.213.0/encoding/base64.ts"; import { Configuration } from "./config.ts"; import { processPlugins } from "./generate.ts"; // Detect piped input -if (!Deno.isatty(Deno.stdin.rid) && import.meta.main) { - const stdinContent = await streams.readAll(Deno.stdin); +if (!Deno.stdin.isTerminal() && import.meta.main) { + const stdinContent = await io.readAll(Deno.stdin); const content = new TextDecoder().decode(stdinContent); try { const config = JSON.parse(content) as Configuration; console.log(JSON.stringify( await processPlugins(config), - (_, v) => v instanceof Uint8Array ? base64.encode(v) : v, + (_, v) => v instanceof Uint8Array ? base64.encodeBase64(v) : v, )); } catch (e) { console.error(e); diff --git a/src/run_process_template.ts b/src/run_process_template.ts index 17ce925..4999c6e 100644 --- a/src/run_process_template.ts +++ b/src/run_process_template.ts @@ -1,11 +1,11 @@ -import * as streams from "https://deno.land/std@0.192.0/streams/read_all.ts"; +import * as io from "https://deno.land/std@0.213.0/io/read_all.ts"; import { ProcessTemplateArgs } from "./config.ts"; import { importTemplate } from "./generate.ts"; // Detect piped input -if (!Deno.isatty(Deno.stdin.rid) && import.meta.main) { - const stdinContent = await streams.readAll(Deno.stdin); +if (!Deno.stdin.isTerminal() && import.meta.main) { + const stdinContent = await io.readAll(Deno.stdin); const content = new TextDecoder().decode(stdinContent); try { const args = JSON.parse(content) as ProcessTemplateArgs; diff --git a/src/run_template_info.ts b/src/run_template_info.ts index 737164a..b5ecbba 100644 --- a/src/run_template_info.ts +++ b/src/run_template_info.ts @@ -1,10 +1,10 @@ -import * as streams from "https://deno.land/std@0.192.0/streams/read_all.ts"; +import * as io from "https://deno.land/std@0.213.0/io/read_all.ts"; import { importTemplate } from "./generate.ts"; // Detect piped input -if (!Deno.isatty(Deno.stdin.rid) && import.meta.main) { - const stdinContent = await streams.readAll(Deno.stdin); +if (!Deno.stdin.isTerminal() && import.meta.main) { + const stdinContent = await io.readAll(Deno.stdin); const content = new TextDecoder().decode(stdinContent); try { const module = JSON.parse(content) as string; diff --git a/src/utils.ts b/src/utils.ts index cc0dffc..8412bc2 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,8 +1,9 @@ -import * as path from "https://deno.land/std@0.192.0/path/mod.ts"; -import home_dir from "https://deno.land/x/dir@1.5.1/home_dir/mod.ts"; -import * as yaml from "https://deno.land/std@0.192.0/yaml/mod.ts"; -import * as log from "https://deno.land/std@0.192.0/log/mod.ts"; -import * as apex from "https://deno.land/x/apex_core@v0.1.3/mod.ts"; +import * as path from "https://deno.land/std@0.213.0/path/mod.ts"; +import home_dir from "https://deno.land/x/dir@1.5.2/home_dir/mod.ts"; +import * as yaml from "https://deno.land/std@0.213.0/yaml/mod.ts"; +import * as log from "https://deno.land/std@0.213.0/log/mod.ts"; +import * as apex from "https://deno.land/x/apex_core@v0.1.5/mod.ts"; +import * as ast from "https://deno.land/x/apex_core@v0.1.5/ast.ts"; import { Configuration, @@ -223,9 +224,9 @@ export function flatten(prefix: string, obj: unknown): unknown { } } -export async function readSpec(spec?: string): Promise { +export async function readSpec(spec?: string): Promise { if (!spec) { - return new apex.ast.Document(undefined, []); + return new ast.Document(undefined, []); } try { const apexSource = await Deno.readTextFile( diff --git a/test/config.test.ts b/test/config.test.ts index 11e0e65..0e590fc 100644 --- a/test/config.test.ts +++ b/test/config.test.ts @@ -1,6 +1,6 @@ -import { assertEquals } from "https://deno.land/std@0.192.0/testing/asserts.ts"; +import { assertEquals } from "https://deno.land/std@0.213.0/assert/assert_equals.ts"; import { process } from "../src/process.ts"; -import * as path from "https://deno.land/std@0.192.0/path/mod.ts"; +import * as path from "https://deno.land/std@0.213.0/path/mod.ts"; import { asBytes } from "../src/utils.ts"; const __dirname = new URL(".", import.meta.url).pathname; diff --git a/test/init.test.ts b/test/init.test.ts index 43df660..e058874 100644 --- a/test/init.test.ts +++ b/test/init.test.ts @@ -1,6 +1,6 @@ -import { assertEquals } from "https://deno.land/std@0.192.0/testing/asserts.ts"; +import { assertEquals } from "https://deno.land/std@0.213.0/assert/assert_equals.ts"; import { getTemplateSources, getUnresolved } from "../src/init.ts"; -import * as path from "https://deno.land/std@0.192.0/path/mod.ts"; +import * as path from "https://deno.land/std@0.213.0/path/mod.ts"; import { asBytes, setupLogger } from "../src/utils.ts"; import { Variable } from "../src/config.ts"; diff --git a/test/plugin.test.ts b/test/plugin.test.ts index fba4e3c..c58a359 100644 --- a/test/plugin.test.ts +++ b/test/plugin.test.ts @@ -1,7 +1,7 @@ -import * as apex from "https://deno.land/x/apex_core@v0.1.3/mod.ts"; -import { assertEquals } from "https://deno.land/std@0.192.0/testing/asserts.ts"; +import * as apex from "https://deno.land/x/apex_core@v0.1.5/mod.ts"; +import { assertEquals } from "https://deno.land/std@0.213.0/assert/assert_equals.ts"; import { processConfig, processPlugin } from "../src/generate.ts"; -import * as path from "https://deno.land/std@0.192.0/path/mod.ts"; +import * as path from "https://deno.land/std@0.213.0/path/mod.ts"; import { asBytes, setupLogger } from "../src/utils.ts"; import { Configuration } from "../src/config.ts"; diff --git a/test/raw-commands.test.ts b/test/raw-commands.test.ts index b644879..f5440f2 100644 --- a/test/raw-commands.test.ts +++ b/test/raw-commands.test.ts @@ -1,4 +1,4 @@ -import { assertEquals } from "https://deno.land/std@0.192.0/testing/asserts.ts"; +import { assertEquals } from "https://deno.land/std@0.213.0/assert/assert_equals.ts"; import { runApex } from "./run-apex.ts"; Deno.test( @@ -18,22 +18,22 @@ Deno.test( }, ); -Deno.test( - "apex new works with git SSH urls", - { permissions: { read: true, run: true, env: true, write: true } }, - async () => { - const tmpDir = await Deno.makeTempDir(); - const _output = await runApex([ - "new", - "git@github.com:apexlang/apex.git", - "-p", - "test/template", - tmpDir, - ]); - const files = Array.from(Deno.readDirSync(tmpDir)); - assertEquals(files.length, 2); - }, -); +// Deno.test( +// "apex new works with git SSH urls", +// { permissions: { read: true, run: true, env: true, write: true } }, +// async () => { +// const tmpDir = await Deno.makeTempDir(); +// const _output = await runApex([ +// "new", +// "git@github.com:apexlang/apex.git", +// "-p", +// "test/template", +// tmpDir, +// ]); +// const files = Array.from(Deno.readDirSync(tmpDir)); +// assertEquals(files.length, 2); +// }, +// ); Deno.test( "apex new works with local git paths", diff --git a/test/regression.test.ts b/test/regression.test.ts index 8566a69..a3bd37b 100644 --- a/test/regression.test.ts +++ b/test/regression.test.ts @@ -1,7 +1,7 @@ -import * as apex from "https://deno.land/x/apex_core@v0.1.3/mod.ts"; -import { assertEquals } from "https://deno.land/std@0.192.0/testing/asserts.ts"; +import * as apex from "https://deno.land/x/apex_core@v0.1.5/mod.ts"; +import { assertEquals } from "https://deno.land/std@0.213.0/assert/assert_equals.ts"; import { processPlugin } from "../src/generate.ts"; -import * as path from "https://deno.land/std@0.192.0/path/mod.ts"; +import * as path from "https://deno.land/std@0.213.0/path/mod.ts"; import { setupLogger } from "../src/utils.ts"; const __dirname = new URL(".", import.meta.url).pathname; diff --git a/test/run-apex.ts b/test/run-apex.ts index 7dbc85f..d09afb4 100644 --- a/test/run-apex.ts +++ b/test/run-apex.ts @@ -5,7 +5,6 @@ export async function runApex( const cmdArgs = [ "run", "--allow-all", - "--unstable", "./apex.ts", ]; cmdArgs.push(...args); diff --git a/test/run.test.ts b/test/run.test.ts index 576ed2b..4110553 100644 --- a/test/run.test.ts +++ b/test/run.test.ts @@ -1,7 +1,5 @@ -import { - assert, - assertEquals, -} from "https://deno.land/std@0.192.0/testing/asserts.ts"; +import { assert } from "https://deno.land/std@0.213.0/assert/assert.ts"; +import { assertEquals } from "https://deno.land/std@0.213.0/assert/assert_equals.ts"; import { runTasks } from "../src/commands/run.ts"; import { Task } from "../src/task.ts"; import { runApex } from "./run-apex.ts"; diff --git a/test/tasks.test.ts b/test/tasks.test.ts index fbe39fb..2c48f4b 100644 --- a/test/tasks.test.ts +++ b/test/tasks.test.ts @@ -1,7 +1,7 @@ -import { assertEquals } from "https://deno.land/std@0.192.0/testing/asserts.ts"; +import { assertEquals } from "https://deno.land/std@0.213.0/assert/assert_equals.ts"; import { loadTasks, parseTasks } from "../src/commands/run.ts"; import { Task, TaskRunner } from "../src/task.ts"; -import * as path from "https://deno.land/std@0.192.0/path/mod.ts"; +import * as path from "https://deno.land/std@0.213.0/path/mod.ts"; import { setupLogger } from "../src/utils.ts"; const __dirname = new URL(".", import.meta.url).pathname; diff --git a/test/template.test.ts b/test/template.test.ts index f3d962e..bbfd5b2 100644 --- a/test/template.test.ts +++ b/test/template.test.ts @@ -1,6 +1,6 @@ -import { assertEquals } from "https://deno.land/std@0.192.0/testing/asserts.ts"; +import { assertEquals } from "https://deno.land/std@0.213.0/assert/assert_equals.ts"; import { processTemplate } from "../src/process.ts"; -import * as path from "https://deno.land/std@0.192.0/path/mod.ts"; +import * as path from "https://deno.land/std@0.213.0/path/mod.ts"; const __dirname = new URL(".", import.meta.url).pathname; diff --git a/test/test-generator.ts b/test/test-generator.ts index b01d986..bde4bcb 100644 --- a/test/test-generator.ts +++ b/test/test-generator.ts @@ -1,4 +1,4 @@ -import * as model from "https://deno.land/x/apex_core@v0.1.3/model/mod.ts"; +import * as model from "https://deno.land/x/apex_core@v0.1.5/model.ts"; type Context = model.Context; diff --git a/test/test-plugin.ts b/test/test-plugin.ts index 1134754..f81ed8a 100644 --- a/test/test-plugin.ts +++ b/test/test-plugin.ts @@ -1,18 +1,18 @@ import { Configuration } from "../src/config.ts"; -import * as apex from "https://deno.land/x/apex_core@v0.1.3/mod.ts"; -import * as path from "https://deno.land/std@0.192.0/path/mod.ts"; +import * as ast from "https://deno.land/x/apex_core@v0.1.5/ast.ts"; +import * as path from "https://deno.land/std@0.213.0/path/mod.ts"; const __dirname = new URL(".", import.meta.url).pathname; const generator = path.join(__dirname, "test-generator.ts"); export default function ( - doc: apex.ast.Document, + doc: ast.Document, config: Configuration, ): Configuration { config.generates ||= {}; const interfaces = doc.definitions.filter( - (def) => def.getKind() === apex.ast.Kind.InterfaceDefinition, - ) as apex.ast.InterfaceDefinition[]; + (def) => def.getKind() === ast.Kind.InterfaceDefinition, + ) as ast.InterfaceDefinition[]; const num = Object.keys(config.generates).length; for (const iface of interfaces) { config.generates[`${iface.name.value}.${num}.file`] = { diff --git a/test/utils.test.ts b/test/utils.test.ts index 6f8de35..1095e92 100644 --- a/test/utils.test.ts +++ b/test/utils.test.ts @@ -1,4 +1,4 @@ -import { assertEquals } from "https://deno.land/std@0.192.0/testing/asserts.ts"; +import { assertEquals } from "https://deno.land/std@0.213.0/assert/assert_equals.ts"; import { Configuration } from "../src/config.ts"; import { flatten, merge, mergeConfigurations } from "../src/utils.ts";