@berlysia/vertical-writing-slide-system 0.0.13 → 0.0.15

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.
Files changed (3) hide show
  1. package/cli.js +65 -4
  2. package/package.json +1 -1
  3. package/src/screen.css +2 -2
package/cli.js CHANGED
@@ -2,16 +2,77 @@
2
2
  // @ts-check
3
3
 
4
4
  import { execSync } from "child_process";
5
- import { mkdir, mkdtemp, cp, rm } from "node:fs/promises";
5
+ import { mkdir, mkdtemp, cp, rm, writeFile, access } from "node:fs/promises";
6
6
  import { resolve } from "node:path";
7
7
  import { parseArgs } from "node:util";
8
- import { build } from "vite";
8
+ import { build, createServer } from "vite";
9
+
10
+ async function ensureIndexHtml() {
11
+ const indexHtmlPath = resolve(process.cwd(), "index.html");
12
+ try {
13
+ await access(indexHtmlPath);
14
+ // index.html already exists
15
+ return;
16
+ } catch {
17
+ // index.html doesn't exist, create it
18
+ // Use relative paths that Vite can resolve during development
19
+ const indexHtmlContent = `<!doctype html>
20
+ <html lang="ja">
21
+ <head>
22
+ <meta charset="UTF-8" />
23
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
24
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
25
+ <title>Vertical Writing Slides</title>
26
+ <link rel="preconnect" href="https://fonts.googleapis.com">
27
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
28
+ <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP&family=Noto+Sans+Mono:wght@100..900&display=swap" rel="stylesheet">
29
+ <link rel="stylesheet" href="/src/index.css" />
30
+ <link rel="stylesheet" media="screen" href="/src/screen.css" />
31
+ <link rel="stylesheet" media="print" href="/src/print.css" />
32
+ </head>
33
+ <body>
34
+ <div id="root"></div>
35
+ <script type="module" src="/src/main.tsx"></script>
36
+ </body>
37
+ </html>`;
38
+
39
+ await writeFile(indexHtmlPath, indexHtmlContent);
40
+ console.log("Generated index.html for external project");
41
+ }
42
+ }
9
43
 
10
44
  async function runDev() {
11
45
  try {
12
- execSync("npx vite", { stdio: "inherit" });
46
+ const libPath = import.meta.dirname;
47
+ const projectPath = process.cwd();
48
+
49
+ const server = await createServer({
50
+ root: libPath, // Use library as root for assets
51
+ configFile: resolve(libPath, "vite.config.ts"),
52
+ server: {
53
+ fs: {
54
+ allow: [
55
+ // Allow serving files from the library directory
56
+ libPath,
57
+ // Allow serving files from the current working directory
58
+ projectPath,
59
+ ],
60
+ },
61
+ },
62
+ });
63
+
64
+ await server.listen();
65
+ server.printUrls();
66
+ console.log("Development server started. Press Ctrl+C to stop.");
67
+
68
+ // Keep the process running
69
+ process.on("SIGINT", async () => {
70
+ console.log("\nShutting down development server...");
71
+ await server.close();
72
+ process.exit(0);
73
+ });
13
74
  } catch (error) {
14
- console.error("Error during build:", error);
75
+ console.error("Error during development server startup:", error);
15
76
  process.exit(1);
16
77
  }
17
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@berlysia/vertical-writing-slide-system",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "vertical-slides": "./cli.js"
package/src/screen.css CHANGED
@@ -12,8 +12,8 @@ body,
12
12
  container-name: slide-container;
13
13
  container-type: size;
14
14
 
15
- width: 100dvw;
16
- height: calc(max(90dvh, 100dvw * 9 / 16) + 0px);
15
+ width: 100%;
16
+ height: 100%;
17
17
 
18
18
  position: relative;
19
19