Skip to content

Commit

Permalink
fix: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohe-Am committed Jan 12, 2025
1 parent f8549e0 commit ee915c1
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 95 deletions.
120 changes: 64 additions & 56 deletions .ghjk/lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,67 @@
"portRef": "[email protected]",
"crateName": "cargo-bloat",
"specifiedVersion": false
},
"bciqn6ydvecd55jxljsewhxy7qg6pjqq4kkubhdh3hrugn4oy4kccuby": {
"version": "1.1.3",
"buildDepConfigs": {
"curl_aa": {
"version": "8.9.1",
"buildDepConfigs": {},
"portRef": "[email protected]",
"specifiedVersion": false
},
"git_aa": {
"version": "2.47.1",
"buildDepConfigs": {},
"portRef": "[email protected]",
"specifiedVersion": false
},
"asdf_plugin_git": {
"version": "80fc844dae",
"buildDepConfigs": {
"git_aa": {
"version": "2.47.1",
"buildDepConfigs": {},
"portRef": "[email protected]",
"specifiedVersion": false
}
},
"portRef": "[email protected]",
"pluginRepo": "https://github.com/asdf-community/asdf-duckdb",
"specifiedVersion": false
}
},
"resolutionDepConfigs": {
"asdf_plugin_git": {
"pluginRepo": "https://github.com/asdf-community/asdf-duckdb",
"portRef": "[email protected]"
}
},
"portRef": "[email protected]",
"pluginRepo": "https://github.com/asdf-community/asdf-duckdb",
"installType": "version",
"specifiedVersion": false
},
"bciqohwpm24tt7amjzlzh4lbmvwoit2g47v2w362bq3wyiu5bxe4ky2y": {
"version": "80fc844dae",
"buildDepConfigs": {
"git_aa": {
"version": "2.47.1",
"buildDepConfigs": {},
"portRef": "[email protected]",
"specifiedVersion": false
}
},
"portRef": "[email protected]",
"pluginRepo": "https://github.com/asdf-community/asdf-duckdb",
"specifiedVersion": false
},
"bciqlyn7enh4hwylipzztkulahfoybky5vwjznltnlwfzvtisttr6mhi": {
"version": "2.47.1",
"buildDepConfigs": {},
"portRef": "[email protected]",
"specifiedVersion": true
}
}
},
Expand All @@ -354,8 +415,7 @@
"bciqe72molvtvcuj3tuh47ziue2oqd6t4qetxn3rsoa764ofup6uwjmi",
"bciqe4zlekl4uqqbhxunac7br24mrf6cdpfrfblahqa4vrgaqjujcl4i",
"bciqpu4klxr3hl6ujhmflrlfd3dxp47ijq26mnathb26ojzwkeggy5ii",
"bciqelae2kzmf7umbo62flzq2mnlhnc4ilbfmn4va2fzrqwx7w7zusji",
"bciqjucge6yrzcawqzcljvrpmtwrocecsww6pcjwipzn5j2hfwjof7za"
"bciqelae2kzmf7umbo62flzq2mnlhnc4ilbfmn4va2fzrqwx7w7zusji"
],
"allowedBuildDeps": "bciqdg64uhkvlkqyc7nli33cja3aolbcdr75qepnrhj5ojlifsvxqzgq"
},
Expand All @@ -368,8 +428,7 @@
"bciqe72molvtvcuj3tuh47ziue2oqd6t4qetxn3rsoa764ofup6uwjmi",
"bciqe4zlekl4uqqbhxunac7br24mrf6cdpfrfblahqa4vrgaqjujcl4i",
"bciqpu4klxr3hl6ujhmflrlfd3dxp47ijq26mnathb26ojzwkeggy5ii",
"bciqelae2kzmf7umbo62flzq2mnlhnc4ilbfmn4va2fzrqwx7w7zusji",
"bciqjucge6yrzcawqzcljvrpmtwrocecsww6pcjwipzn5j2hfwjof7za"
"bciqelae2kzmf7umbo62flzq2mnlhnc4ilbfmn4va2fzrqwx7w7zusji"
],
"allowedBuildDeps": "bciqdg64uhkvlkqyc7nli33cja3aolbcdr75qepnrhj5ojlifsvxqzgq"
},
Expand All @@ -384,8 +443,7 @@
"bciqe72molvtvcuj3tuh47ziue2oqd6t4qetxn3rsoa764ofup6uwjmi",
"bciqe4zlekl4uqqbhxunac7br24mrf6cdpfrfblahqa4vrgaqjujcl4i",
"bciqpu4klxr3hl6ujhmflrlfd3dxp47ijq26mnathb26ojzwkeggy5ii",
"bciqelae2kzmf7umbo62flzq2mnlhnc4ilbfmn4va2fzrqwx7w7zusji",
"bciqjucge6yrzcawqzcljvrpmtwrocecsww6pcjwipzn5j2hfwjof7za"
"bciqelae2kzmf7umbo62flzq2mnlhnc4ilbfmn4va2fzrqwx7w7zusji"
],
"allowedBuildDeps": "bciqdg64uhkvlkqyc7nli33cja3aolbcdr75qepnrhj5ojlifsvxqzgq"
},
Expand Down Expand Up @@ -600,56 +658,6 @@
"moduleSpecifier": "file:///ports/deno_ghrel.ts"
}
},
"bciqjucge6yrzcawqzcljvrpmtwrocecsww6pcjwipzn5j2hfwjof7za": {
"buildDepConfigs": {
"asdf_plugin_git": {
"pluginRepo": "https://github.com/lsanwick/asdf-jq",
"portRef": "[email protected]"
}
},
"resolutionDepConfigs": {
"asdf_plugin_git": {
"pluginRepo": "https://github.com/lsanwick/asdf-jq",
"portRef": "[email protected]"
}
},
"port": {
"ty": "denoWorker@v1",
"name": "asdf",
"platforms": [
"x86_64-linux",
"aarch64-linux",
"x86_64-darwin",
"aarch64-darwin"
],
"version": "0.1.0",
"buildDeps": [
{
"name": "curl_aa"
},
{
"name": "git_aa"
},
{
"name": "asdf_plugin_git"
}
],
"resolutionDeps": [
{
"name": "curl_aa"
},
{
"name": "git_aa"
},
{
"name": "asdf_plugin_git"
}
],
"moduleSpecifier": "file:///ports/asdf.ts"
},
"pluginRepo": "https://github.com/lsanwick/asdf-jq",
"installType": "version"
},
"bciqdfarczmlu3r5dkvcdoultfbnuvn6saao55h4fbb3jg72kv6mkr3y": {
"manifest": {
"ty": "denoWorker@v1",
Expand Down
7 changes: 1 addition & 6 deletions ghjk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,7 @@ ghjk.env("ci")
.inherit("_rust");

// these are just for quick testing
ghjk.install(
ports.asdf({
pluginRepo: "https://github.com/lsanwick/asdf-jq",
installType: "version",
}),
);
ghjk.install();

ghjk.env("main")
.vars({
Expand Down
6 changes: 5 additions & 1 deletion src/deno_utils/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,12 @@ export const $ = dax.build$(
},
async removeIfExists(path: Path | string) {
const pathRef = $.path(path);
if (await pathRef.exists()) {
try {
await pathRef.remove({ recursive: true });
} catch (err) {
if (err! instanceof Error && err.name != "NotFound") {
throw err;
}
}
return pathRef;
},
Expand Down
44 changes: 24 additions & 20 deletions src/ghjk/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,29 +323,33 @@ hash.json",

let parent = deno_json_path.parent().unwrap();

// make sure the lockfile path from deno.json is preferred
match config
.to_lock_config()
.map_err(denort::anyhow_to_eyre!())
.wrap_err("error parsing deno.json lock section")?
{
Some(LockConfig::Object {
path: Some(path), ..
})
| Some(LockConfig::PathBuf(path)) => {
self.deno_lockfile = if path.starts_with("/./") {
// remove the weird prefix
Some(parent.join(path.strip_prefix("/./").unwrap()))
} else {
Some(parent.join(path))
};
}
_ => {
if self.deno_lockfile.is_none() {
self.deno_lockfile = Some(parent.join("deno.lock"))
// we always give preference to env vars
if std::env::var("GHJK_DENO_LOCKFILE").is_err() {
// make sure the lockfile path from deno.json is preferred
match config
.to_lock_config()
.map_err(denort::anyhow_to_eyre!())
.wrap_err("error parsing deno.json lock section")?
{
Some(LockConfig::Object {
path: Some(path), ..
})
| Some(LockConfig::PathBuf(path)) => {
self.deno_lockfile = if path.starts_with("/./") {
// remove the weird prefix
Some(parent.join(path.strip_prefix("/./").unwrap()))
} else {
Some(parent.join(path))
};
}
_ => {
if self.deno_lockfile.is_none() {
self.deno_lockfile = Some(parent.join("deno.lock"))
}
}
}
}

Ok(())
}
// create the deno.json file if it doesn't exist
Expand Down
2 changes: 2 additions & 0 deletions tests/hashfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ test (cat tstamp) -lt (__ghjk_get_mtime_ts .ghjk/hash.json); or exit 101
name: "invalidated_cli_config_changed",
stdin: `
__ghjk_get_mtime_ts .ghjk/hash.json > tstamp
ghjk print config
GHJK_DENO_LOCKFILE=deno.lock ghjk sync
GHJK_DENO_LOCKFILE=deno.lock ghjk print config
test (cat tstamp) -lt (__ghjk_get_mtime_ts .ghjk/hash.json); or exit 101
`,
},
Expand Down
25 changes: 13 additions & 12 deletions tests/ports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,6 @@ const cases: CustomE2eTestCase[] = [
installConf: ports.jq_ghrel(),
ePoint: `jq --version`,
},
{
name: "asdf-jq",
ePoint: `jq --version`,
installConf: ports.asdf({
pluginRepo: "https://github.com/lsanwick/asdf-jq",
installType: "version",
}),
secureConf: {
enableRuntimes: true,
},
},
// 3 megs
{
name: "protoc",
Expand All @@ -45,7 +34,7 @@ const cases: CustomE2eTestCase[] = [
},
{
name: "lade",
installConf: ports.protoc(),
installConf: ports.lade_ghrel(),
ePoint: `lade --version`,
},
// 6 megs
Expand Down Expand Up @@ -85,6 +74,18 @@ const cases: CustomE2eTestCase[] = [
installConf: ports.rustup(),
ePoint: `rustup-init --version`,
},
// 14 megs
{
name: "asdf-duckdb",
ePoint: `duckdb --version`,
installConf: ports.asdf({
pluginRepo: "https://github.com/asdf-community/asdf-duckdb",
installType: "version",
}),
secureConf: {
enableRuntimes: true,
},
},
// 15 megs
{
name: "fx_ghrel",
Expand Down

0 comments on commit ee915c1

Please sign in to comment.