Skip to content

Commit

Permalink
feat: ghjk deno command
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohe-Am committed Jan 2, 2024
1 parent 0849c0f commit e22ce83
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 45 deletions.
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ repos:
# exclude all generated files
exclude: |
(?x)^(
ghjk.lock|
deno.lock|
ghjk.deno.lock|
gh_action/.*.js
)$
- repo: https://github.com/python-jsonschema/check-jsonschema
Expand Down
5 changes: 4 additions & 1 deletion check.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/env -S ghjk deno run --allow-env --allow-run --allow-read --allow-write=.
// # FIXME: find a way to resolve !DENO_EXEC_PATH in shebangs

import "./setup_logger.ts";
import { $ } from "./utils/mod.ts";

Expand All @@ -7,4 +10,4 @@ const files = (await Array.fromAsync(
}),
)).map((ref) => ref.path.toString());

await $`${Deno.execPath()} check ${files}`;
await $`${Deno.env.get("DENO_EXEC_PATH") ?? "deno"} check ${files}`;
88 changes: 44 additions & 44 deletions ghjk.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
]
],
"version": "0.1.0",
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/act.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/act.ts"
}
},
{
Expand Down Expand Up @@ -116,7 +116,7 @@
"name": "cpy_bs_ghrel"
}
],
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/pipi.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/pipi.ts"
},
"packageName": "pre-commit"
},
Expand Down Expand Up @@ -159,7 +159,7 @@
"name": "zstd_aa"
}
],
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/cpy_bs.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/cpy_bs.ts"
}
}
],
Expand Down Expand Up @@ -451,7 +451,7 @@
]
],
"version": "0.1.0",
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/cargo-binstall.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/cargo-binstall.ts"
},
"defaultInst": {
"portRef": "[email protected]"
Expand Down Expand Up @@ -488,7 +488,7 @@
]
],
"version": "0.1.0",
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/pnpm.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/pnpm.ts"
},
"defaultInst": {
"portRef": "[email protected]"
Expand Down Expand Up @@ -535,7 +535,7 @@
"name": "git_aa"
}
],
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/asdf_plugin_git.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/asdf_plugin_git.ts"
},
"defaultInst": {
"portRef": "[email protected]"
Expand Down Expand Up @@ -577,7 +577,7 @@
"name": "tar_aa"
}
],
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/node.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/node.ts"
},
"defaultInst": {
"portRef": "[email protected]"
Expand Down Expand Up @@ -622,7 +622,7 @@
"name": "zstd_aa"
}
],
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/cpy_bs.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/cpy_bs.ts"
},
"defaultInst": {
"portRef": "[email protected]"
Expand All @@ -642,7 +642,7 @@
"ty": "denoWorker@v1",
"name": "protoc_ghrel",
"version": "0.1.0",
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/protoc.ts",
"moduleSpecifier": "file:///data/home/ghjk/ports/protoc.ts",
"platforms": [
[
"linux",
Expand Down Expand Up @@ -671,7 +671,7 @@
"ty": "denoWorker@v1",
"name": "protoc_ghrel",
"version": "0.1.0",
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/protoc.ts",
"moduleSpecifier": "file:///data/home/ghjk/ports/protoc.ts",
"platforms": [
[
"linux",
Expand Down Expand Up @@ -799,7 +799,7 @@
]
],
"version": "0.1.0",
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/act.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/act.ts"
}
},
{
Expand Down Expand Up @@ -878,7 +878,7 @@
"name": "cpy_bs_ghrel"
}
],
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/pipi.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/pipi.ts"
},
"packageName": "pre-commit"
},
Expand Down Expand Up @@ -921,7 +921,7 @@
"name": "zstd_aa"
}
],
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/cpy_bs.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/cpy_bs.ts"
}
}
],
Expand Down Expand Up @@ -1213,7 +1213,7 @@
]
],
"version": "0.1.0",
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/cargo-binstall.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/cargo-binstall.ts"
},
"defaultInst": {
"portRef": "[email protected]"
Expand Down Expand Up @@ -1250,7 +1250,7 @@
]
],
"version": "0.1.0",
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/pnpm.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/pnpm.ts"
},
"defaultInst": {
"portRef": "[email protected]"
Expand Down Expand Up @@ -1297,7 +1297,7 @@
"name": "git_aa"
}
],
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/asdf_plugin_git.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/asdf_plugin_git.ts"
},
"defaultInst": {
"portRef": "[email protected]"
Expand Down Expand Up @@ -1339,7 +1339,7 @@
"name": "tar_aa"
}
],
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/node.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/node.ts"
},
"defaultInst": {
"portRef": "[email protected]"
Expand Down Expand Up @@ -1384,7 +1384,7 @@
"name": "zstd_aa"
}
],
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/cpy_bs.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/cpy_bs.ts"
},
"defaultInst": {
"portRef": "[email protected]"
Expand All @@ -1394,14 +1394,14 @@
},
"graph": {
"all": {
"[email protected]+720c891b": {
"instId": "[email protected]+720c891b",
"[email protected]+5e64e9e2": {
"instId": "[email protected]+5e64e9e2",
"portRef": "[email protected]",
"config": {
"version": "3.12.0",
"depConfigs": {
"tar_aa": {
"version": "1.35",
"version": "1.34",
"depConfigs": {},
"portRef": "[email protected]"
},
Expand All @@ -1423,17 +1423,17 @@
"portRef": "[email protected]",
"instId": "[email protected]+993fa832"
},
"[email protected]+59889bd0": {
"[email protected]+d9cbe4e3": {
"config": {
"version": "1.35",
"version": "1.34",
"depConfigs": {},
"portRef": "[email protected]"
},
"portRef": "[email protected]",
"instId": "[email protected]+59889bd0"
"instId": "[email protected]+d9cbe4e3"
},
"[email protected]+05783a87": {
"instId": "[email protected]+05783a87",
"[email protected]+94a90a13": {
"instId": "[email protected]+94a90a13",
"portRef": "[email protected]",
"config": {
"version": "3.6.0",
Expand All @@ -1442,7 +1442,7 @@
"version": "3.12.0",
"depConfigs": {
"tar_aa": {
"version": "1.35",
"version": "1.34",
"depConfigs": {},
"portRef": "[email protected]"
},
Expand Down Expand Up @@ -1471,40 +1471,40 @@
},
"user": [
"[email protected]+e9b6de66",
"[email protected]+05783a87",
"[email protected]+720c891b"
"[email protected]+94a90a13",
"[email protected]+5e64e9e2"
],
"indie": [
"[email protected]+993fa832",
"[email protected]+59889bd0",
"[email protected]+d9cbe4e3",
"[email protected]+e9b6de66"
],
"allowed": {},
"revDepEdges": {
"[email protected]+59889bd0": [
"[email protected]+720c891b"
"[email protected]+d9cbe4e3": [
"[email protected]+5e64e9e2"
],
"[email protected]+993fa832": [
"[email protected]+720c891b"
"[email protected]+5e64e9e2"
],
"[email protected]+720c891b": [
"[email protected]+05783a87"
"[email protected]+5e64e9e2": [
"[email protected]+94a90a13"
]
},
"depEdges": {
"[email protected]+720c891b": [
"[email protected]+5e64e9e2": [
[
"[email protected]+59889bd0",
"[email protected]+d9cbe4e3",
"tar_aa"
],
[
"[email protected]+993fa832",
"zstd_aa"
]
],
"[email protected]+05783a87": [
"[email protected]+94a90a13": [
[
"[email protected]+720c891b",
"[email protected]+5e64e9e2",
"cpy_bs_ghrel"
]
]
Expand Down Expand Up @@ -1540,7 +1540,7 @@
]
],
"version": "0.1.0",
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/act.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/act.ts"
},
"[email protected]": {
"ty": "denoWorker@v1",
Expand Down Expand Up @@ -1617,7 +1617,7 @@
"name": "cpy_bs_ghrel"
}
],
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/pipi.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/pipi.ts"
},
"[email protected]": {
"ty": "denoWorker@v1",
Expand Down Expand Up @@ -1657,7 +1657,7 @@
"name": "zstd_aa"
}
],
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/cpy_bs.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/cpy_bs.ts"
},
"[email protected]": {
"ty": "ambientAccess@v1",
Expand Down Expand Up @@ -1747,7 +1747,7 @@
]
],
"version": "0.1.0",
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/protoc.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/protoc.ts"
}
}
],
Expand Down Expand Up @@ -1849,7 +1849,7 @@
]
],
"version": "0.1.0",
"moduleSpecifier": "file:///home/asdf/repos/ecma/ghjk/ports/protoc.ts"
"moduleSpecifier": "file:///data/home/ghjk/ports/protoc.ts"
}
}
},
Expand Down
13 changes: 13 additions & 0 deletions host/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export interface CliArgs {
configPath: string;
}

// FIXME: subset of ghjk commands should be functional
// even if config file not found
export async function cli(args: CliArgs) {
const configPath = std_path.normalize(
std_path.resolve(Deno.cwd(), args.configPath),
Expand Down Expand Up @@ -131,6 +133,17 @@ export async function cli(args: CliArgs) {
console.log(envDir);
}),
),
)
.command(
"deno",
new cliffy_cmd.Command()
.description("Access the deno cli used by ghjk.")
.useRawArgs()
.action(async function (_, ...args) {
logger().debug(args);
await $.raw`${Deno.execPath()} ${args}`
.env("DENO_EXEC_PATH", Deno.execPath());
}),
);

for (const [name, subcmd] of Object.entries(subCommands)) {
Expand Down

0 comments on commit e22ce83

Please sign in to comment.