From 2ef35a8583eb3c462b2ece709110ae2e50baad87 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Mon, 6 Nov 2023 22:17:33 +0100 Subject: [PATCH] samples loading shortcuts: - use main branch by default in github shortcut - add bubo shortcut --- packages/superdough/sampler.mjs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/superdough/sampler.mjs b/packages/superdough/sampler.mjs index d0733b14..cbc591fb 100644 --- a/packages/superdough/sampler.mjs +++ b/packages/superdough/sampler.mjs @@ -162,9 +162,17 @@ export const samples = async (sampleMap, baseUrl = sampleMap._base || '', option if (handler) { return handler(sampleMap); } + if (sampleMap.startsWith('bubo:')) { + const [_, repo] = sampleMap.split(':'); + sampleMap = `github:Bubobubobubobubo/dough-${repo}`; + } if (sampleMap.startsWith('github:')) { let [_, path] = sampleMap.split('github:'); path = path.endsWith('/') ? path.slice(0, -1) : path; + if (path.split('/').length === 2) { + // assume main as default branch if none set + path += '/main'; + } sampleMap = `https://raw.githubusercontent.com/${path}/strudel.json`; } if (sampleMap.startsWith('shabda:')) {