@timmo001/groundwork-report 0.9.38 → 0.9.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/assets.ts +15 -11
- package/src/desktop.ts +16 -28
- package/src/page.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timmo001/groundwork-report",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.40",
|
|
4
4
|
"description": "Groundwork's report page: one self-contained HTML file built from blocks, with every theme and the desktop's Omarchy theme",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"format:check": "prettier --check ."
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@timmo001/groundwork-tokens": "0.9.
|
|
39
|
-
"@timmo001/groundwork-ui": "0.9.
|
|
38
|
+
"@timmo001/groundwork-tokens": "0.9.40",
|
|
39
|
+
"@timmo001/groundwork-ui": "0.9.40",
|
|
40
40
|
"effect": "4.1.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
package/src/assets.ts
CHANGED
|
@@ -17,17 +17,21 @@ import type { ReportAssets } from "./page.ts";
|
|
|
17
17
|
|
|
18
18
|
/** Bundles the page script and reads the themes' CSS. */
|
|
19
19
|
export const reportAssets = async (): Promise<ReportAssets> => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
// The CLI rather than `Bun.build`, which can't run inside a macro while
|
|
21
|
+
// the bundler waits on it
|
|
22
|
+
const build = Bun.spawnSync([
|
|
23
|
+
process.execPath,
|
|
24
|
+
"build",
|
|
25
|
+
fileURLToPath(import.meta.resolve("./client.ts")),
|
|
26
|
+
"--target=browser",
|
|
27
|
+
"--format=esm",
|
|
28
|
+
"--minify",
|
|
29
|
+
]);
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
if (!build.success) {
|
|
32
|
+
throw new Error(
|
|
33
|
+
`The report script didn't build:\n${build.stderr.toString()}`,
|
|
34
|
+
);
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
const css = await Bun.file(
|
|
@@ -36,5 +40,5 @@ export const reportAssets = async (): Promise<ReportAssets> => {
|
|
|
36
40
|
),
|
|
37
41
|
).text();
|
|
38
42
|
|
|
39
|
-
return { css, script:
|
|
43
|
+
return { css, script: build.stdout.toString() };
|
|
40
44
|
};
|
package/src/desktop.ts
CHANGED
|
@@ -10,17 +10,16 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @module
|
|
12
12
|
*/
|
|
13
|
-
import { Result } from "effect";
|
|
13
|
+
import { Result, Schema } from "effect";
|
|
14
14
|
|
|
15
15
|
import { readDesktopThemes } from "@timmo001/groundwork-tokens/desktop-themes";
|
|
16
16
|
import { readOmarchyTheme } from "@timmo001/groundwork-tokens/omarchy-current";
|
|
17
|
-
import {
|
|
17
|
+
import { optionalThemeDocuments } from "@timmo001/groundwork-tokens/choices";
|
|
18
18
|
import {
|
|
19
19
|
omarchyTheme,
|
|
20
|
-
parseTheme,
|
|
21
20
|
type OmarchyCurrentTheme,
|
|
22
21
|
} from "@timmo001/groundwork-tokens/runtime";
|
|
23
|
-
import
|
|
22
|
+
import { MappedTheme } from "@timmo001/groundwork-tokens";
|
|
24
23
|
|
|
25
24
|
/** What `readReportThemes` found, to spread into `reportPage`'s options. */
|
|
26
25
|
export interface ReportThemes {
|
|
@@ -28,26 +27,18 @@ export interface ReportThemes {
|
|
|
28
27
|
readonly desktop: readonly MappedTheme[];
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
const optionalThemes = async () => {
|
|
33
|
-
const documents: MappedTheme[] = [];
|
|
30
|
+
const decodeMapped = Schema.decodeUnknownResult(MappedTheme);
|
|
34
31
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const parsed = parseTheme(file);
|
|
43
|
-
|
|
44
|
-
if (Result.isSuccess(parsed) && parsed.success.kind === "mapped") {
|
|
45
|
-
documents.push(parsed.success);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
32
|
+
/**
|
|
33
|
+
* The optional themes' documents, to drop desktop themes that match them.
|
|
34
|
+
* They come bundled rather than read from disk, so this works in an app
|
|
35
|
+
* compiled to one binary.
|
|
36
|
+
*/
|
|
37
|
+
const optionalThemes = optionalThemeDocuments.flatMap((document) => {
|
|
38
|
+
const decoded = decodeMapped(document);
|
|
48
39
|
|
|
49
|
-
return
|
|
50
|
-
};
|
|
40
|
+
return Result.isSuccess(decoded) ? [decoded.success] : [];
|
|
41
|
+
});
|
|
51
42
|
|
|
52
43
|
/**
|
|
53
44
|
* Reads the Omarchy theme in use and every other theme on the machine, the
|
|
@@ -55,18 +46,15 @@ const optionalThemes = async () => {
|
|
|
55
46
|
* terminal following Omarchy doesn't show twice.
|
|
56
47
|
*/
|
|
57
48
|
export const readReportThemes = async (): Promise<ReportThemes> => {
|
|
58
|
-
const
|
|
59
|
-
readOmarchyTheme(),
|
|
60
|
-
optionalThemes(),
|
|
61
|
-
]);
|
|
49
|
+
const omarchy = await readOmarchyTheme();
|
|
62
50
|
|
|
63
51
|
const current =
|
|
64
52
|
omarchy === null ? undefined : omarchyTheme(omarchy.colors, omarchy.name);
|
|
65
53
|
|
|
66
54
|
const existing =
|
|
67
55
|
current !== undefined && Result.isSuccess(current)
|
|
68
|
-
? [...
|
|
69
|
-
:
|
|
56
|
+
? [...optionalThemes, current.success]
|
|
57
|
+
: optionalThemes;
|
|
70
58
|
|
|
71
59
|
return {
|
|
72
60
|
omarchy,
|
package/src/page.ts
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { MappedTheme } from "@timmo001/groundwork-tokens";
|
|
9
9
|
import type { OmarchyCurrentTheme } from "@timmo001/groundwork-tokens/runtime";
|
|
10
|
-
|
|
10
|
+
// From `choices`, not `page`, so a CLI without the DOM lib type-checks it
|
|
11
|
+
import { themeBootScript } from "@timmo001/groundwork-tokens/choices";
|
|
11
12
|
|
|
12
13
|
import { html, raw, type Content } from "./html.ts";
|
|
13
14
|
import { reportCss } from "./styles.ts";
|