Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$mol_build meta override url #728

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions build/ensure/vcs/vcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ namespace $ {
return null as $mol_tree2 | null
}

@ $mol_mem
overrides() {
const overrides = this.meta(this.root().path())
return overrides?.select('override')?.kids
?.map(
item => (item.kids?.[0].value?.split(' ') ?? []) as [string, string]
) ?? []
}

@ $mol_mem_key
protected repo( path : string ) {
const vcs_type = this.vcs_type()
Expand All @@ -29,11 +38,15 @@ namespace $ {
const parent = mod.parent()
const mapping = this.meta( parent.path() )


const url_branch = mapping?.select( 'pack' , mod.name(), vcs_type).kids
.find($mol_guard_defined)?.kids[0]

const url = url_branch?.value ?? null
let url = url_branch?.value ?? null
const branch = url_branch?.kids[0]?.value ?? null

const parts = this.overrides().find(([from, to]) => url?.startsWith(from))
if (url && parts) url = parts[1] + url.slice(parts[0].length)

return url ? { url, branch } : null
}
Expand Down
Loading