(projectId: string)
| 1 | import { LocalStorageProjectLoader, Project, SerializedProject, StaticFileLoader } from '@splootcode/core' |
| 2 | |
| 3 | export async function loadExampleProject(projectId: string): Promise<Project> { |
| 4 | const rootUrl = '/static/projects/' + projectId + '/' |
| 5 | const fileLoader = new StaticFileLoader(rootUrl) |
| 6 | const projStr = await (await fetch(rootUrl + 'project.sp')).text() |
| 7 | const proj = JSON.parse(projStr) as SerializedProject |
| 8 | const packages = proj.packages.map(async (packRef) => { |
| 9 | return fileLoader.loadPackage('examples', proj.name, packRef.name) |
| 10 | }) |
| 11 | return new Project('examples', proj, await Promise.all(packages), fileLoader, new LocalStorageProjectLoader()) |
| 12 | } |
no test coverage detected