Skip to content

Conversation

@HerrCai0907
Copy link
Contributor

@HerrCai0907 HerrCai0907 commented Oct 9, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a typed configuration API with publicly documented types and a new “isolated” option.
  • Documentation

    • Updated configuration docs to reference type declarations and provide type-based usage examples.
  • Tests

    • Added and updated example tests to use the published framework package; corrected a test description typo.
  • Chores

    • CI now runs tests for the example project.
    • Package publishing now includes configuration types and transform assets.
    • Added example project metadata and ignore rules.

@HerrCai0907 HerrCai0907 requested a review from a team as a code owner October 9, 2025 03:35
@HerrCai0907
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Oct 9, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
config.d.ts (1)

21-22: 澄清属性名称和注释的一致性。

注释说的是 "template file path",但属性名为 temp,这可能会让使用者困惑。建议将注释改为 "temporary directory path" 或 "intermediate files directory",以更准确地反映该属性的用途(从示例配置中看,它被设置为 "coverage" 目录)。

建议应用此更改来澄清注释:

-  /** template file path, default "coverage" */
+  /** temporary directory path, default "coverage" */
   temp?: string;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fad2b20 and cac9125.

⛔ Files ignored due to path filters (1)
  • example/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (10)
  • .github/workflows/ci-test.yml (1 hunks)
  • config.d.ts (1 hunks)
  • docs/api-documents/configuration.md (1 hunks)
  • example/.gitignore (1 hunks)
  • example/as-test.config.cjs (1 hunks)
  • example/as-test.config.js (2 hunks)
  • example/package.json (1 hunks)
  • example/tests/source.test.ts (1 hunks)
  • example/tests/source2.test.ts (1 hunks)
  • package.json (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
config.d.ts (1)
src/interface.ts (1)
  • Imports (198-198)
example/tests/source2.test.ts (1)
assembly/index.ts (1)
  • describe (17-19)
🔇 Additional comments (14)
example/.gitignore (1)

1-2: LGTM!

标准的 Node.js 项目忽略模式,与生成覆盖率报告的 CI 配置一致。

example/tests/source2.test.ts (1)

1-4: LGTM!

导入路径已正确更新为使用外部框架,模块路径调整合理,且修复了测试描述中的拼写错误("quick_sork" → "quick_sort")。

package.json (1)

82-86: LGTM!

config.d.tsdocs/**/* 添加到发布文件列表中,使类型定义和文档可供包的使用者访问,这是正确的做法。

example/tests/source.test.ts (1)

1-3: LGTM!

导入语句已正确更新,与 source2.test.ts 中的变更保持一致,使用外部框架并调整了模块路径。

.github/workflows/ci-test.yml (1)

45-50: LGTM!

正确添加了示例项目的 CI 测试步骤,使用 set -e 确保任何命令失败时步骤失败,并测试了 ESM 和 CJS 两种配置。

example/package.json (1)

5-5: LGTM!

使用 file:.. 引用本地依赖是正确的做法,适用于示例项目测试父包。

docs/api-documents/configuration.md (1)

3-5: LGTM!

将文档更新为引用 config.d.ts 类型声明文件,而不是内联模板,这是更好的实践,提高了可维护性并确保文档与类型定义保持一致。

example/as-test.config.cjs (1)

1-4: LGTM!

配置更新合理:

  • JSDoc 类型注解提供了类型检查支持
  • includeexclude 路径调整与新的目录结构一致
  • 简化的排除模式更清晰
config.d.ts (3)

1-1: LGTM!

导入声明正确,从编译后的 dist/interface.d.ts 导入 Imports 类型用于类型定义文件。


3-3: LGTM!

OutputMode 类型定义清晰,涵盖了三种输出模式。


5-29: LGTM!

Config 类的整体结构设计合理,属性定义清晰,默认值在注释中说明充分。isolated 属性的注释明确指出未来版本的默认值变化,这是良好的向前兼容性实践。

example/as-test.config.js (3)

1-1: LGTM!

添加 JSDoc 类型注解是最佳实践,为配置对象提供了类型检查和 IDE 智能提示支持。


21-21: LGTM!

显式设置 isolated: false 是个好选择,可以在大型项目中显著减少测试运行时间。根据学习资料,这个选项在 1.3.0 版本中引入,用于优化性能。

根据学习资料


3-4: 配置路径与目录结构一致
已验证 example/testsexample/lib 目录存在并包含预期文件,无需修改。

@HerrCai0907
Copy link
Contributor Author

@coderabbitai summary

@coderabbitai
Copy link

coderabbitai bot commented Oct 9, 2025

✅ Actions performed

Summary regeneration triggered.

@wasm-ecosystem wasm-ecosystem deleted a comment from coderabbitai bot Oct 9, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 9, 2025

Caution

Review failed

The head commit changed during the review from cac9125 to c8e5633.

\n\n## Walkthrough\nAdds an example package with tests and configuration, publishes a new TypeScript declaration config.d.ts for public config types, updates documentation to reference the new types, adjusts package manifest files, and extends CI to run npm install and tests inside the example directory (including a CJS-config run).\n\n## Changes\n| Cohort / File(s) | Summary |\n| --- | --- |\n| CI: example test step
.github/workflows/ci-test.yml | Adds a step to the test job that runs in ./example: npm ci, npm run test, and npm run test:cjs (script wrapped with set -e). |\n| Public config type declaration
config.d.ts | New declaration file exposing OutputMode (\"html\" | \"json\" | \"table\"), exported Config class with properties (include, exclude, collectCoverage, isolated, flags, imports, temp, output, mode), and import of Imports from ./dist/interface.d.ts; adds ImportsArgument and UnitTestFramework types referenced by docs. |\n| Docs: configuration API
docs/api-documents/configuration.md | Replaced inline JS template with references to the new config.d.ts API surface; documents typed interfaces/classes (e.g., ImportsArgument, UnitTestFramework) instead of runtime template code. |\n| Example project files
example/.gitignore, example/package.json | Adds .gitignore (ignore node_modules, coverage); adds example/package.json (ESM, local dependency on framework, scripts: test, test:cjs). |\n| Example config files
example/as-test.config.js, example/as-test.config.cjs | Adjusts include to [\"tests\"], exclude to [\"lib\"]; JS version adds JSDoc type annotation referencing config.d.ts and adds isolated: false; removes previous inline/template comments. |\n| Example tests
example/tests/source.test.ts, example/tests/source2.test.ts | Update import paths to use external package assemblyscript-unittest-framework/assembly, adjust relative imports to ../assembly/..., and fix test name typo (quick_sort). |\n| Package manifest / published files
package.json | Removes scripts.example; updates files list to include config.d.ts, dist/**/*, and transform/**/* (reorders/ensures published artifacts). |\n\n## Sequence Diagram(s)\nmermaid\nsequenceDiagram\n autonumber\n participant GH as GitHub Actions (ci-test job)\n participant Repo as Repository workspace\n participant Example as ./example workspace\n GH->>Repo: checkout\n GH->>Example: run step (working-directory: ./example)\n Note right of Example #DDEEFF: sequential shell script (set -e)\n Example->>Example: npm ci\n Example->>Example: npm run test\n Example->>Example: npm run test:cjs\n GH->>GH: continue remaining job steps (e.g., verify ccache stats)\n\n\n## Estimated code review effort\n🎯 3 (Moderate) | ⏱️ ~25 minutes\n\n

\n\n## Pre-merge checks and finishing touches\n
\n✅ Passed checks (3 passed)\n\n| Check name | Status | Explanation |\n| :----------------: | :------- | :------------------------------------------------------------------- |\n| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |\n| Title Check | ✅ Passed | 此标题使用了约定的 chore(doc) 前缀,并清晰准确地概括了主要变更,即更新配置文档和示例,与所提交的文件修改内容保持一致。 |\n| Docstring Coverage | ✅ Passed | No functions found in the changes. Docstring coverage check skipped. |\n\n
\n\n

Comment @coderabbitai help to get the list of available commands and usage tips.

@HerrCai0907
Copy link
Contributor Author

@coderabbitai summary

@coderabbitai
Copy link

coderabbitai bot commented Oct 9, 2025

✅ Actions performed

Summary regeneration triggered.

@HerrCai0907 HerrCai0907 merged commit 1d54831 into main Oct 9, 2025
2 checks passed
@HerrCai0907 HerrCai0907 deleted the doc branch October 9, 2025 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants