M0: WIT package, MoonBit components, JS host, docs, CI (#1)
CI / test (push) Successful in 19s
CI / test (push) Successful in 19s
This commit was merged in pull request #1.
This commit is contained in:
1 parent
e5548fc067
commit
880ecd4102
141 files changed
+9681
-1
No files matched your search
@@ -0,0 +1,19 @@
|
||||
// Headless bring-up shared by the CLI and the tests.
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { join, dirname } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { Desktop } from './desktop.mjs';
|
||||
import { createPlatform } from './platform.mjs';
|
||||
import { tokensFromJson } from './theme.mjs';
|
||||
import { nodeLoader } from './loader-node.mjs';
|
||||
|
||||
export const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..');
|
||||
|
||||
export async function bootDesktop({ configPath = join(ROOT, 'config', 'desktop.json'), now, buildDir = join(ROOT, 'build') } = {}) {
|
||||
const config = JSON.parse(await readFile(configPath, 'utf8'));
|
||||
const apps = JSON.parse(await readFile(join(ROOT, 'config', 'apps.json'), 'utf8'));
|
||||
const themeJson = JSON.parse(await readFile(join(ROOT, 'config', 'themes', `${config.theme}.json`), 'utf8'));
|
||||
const platform = createPlatform({ apps, tokens: tokensFromJson(themeJson), now });
|
||||
const desktop = await new Desktop({ config, loader: nodeLoader(buildDir), platform }).start();
|
||||
return { desktop, platform, config };
|
||||
}
|
||||
Reference in new issue
Block a user