immerslides 1.0.0-beta-7 → 1.0.0-beta-8

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/README.md CHANGED
@@ -41,20 +41,42 @@ Open the URL Vite prints, usually `http://127.0.0.1:5173/`. The demo covers layo
41
41
 
42
42
  ### Create your own presentation
43
43
 
44
- The package is not on npm yet. From this repository, pack it, then create a project from the tarball:
44
+ Run the `create` command in any one of three ways:
45
+
46
+ 1. **Without installing anything**, for a one-off project:
47
+
48
+ ```sh
49
+ pnpm dlx immerslides@beta create my-presentation
50
+ ```
51
+
52
+ 2. **Install once, then use it anywhere**:
53
+
54
+ ```sh
55
+ pnpm add -g immerslides@beta
56
+ immerslides create my-presentation
57
+ ```
58
+
59
+ If `immerslides` is not found after the install, run `pnpm setup` once, then open a new terminal.
60
+
61
+ 3. **From a project that already depends on immerslides**:
62
+
63
+ ```sh
64
+ pnpm exec immerslides create ../my-presentation
65
+ ```
66
+
67
+ This works only inside a project where `immerslides` is installed, such as a project you created earlier. In any other folder, `pnpm exec` reports that the command is not found. To add the dependency first, run `pnpm add -D immerslides@beta`.
68
+
69
+ Then open the new project:
45
70
 
46
71
  ```sh
47
- pnpm pack --out immerslides.tgz
48
- TARBALL="$PWD/immerslides.tgz"
49
- node bin/immerslides.mjs create ../my-presentation
50
- cd ../my-presentation
51
- pnpm add "$TARBALL"
72
+ cd my-presentation
73
+ pnpm install
52
74
  pnpm dev
53
75
  ```
54
76
 
55
- The `create` command copies the starter project and the two agent skills into the new directory. It refuses to write into a non-empty directory and does not install dependencies, so run `pnpm add` before `pnpm dev`.
77
+ The `create` command copies the starter project and the two agent skills into the new directory. It refuses to write into a non-empty directory and does not install dependencies, so run `pnpm install` first.
56
78
 
57
- After the package is published, you can run `pnpm dlx immerslides create my-presentation`, then `pnpm install` and `pnpm dev`.
79
+ `@beta` selects the current pre-release. The `latest` tag still points to an older version, so without `@beta` you get that older CLI. pnpm does not resolve a tag to a version published less than 24 hours earlier, so right after a release `@beta` can still point to the previous version. Until then, use the exact version, for example `immerslides@1.0.0-beta-8`.
58
80
 
59
81
  To install from GitHub Packages instead, set the registry for the `@<repository-owner>` scope and log in with a token that has `read:packages`. Projects created by the CLI map the scoped package to `immerslides` with an npm alias, so the import paths stay the same.
60
82
 
@@ -254,69 +276,20 @@ The skills are written for the agent: they say which reference to read for each
254
276
 
255
277
  ## Troubleshooting
256
278
 
257
- | Symptom | What to check |
258
- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
259
- | The slides have no layout or colors. | The entry file must import `immerslides/styles.css`. |
260
- | Code appears as plain text for a moment. | Highlighting loads a language the first time it is needed. This is expected. For server rendering, await `preloadCodeLanguages([...])` before rendering, and call it with the same languages on the client before hydrating. |
261
- | The presenter window does not open. | Allow pop-ups for the site. The player shows a message when the browser blocks the window. |
262
- | The console does not follow the audience. | Both pages must use the same `channel` name, and both must be open in the same browser. |
263
- | Saved progress lands on the wrong step after you edit slides. | Increase `version` when you change slides or steps. Start over with `fresh`, or restart from the help dialog. |
264
- | Install or dev server fails with a Node version error. | Use Node.js 26 or later (see `.nvmrc`). |
265
-
266
- ## Deploy
267
-
268
- The production build is a static site with a page for the player (`/`, `/slides/`) and the reading view (`/site/`). Deploy the entire build output directory to any static host, and keep the subfolders intact.
269
-
270
- ## For contributors
271
-
272
- Set up the repository from its root:
273
-
274
- ```sh
275
- nvm install
276
- nvm use
277
- npm install --global pnpm@12.20.0
278
- pnpm install
279
- ```
280
-
281
- | Command | Purpose |
282
- | ----------------------- | -------------------------------------------------------------------- |
283
- | `pnpm dev` | Run the demo deck |
284
- | `pnpm build` | Build the library into `dist/` |
285
- | `pnpm typecheck` | Run the TypeScript compiler without emitting files |
286
- | `pnpm lint` | Run Biome checks for code, React rules, formatting, and import order |
287
- | `pnpm lint:fix` | Apply the Biome fixes that are safe to apply automatically |
288
- | `pnpm test` | Run unit tests with Vitest |
289
- | `pnpm test:browser` | Run end-to-end tests with Playwright |
290
- | `pnpm test:package` | Build the package and verify the installed result |
291
- | `pnpm generate:favicon` | Regenerate the favicon |
292
-
293
- Browser tests need a Chromium build for Playwright. Install it once with `pnpm exec playwright install --with-deps chromium`.
294
-
295
- Project layout:
296
-
297
- - `src/`: the library source (components, player, presenter, and site view)
298
- - `bin/`: the `immerslides` CLI, which provides `create`
299
- - `starter/`: the project template that the CLI copies, and the demo app for `pnpm dev`
300
- - `skills/immerslides/` and `skills/immerslides-en/`: the agent skills and their reference documents
301
- - `tests/`: Vitest unit tests and Playwright browser tests
302
- - `scripts/`: build, package smoke test, and favicon generation
303
-
304
- ### Continuous integration
305
-
306
- Pull requests and pushes to `main` run [`verify.yml`](.github/workflows/verify.yml). It runs lint, type checks, unit tests, package verification, and the Chromium browser tests. CodeQL analyzes JavaScript and TypeScript. For private repositories, GitHub Code Security must be enabled first. Dependabot checks the root project, the starter, and GitHub Actions every week.
307
-
308
- ### Releasing
309
-
310
- The **Release** workflow is started manually from `main`. It runs the shared verification, publishes to npm and GitHub Packages, and creates a GitHub Release.
311
-
312
- Before the first release:
279
+ | Symptom | What to check |
280
+ | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
281
+ | The slides have no layout or colors. | The entry file must import `immerslides/styles.css`. |
282
+ | Code appears as plain text for a moment. | Highlighting loads a language the first time it is needed. This is expected. For server rendering, await `preloadCodeLanguages([...])` before rendering, and call it with the same languages on the client before hydrating. |
283
+ | The presenter window does not open. | Allow pop-ups for the site. The player shows a message when the browser blocks the window. |
284
+ | The console does not follow the audience. | Both pages must use the same `channel` name, and both must be open in the same browser. |
285
+ | Saved progress lands on the wrong step after you edit slides. | Increase `version` when you change slides or steps. Start over with `fresh`, or restart from the help dialog. |
286
+ | Install or dev server fails with a Node version error. | Use Node.js 26 or later (see `.nvmrc`). |
287
+ | `pnpm build` fails with `Unable to resolve @typescript/typescript-darwin-arm64` on an Apple Silicon Mac. | The pnpm binary is x64, running under Rosetta, so it installs only the x64 TypeScript compiler. Projects created with `1.0.0-beta-8` or later include a `pnpm-workspace.yaml` that fixes this. For an older project, add a `pnpm-workspace.yaml` with `supportedArchitectures` listing `x64` and `arm64` under `cpu`, or delete `node_modules` and install with an arm64 pnpm. |
288
+ | `@beta` installs an older version than the one npm lists. | pnpm skips versions published less than 24 hours ago when it resolves a tag. Install the exact version, for example `pnpm dlx immerslides@1.0.0-beta-8 create my-presentation`, or wait a day. To skip the check for one command, add `--config.minimumReleaseAge=0`. |
313
289
 
314
- 1. Create an `npm` environment in the GitHub repository that allows deployments only from `main`. Add required reviewers if you want a manual approval step.
315
- 2. Add an `NPM_TOKEN` secret to that environment. The token must be allowed to publish `immerslides`.
316
- 3. Make sure the repository's `GITHUB_TOKEN` can write packages, and that the organization allows packages under the scope.
317
- 4. Commit the version you want to release in `package.json`. The release creates the tag `v<version>`.
290
+ ## Contributing
318
291
 
319
- On GitHub Packages, the package is published as `@<repository-owner>/immerslides`. The scope uses the lowercase name of the repository owner. Both registries receive the same build.
292
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for local development, the tests, the pull request workflow, and the release process.
320
293
 
321
294
  ## License
322
295
 
package/README.zh-TW.md CHANGED
@@ -41,20 +41,42 @@ pnpm dev
41
41
 
42
42
  ### 建立自己的簡報
43
43
 
44
- 套件尚未發佈到 npm。先在這個 repository 打包,再用 tarball 建立專案:
44
+ 以下三種方式都能執行 `create` 指令,選一種即可:
45
+
46
+ 1. **不安裝,直接執行**(只建立一次時):
47
+
48
+ ```sh
49
+ pnpm dlx immerslides@beta create my-presentation
50
+ ```
51
+
52
+ 2. **全域安裝一次,之後任何地方都能用**:
53
+
54
+ ```sh
55
+ pnpm add -g immerslides@beta
56
+ immerslides create my-presentation
57
+ ```
58
+
59
+ 安裝後若出現找不到 `immerslides`,執行一次 `pnpm setup`,再開啟新的終端機。
60
+
61
+ 3. **在已經依賴 immerslides 的專案裡執行**:
62
+
63
+ ```sh
64
+ pnpm exec immerslides create ../my-presentation
65
+ ```
66
+
67
+ 這只在已安裝 `immerslides` 的專案裡有效,例如前面建立的專案。在其他目錄,`pnpm exec` 會回報找不到指令。要先加入依賴,執行 `pnpm add -D immerslides@beta`。
68
+
69
+ 然後進入新專案:
45
70
 
46
71
  ```sh
47
- pnpm pack --out immerslides.tgz
48
- TARBALL="$PWD/immerslides.tgz"
49
- node bin/immerslides.mjs create ../my-presentation
50
- cd ../my-presentation
51
- pnpm add "$TARBALL"
72
+ cd my-presentation
73
+ pnpm install
52
74
  pnpm dev
53
75
  ```
54
76
 
55
- `create` 指令會把 starter 專案與兩個 agent skill 複製到新目錄。它不會寫入非空目錄,也不會安裝依賴,所以要先執行 `pnpm add`,再執行 `pnpm dev`。
77
+ `create` 指令會把 starter 專案與兩個 agent skill 複製到新目錄。它不會寫入非空目錄,也不會安裝依賴,所以要先執行 `pnpm install`。
56
78
 
57
- 套件發佈後,可以執行 `pnpm dlx immerslides create my-presentation`,再執行 `pnpm install` 與 `pnpm dev`。
79
+ `@beta` 指向目前的預發行版。`latest` 仍指向較舊的版本,所以不加 `@beta` 會拿到那個舊的 CLI。pnpm 解析 tag 時會跳過 24 小時內才發佈的版本,所以剛發佈後 `@beta` 可能仍指向前一版。在那之前,請使用明確版本,例如 `immerslides@1.0.0-beta-8`。
58
80
 
59
81
  若改從 GitHub Packages 安裝,請為 `@<repository-owner>` scope 設定 registry,並以具備 `read:packages` 權限的帳號登入。CLI 產生的專案會透過 npm alias 把 scoped 套件對應為 `immerslides`,匯入路徑不變。
60
82
 
@@ -248,72 +270,20 @@ Skill 會說明每項任務應閱讀哪份參考文件,以及應避免的錯
248
270
 
249
271
  ## 疑難排解
250
272
 
251
- | 症狀 | 檢查方式 |
252
- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
253
- | 投影片沒有版型或顏色。 | 入口檔必須匯入 `immerslides/styles.css`。 |
254
- | 程式碼先以純文字顯示,一下子才上色。 | 語法上色會在第一次需要某語言時才載入,這是預期行為。伺服器渲染時,請在渲染前 `await preloadCodeLanguages([...])`;客戶端 hydrate 前也要用相同語言呼叫。 |
255
- | 簡報者視窗沒有開啟。 | 允許此網站開啟彈出視窗。瀏覽器阻擋時,播放器會顯示提示。 |
256
- | 主控台沒有跟著觀眾頁移動。 | 兩個頁面必須使用相同的 `channel` 名稱,並且在同一個瀏覽器中開啟。 |
257
- | 修改投影片後,保存的進度跳到錯誤的步驟。 | 調整頁面或步驟後增加 `version`。要重新開始,使用 `fresh` 或說明中的從頭開始。 |
258
- | 安裝或開發伺服器出現 Node 版本錯誤。 | 使用 Node.js 26 以上(見 `.nvmrc`)。 |
259
-
260
- ## 部署
261
-
262
- 正式建置會產生靜態網站,包含播放頁(`/`、`/slides/`)與閱讀版(`/site/`)。部署時請整個輸出目錄上傳,並保留子資料夾結構。
263
-
264
- ## 給貢獻者
265
-
266
- 在 repository 根目錄設定開發環境:
267
-
268
- ```sh
269
- nvm install
270
- nvm use
271
- npm install --global pnpm@12.20.0
272
- pnpm install
273
- ```
274
-
275
- | 指令 | 用途 |
276
- | ----------------------- | ------------------------------------------------- |
277
- | `pnpm dev` | 執行範例 deck |
278
- | `pnpm build` | 將套件建置到 `dist/` |
279
- | `pnpm typecheck` | 執行 TypeScript 檢查,不產生檔案 |
280
- | `pnpm lint` | 使用 Biome 檢查程式碼、React 規則、排版與匯入順序 |
281
- | `pnpm lint:fix` | 套用可安全自動修正的 Biome 項目 |
282
- | `pnpm test` | 以 Vitest 執行單元測試 |
283
- | `pnpm test:browser` | 以 Playwright 執行端對端測試 |
284
- | `pnpm test:package` | 建置套件並驗證安裝後的結果 |
285
- | `pnpm generate:favicon` | 重新產生 favicon |
286
-
287
- 瀏覽器測試需要 Playwright 的 Chromium。第一次使用時執行 `pnpm exec playwright install --with-deps chromium`。
288
-
289
- 專案結構:
290
-
291
- - `src/`:套件原始碼(元件、播放器、簡報者與閱讀版)
292
- - `bin/`:`immerslides` CLI,提供 `create`
293
- - `starter/`:CLI 複製的專案範本,也是 `pnpm dev` 的範例應用
294
- - `skills/immerslides/` 與 `skills/immerslides-en/`:agent skill 與參考文件
295
- - `tests/`:Vitest 單元測試與 Playwright 瀏覽器測試
296
- - `scripts/`:建置、套件 smoke test 與 favicon 產生
297
-
298
- ### 持續整合
299
-
300
- Pull request 與推送至 `main` 會執行 [`verify.yml`](.github/workflows/verify.yml),包含 lint、型別、單元測試、套件驗證與 Chromium 播放測試。CodeQL 分析 JavaScript 與 TypeScript。私人 repository 需先啟用 GitHub Code Security。Dependabot 每週檢查主專案、starter 與 GitHub Actions 的依賴。
301
-
302
- Lint 規則保留明確的 effect 生命週期觸發、非空斷言、動畫索引與既有 CSS 優先序,仍會阻擋遺漏的 effect 依賴。原生 dialog 取消、子控制項冒泡的焦點、按鈕群組與 React 測試 fixture 採檔案範圍的例外。產生的 favicon 不納入檢查。
303
-
304
- ### 發佈套件
305
-
306
- 發佈使用 [Release GitHub & NPM](https://github.com/marketplace/actions/release-github-npm)。流程僅能從 `main` 手動啟動,先執行共用檢查,再依序發佈 npm、GitHub Packages 與 GitHub Release。
307
-
308
- npm 名稱維持 `immerslides`。GitHub Packages 名稱為 `@<repository-owner>/immerslides`,scope 自動使用 repository 擁有者的小寫名稱。兩個 registry 使用同一份建置內容。
273
+ | 症狀 | 檢查方式 |
274
+ | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
275
+ | 投影片沒有版型或顏色。 | 入口檔必須匯入 `immerslides/styles.css`。 |
276
+ | 程式碼先以純文字顯示,一下子才上色。 | 語法上色會在第一次需要某語言時才載入,這是預期行為。伺服器渲染時,請在渲染前 `await preloadCodeLanguages([...])`;客戶端 hydrate 前也要用相同語言呼叫。 |
277
+ | 簡報者視窗沒有開啟。 | 允許此網站開啟彈出視窗。瀏覽器阻擋時,播放器會顯示提示。 |
278
+ | 主控台沒有跟著觀眾頁移動。 | 兩個頁面必須使用相同的 `channel` 名稱,並且在同一個瀏覽器中開啟。 |
279
+ | 修改投影片後,保存的進度跳到錯誤的步驟。 | 調整頁面或步驟後增加 `version`。要重新開始,使用 `fresh` 或說明中的從頭開始。 |
280
+ | 安裝或開發伺服器出現 Node 版本錯誤。 | 使用 Node.js 26 以上(見 `.nvmrc`)。 |
281
+ | 在 Apple Silicon Mac 上執行 `pnpm build` 出現 `Unable to resolve @typescript/typescript-darwin-arm64`。 | 目前的 pnpm 是 x64 版,透過 Rosetta 執行,只會安裝 x64 的 TypeScript 編譯器。`1.0.0-beta-8` 之後建立的專案已包含修正用的 `pnpm-workspace.yaml`。較舊的專案請新增 `pnpm-workspace.yaml`,在 `cpu` 中列出 `x64` 與 `arm64`;或刪除 `node_modules`,再用 arm64 版 pnpm 執行 `pnpm install`。 |
282
+ | `@beta` 裝到的版本比 npm 上列出的舊。 | pnpm 解析 tag 時會跳過 24 小時內才發佈的版本。請安裝明確版本,例如 `pnpm dlx immerslides@1.0.0-beta-8 create my-presentation`,或等一天。若只想在單一指令略過這項檢查,加上 `--config.minimumReleaseAge=0`。 |
309
283
 
310
- 1. 在 GitHub repository 建立 `npm` environment,限制僅允許 `main` 部署;需要人工核准時設定 required reviewers。
311
- 2. 在該 environment 新增 `NPM_TOKEN` secret,使用有權發佈 `immerslides` 的 npm token。
312
- 3. 確認 repository 的 `GITHUB_TOKEN` 可寫入 GitHub Packages。組織仍須允許建立該 scope 的套件。
313
- 4. 提交要發佈的 `package.json` 版本。首次發佈前先確認 npm 套件名稱與授權。
314
- 5. 開啟 Actions 的 **Release** workflow,選擇 `main` 並執行。
284
+ ## 貢獻
315
285
 
316
- 版本取自 `package.json`,對應標籤為 `v<version>`。同名標籤若已指向其他 commit,流程會停止。GitHub Release 包含 commit notes,穩定版會將 `v<major>` 標籤移到本次發佈的 commit。
286
+ 本機開發、測試、Pull request 流程與發佈步驟見 [CONTRIBUTING.md](CONTRIBUTING.md)(英文)。
317
287
 
318
288
  ## 授權
319
289
 
@@ -85,6 +85,13 @@ try {
85
85
  path.join(destination, '.gitignore'),
86
86
  'node_modules/\ndist/\n.DS_Store\n',
87
87
  );
88
+ // TypeScript 7 ships its compiler as a per-architecture package. A pnpm that runs under
89
+ // emulation (an x64 pnpm on an Apple Silicon Mac, for example) would install only its own
90
+ // architecture, and `pnpm build` would then fail. Ask for every architecture.
91
+ await writeFile(
92
+ path.join(destination, 'pnpm-workspace.yaml'),
93
+ 'supportedArchitectures:\n os:\n - current\n cpu:\n - current\n - x64\n - arm64\n',
94
+ );
88
95
  const shellDirectory = `'${destination.replaceAll("'", "'\\''")}'`;
89
96
  console.log(
90
97
  `Created ${destination}\n\nRun:\n cd ${shellDirectory}\n pnpm install\n pnpm dev\n\nUse $immerslides (Chinese) or $immerslides-en (English) to create or revise the presentation.`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "immerslides",
3
- "version": "1.0.0-beta-7",
3
+ "version": "1.0.0-beta-8",
4
4
  "description": "React presentations with immersive code and flow walkthroughs.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -11,7 +11,7 @@ description: 使用 immerslides 建立、修改或播放 React 沉浸式簡報
11
11
  ## 開始前
12
12
 
13
13
  1. 讀取專案的 `package.json`、`src/deck.tsx` 與 `src/config.ts`。保留既有的命名、內容順序與使用者指定的視覺要求。修改既有簡報時直接編輯內容,不重新建立專案。
14
- 2. 新專案使用 `immerslides create <directory>`。CLI 不覆寫非空目錄,也不安裝依賴。套件尚未發佈時,使用使用者提供的本機套件或 tarball,不假設 npm registry 上有同名套件。
14
+ 2. 新專案使用 `pnpm dlx immerslides@beta create <directory>`。CLI 不覆寫非空目錄,也不安裝依賴,建立後要執行 `pnpm install`。若使用者要測試尚未發佈的本機套件,改用他提供的 tarball。
15
15
  3. 確認入口檔(starter 的 `src/mount.tsx`)匯入了 `immerslides/styles.css`。缺少這行時,播放器沒有版型,這是最常見的問題。
16
16
  4. 使用 pnpm,版本依 `packageManager` 欄位。保留 `pnpm-lock.yaml`,不新增其他套件管理器的 lockfile。
17
17
 
@@ -11,7 +11,7 @@ Turn the user's material into a playable, immersive presentation. Build on the p
11
11
  ## Before you start
12
12
 
13
13
  1. Read the project's `package.json`, `src/deck.tsx`, and `src/config.ts`. Keep the existing naming, content order, and the visual requirements the user has set. When editing an existing presentation, change its content directly instead of recreating the project.
14
- 2. For a new project, use `immerslides create <directory>`. The CLI never overwrites a non-empty directory, and it does not install dependencies. Until the package is published, use the local package or tarball the user provides. Do not assume a package with that name exists on the npm registry.
14
+ 2. For a new project, run `pnpm dlx immerslides@beta create <directory>`. The CLI never overwrites a non-empty directory, and it does not install dependencies, so run `pnpm install` afterwards. If the user is testing an unpublished local build, use the tarball they provide instead.
15
15
  3. Check that the entry file (the starter's `src/mount.tsx`) imports `immerslides/styles.css`. Without that import the player has no layout, which is the most common problem.
16
16
  4. Use pnpm, at the version pinned by the project's `packageManager` field. Keep `pnpm-lock.yaml`, and do not add a lockfile from another package manager.
17
17
 
@@ -13,7 +13,7 @@
13
13
  "preview": "vite preview --host 127.0.0.1"
14
14
  },
15
15
  "dependencies": {
16
- "immerslides": "^1.0.0-beta-7",
16
+ "immerslides": "^1.0.0-beta-8",
17
17
  "react": "^19.0.0",
18
18
  "react-dom": "^19.0.0"
19
19
  },