-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Version bumps and config tweaks (#36)
- Loading branch information
Showing
35 changed files
with
136 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[email protected]/apex.ts | ||
deno install -A -f -n apex https://deno.land/x/[email protected]/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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/bin/sh | ||
# deno install mocker | ||
exec deno run --allow-all --unstable './apex.ts' "$@" | ||
exec deno run --allow-all './apex.ts' "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/[email protected]/log/mod.ts"; | ||
import { | ||
Command, | ||
CompletionsCommand, | ||
GithubProvider, | ||
HelpCommand, | ||
UpgradeCommand, | ||
} from "./src/deps/cliffy.ts"; | ||
import * as log from "https://deno.land/[email protected]/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" })], | ||
}), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/[email protected]/mod.ts"; | ||
import { decode, encode } from "./utf8.ts"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
export * from "https://deno.land/x/[email protected]/mod.ts"; | ||
export * from "https://deno.land/x/[email protected]/command/mod.ts"; | ||
export * from "https://deno.land/x/[email protected]/prompt/mod.ts"; | ||
export * from "https://deno.land/x/[email protected]/table/mod.ts"; | ||
export * from "https://deno.land/x/[email protected]/ansi/mod.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import * as apex from "https://deno.land/x/[email protected].3/mod.ts"; | ||
import * as model from "https://deno.land/x/[email protected].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/[email protected].5/ast.ts"; | ||
import * as model from "https://deno.land/x/[email protected].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<Configuration> { | ||
// make a copy of our original config to protect against mutation | ||
|
@@ -148,16 +148,16 @@ 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 { | ||
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) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/[email protected]/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; | ||
}); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import * as path from "https://deno.land/[email protected]/path/mod.ts"; | ||
import home_dir from "https://deno.land/x/[email protected]/home_dir/mod.ts"; | ||
import * as yaml from "https://deno.land/[email protected]/yaml/mod.ts"; | ||
import * as log from "https://deno.land/[email protected]/log/mod.ts"; | ||
import * as apex from "https://deno.land/x/[email protected]/mod.ts"; | ||
import * as path from "https://deno.land/[email protected]/path/mod.ts"; | ||
import home_dir from "https://deno.land/x/[email protected]/home_dir/mod.ts"; | ||
import * as yaml from "https://deno.land/[email protected]/yaml/mod.ts"; | ||
import * as log from "https://deno.land/[email protected]/log/mod.ts"; | ||
import * as apex from "https://deno.land/x/[email protected]/mod.ts"; | ||
import * as ast from "https://deno.land/x/[email protected]/ast.ts"; | ||
|
||
import { | ||
Configuration, | ||
|
@@ -223,9 +224,9 @@ export function flatten(prefix: string, obj: unknown): unknown { | |
} | ||
} | ||
|
||
export async function readSpec(spec?: string): Promise<apex.ast.Document> { | ||
export async function readSpec(spec?: string): Promise<ast.Document> { | ||
if (!spec) { | ||
return new apex.ast.Document(undefined, []); | ||
return new ast.Document(undefined, []); | ||
} | ||
try { | ||
const apexSource = await Deno.readTextFile( | ||
|
Oops, something went wrong.