Skip to content

Commit 7316ecd

Browse files
Website audit: fix factual inaccuracies, relocate Too Many Cooks, add dart_node_sql_js (#63)
## TLDR Hard audit of the docs website: stubs out the relocated Too Many Cooks, fixes factual inaccuracies (publisher, GitHub casing, social handle, stale versions, broken links, wrong API code examples), surfaces the published `dart_node_sql_js`, and repairs SEO/social metadata. ## What Was Added? - **`dart_node_sql_js`** surfaced everywhere it was missing: homepage stack card (en/zh), homepage `ItemList` schema, docs nav (en/zh), API index (en/zh), a generated docs page, and a new Chinese README (`packages/dart_node_sql_js/README_zh.md`). Added to the docs-generation and API-generation pipelines. - **`og-image.png` (1200×630)** and **`apple-touch-icon.png` (180×180)** — the social-card/JSON-LD image and apple-touch-icon were referenced everywhere but the files did not exist (404). Generated branded assets. - **nimblesite.co** copyright link in the footer. ## What Was Changed or Deleted? - **Too Many Cooks** moved to https://tmc-mcp.dev: homepage cards (en/zh) and the MCP & vsix READMEs now point there and state it is no longer part of this repo. Removed from the homepage package `ItemList` (it is not a `dart_node` package). - **Factual corrections (sitewide):** pub.dev publisher `dartnode.dev` → `christianfindlay.com` (verified); GitHub casing → `MelbourneDeveloper`; X/Twitter `@dart_node` → `@cfdevelop` (the real, active handle). - **Unpublished packages** (`dart_jsx`, `dart_node_vsix`, both `publish_to: none`) no longer link to 404 pub.dev pages — they link to GitHub source. The docs-generator does this automatically for any unpublished package. - **Broken links:** footer `/docs/examples/` (no such page) → GitHub examples; **125 broken `/api/../…` dartdoc cross-links** fixed by collapsing the full leading `../` run in the API link rewriter. - **Stale versions:** install snippets `^0.11.0-beta` → `^0.13.0-beta` (latest published); wrong `nadz: ^0.9.0` → `^0.0.7-beta` (actual constraint). - **Code examples** in package READMEs/blog corrected to the real package APIs (react `text()`→string / `p()`→`pEl` / `Document.getElementById` / `button(text:)`; react_native `image()`→`rnImage`, `flatList` signature, `ScreenProps`; express `req.params` access + `dart:js_interop_unsafe` import + router mount; mcp full 5-field `ToolConfig`; better_sqlite3 `Result` handling; logging `LogFunction` transport signature). - **dart-to-js doc:** `-O1` is the dart2js default (was wrongly `-O2`), removed a reference to a nonexistent build tool, fixed the `--dump-info` reference. - Removed a phantom `SearchAction` from the WebSite JSON-LD (no `/search` route exists); shortened an over-long (67-char) blog `<title>`. - Upgraded `eleventy-plugin-techdoc` 0.1.0 → 0.2.0 and `@11ty/eleventy` → 3.1.6, and audited the upgraded output. ## How Do The Automated Tests Prove It Works? - `npm run build` completes with **0 warnings / 0 errors** across all 10 packages' dartdoc + Eleventy (2424 pages), including the newly-added `dart_node_sql_js` API docs. - A full internal-link crawl of the generated `_site` dropped broken targets from **177 → 52**; every remaining target is pre-existing (see below), and a string sweep confirms **0** occurrences of the old publisher / GitHub casing / `@dart_node` / `/docs/examples` / `too_many_cooks` package links. - Each code-example change was reviewed in the git diff against the actual package `lib/` (and `test/`/`example/`) — e.g. `flatList(JSArray data, JSFunction renderItem, props:)`, `ToolConfig` 5-field record matching `runtime_test.dart`, `LogFunction = void Function(LogMessage, LogLevel)` matching `log_to_console.dart`. - Playwright (1280×720 and 375×667): homepage, `/docs/react/`, `/docs/sql-js/` (en/zh), `/docs/getting-started/` load with **no console errors**; `og-image.png`/`apple-touch-icon.png` return 200. **Known pre-existing issues (not introduced here, out of scope):** 40 links on the `dart_logging` API landing page (its two-library dartdoc layout isn't mapped to member pages by the generator), 10 hreflang/language-switcher links to untranslated zh blog pages, and 2 reflux dartdoc self-links. ## Spec / Doc Changes This PR is primarily docs/website. Package `README.md`/`README_zh.md` files were edited (they are the source for the generated docs pages); no library code, pubspecs, or tests were changed. ## Breaking Changes - [x] None
1 parent 7674cac commit 7316ecd

43 files changed

Lines changed: 954 additions & 702 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ website/src/zh/api/dart_node_react/
105105
website/src/zh/api/dart_node_react_native/
106106
website/src/zh/api/dart_node_ws/
107107
website/src/zh/api/dart_node_better_sqlite3/
108+
website/src/zh/api/dart_node_sql_js/
108109
website/src/zh/api/dart_node_mcp/
109110
website/src/zh/api/dart_logging/
110111
website/src/zh/api/reflux/

‎packages/dart_logging/README.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Pino-style structured logging with child loggers. Provides hierarchical logging
55

66
```yaml
77
dependencies:
8-
dart_logging: ^0.11.0-beta
8+
dart_logging: ^0.13.0-beta
99
```
1010
1111
## Quick Start
@@ -81,9 +81,10 @@ This is useful for adding context that applies to a scope (like a request handle
8181
Create custom transports to send logs to different destinations:
8282

8383
```dart
84-
void myTransport(LogEntry entry) {
84+
void myTransport(LogMessage message, LogLevel minimumLogLevel) {
85+
if (message.logLevel.index < minimumLogLevel.index) return;
8586
// Send to external service, file, etc.
86-
print('${entry.level}: ${entry.message}');
87+
print('${message.logLevel}: ${message.message}');
8788
}
8889
8990
final context = createLoggingContext(
@@ -119,4 +120,4 @@ void main() {
119120

120121
## Source Code
121122

122-
The source code is available on [GitHub](https://github.com/melbournedeveloper/dart_node/tree/main/packages/dart_logging).
123+
The source code is available on [GitHub](https://github.com/MelbourneDeveloper/dart_node/tree/main/packages/dart_logging).

‎packages/dart_logging/README_zh.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Pino 风格的结构化日志,支持子日志器。提供具有自动上下文
55

66
```yaml
77
dependencies:
8-
dart_logging: ^0.11.0-beta
8+
dart_logging: ^0.13.0-beta
99
```
1010
1111
## 快速开始
@@ -81,9 +81,9 @@ userLogger.info('Action'); // 同时包含 requestId 和 userId
8181
创建自定义传输以将日志发送到不同目的地:
8282

8383
```dart
84-
void myTransport(LogEntry entry) {
84+
void myTransport(LogMessage message, LogLevel minimumLogLevel) {
8585
// 发送到外部服务、文件等
86-
print('${entry.level}: ${entry.message}');
86+
print('${message.logLevel}: ${message.message}');
8787
}
8888
8989
final context = createLoggingContext(
@@ -119,4 +119,4 @@ void main() {
119119

120120
## 源代码
121121

122-
源代码可在 [GitHub](https://github.com/melbournedeveloper/dart_node/tree/main/packages/dart_logging) 上获取。
122+
源代码可在 [GitHub](https://github.com/MelbourneDeveloper/dart_node/tree/main/packages/dart_logging) 上获取。

‎packages/dart_node_better_sqlite3/README.md‎

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Typed Dart bindings for [better-sqlite3](https://github.com/WiseLibs/better-sqli
55

66
```yaml
77
dependencies:
8-
dart_node_better_sqlite3: ^0.11.0-beta
9-
nadz: ^0.9.0
8+
dart_node_better_sqlite3: ^0.13.0-beta
9+
nadz: ^0.0.7-beta
1010
```
1111
1212
Also install the npm package:
@@ -41,7 +41,10 @@ void main() {
4141
Error(:final error) => throw Exception(error),
4242
};
4343
44-
final rows = query.all([]);
44+
final rows = switch (query.all()) {
45+
Success(:final value) => value,
46+
Error(:final error) => throw Exception(error),
47+
};
4548
print(rows);
4649
4750
db.close();
@@ -93,22 +96,32 @@ final query = switch (db.prepare('SELECT * FROM users WHERE id = ?')) {
9396
};
9497
9598
// Get single row
96-
final row = query.get([1]);
99+
final row = switch (query.get([1])) {
100+
Success(:final value) => value,
101+
Error(:final error) => throw Exception(error),
102+
};
97103
98104
// Get all rows
99-
final allRows = query.all([]);
105+
final allRows = switch (query.all()) {
106+
Success(:final value) => value,
107+
Error(:final error) => throw Exception(error),
108+
};
100109
```
101110

102111
### Transactions
103112

104113
```dart
105114
db.exec('BEGIN');
106-
try {
107-
// Multiple operations...
108-
db.exec('COMMIT');
109-
} catch (e) {
110-
db.exec('ROLLBACK');
111-
rethrow;
115+
116+
// Multiple operations...
117+
final result = db.exec('INSERT INTO users (name) VALUES (?)');
118+
119+
switch (result) {
120+
case Success():
121+
db.exec('COMMIT');
122+
case Error(:final error):
123+
db.exec('ROLLBACK');
124+
throw Exception(error);
112125
}
113126
```
114127

@@ -124,4 +137,4 @@ node app.js
124137

125138
## Source Code
126139

127-
The source code is available on [GitHub](https://github.com/melbournedeveloper/dart_node/tree/main/packages/dart_node_better_sqlite3).
140+
The source code is available on [GitHub](https://github.com/MelbourneDeveloper/dart_node/tree/main/packages/dart_node_better_sqlite3).

‎packages/dart_node_better_sqlite3/README_zh.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
```yaml
77
dependencies:
8-
dart_node_better_sqlite3: ^0.11.0-beta
9-
nadz: ^0.9.0
8+
dart_node_better_sqlite3: ^0.13.0-beta
9+
nadz: ^0.0.7-beta
1010
```
1111
1212
通过 npm 安装:
@@ -124,4 +124,4 @@ node app.js
124124

125125
## 源代码
126126

127-
源代码可在 [GitHub](https://github.com/melbournedeveloper/dart_node/tree/main/packages/dart_node_better_sqlite3) 上获取。
127+
源代码可在 [GitHub](https://github.com/MelbourneDeveloper/dart_node/tree/main/packages/dart_node_better_sqlite3) 上获取。

‎packages/dart_node_core/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
```yaml
77
dependencies:
8-
dart_node_core: ^0.11.0-beta
8+
dart_node_core: ^0.13.0-beta
99
```
1010
1111
## Core Utilities
@@ -90,4 +90,4 @@ void main() {
9090

9191
## Source Code
9292

93-
The source code is available on [GitHub](https://github.com/melbournedeveloper/dart_node/tree/main/packages/dart_node_core).
93+
The source code is available on [GitHub](https://github.com/MelbourneDeveloper/dart_node/tree/main/packages/dart_node_core).

‎packages/dart_node_core/README_zh.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
```yaml
77
dependencies:
8-
dart_node_core: ^0.11.0-beta
8+
dart_node_core: ^0.13.0-beta
99
```
1010
1111
## 核心工具
@@ -90,4 +90,4 @@ void main() {
9090

9191
## 源代码
9292

93-
源代码可在 [GitHub](https://github.com/melbournedeveloper/dart_node/tree/main/packages/dart_node_core) 上获取。
93+
源代码可在 [GitHub](https://github.com/MelbourneDeveloper/dart_node/tree/main/packages/dart_node_core) 上获取。

‎packages/dart_node_express/README.md‎

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Type-safe Express.js bindings for Dart. Build HTTP servers and REST APIs entirel
66

77
```yaml
88
dependencies:
9-
dart_node_express: ^0.11.0-beta
9+
dart_node_express: ^0.13.0-beta
1010
```
1111
1212
Also install Express via npm:
@@ -50,7 +50,7 @@ app.post('/users', handler((req, res) {
5050
}));
5151
5252
app.put('/users/:id', handler((req, res) {
53-
final id = req.params['id'];
53+
final id = req.params['id'].toString();
5454
res.jsonMap({'updated': id});
5555
}));
5656
@@ -64,8 +64,8 @@ app.delete('/users/:id', handler((req, res) {
6464

6565
```dart
6666
app.get('/users/:userId/posts/:postId', handler((req, res) {
67-
final userId = req.params['userId'];
68-
final postId = req.params['postId'];
67+
final userId = req.params['userId'].toString();
68+
final postId = req.params['postId'].toString();
6969
7070
res.jsonMap({
7171
'userId': userId,
@@ -78,8 +78,8 @@ app.get('/users/:userId/posts/:postId', handler((req, res) {
7878

7979
```dart
8080
app.get('/search', handler((req, res) {
81-
final query = req.query['q'];
82-
final page = int.tryParse(req.query['page'] ?? '1') ?? 1;
81+
final query = req.query['q']?.toString();
82+
final page = int.tryParse(req.query['page']?.toString() ?? '1') ?? 1;
8383
8484
res.jsonMap({
8585
'query': query,
@@ -98,7 +98,7 @@ app.post('/api/data', handler((req, res) {
9898
final body = req.body;
9999
100100
// Headers
101-
final contentType = req.headers['content-type'];
101+
final contentType = req.headers['content-type']?.toString();
102102
103103
// URL path
104104
final path = req.path;
@@ -188,6 +188,10 @@ app.get('/profile', handler((req, res) {
188188
Organize routes with the Router:
189189

190190
```dart
191+
import 'dart:js_interop';
192+
import 'dart:js_interop_unsafe';
193+
import 'package:dart_node_express/dart_node_express.dart';
194+
191195
Router createUserRouter() {
192196
final router = Router();
193197
@@ -201,18 +205,28 @@ Router createUserRouter() {
201205
}));
202206
203207
router.get('/:id', handler((req, res) {
204-
res.jsonMap({'user': req.params['id']});
208+
res.jsonMap({'user': req.params['id'].toString()});
205209
}));
206210
207211
return router;
208212
}
209213
214+
// Mount a Router at a path. Express Routers are callable middleware,
215+
// and `use` accepts a path (as JSAny?) plus a middleware JSFunction.
216+
void mountRouter(ExpressApp app, String path, Router router) {
217+
final routerFn = switch (router as JSAny) {
218+
final JSFunction f => f,
219+
_ => throw StateError('Router is not callable'),
220+
};
221+
app.use(path.toJS, routerFn);
222+
}
223+
210224
void main() {
211225
final app = express();
212226
213227
// Mount the router
214228
final router = createUserRouter();
215-
app.use('/api/users', router);
229+
mountRouter(app, '/api/users', router);
216230
217231
app.listen(3000);
218232
}
@@ -312,7 +326,7 @@ void main() {
312326
}));
313327
314328
// Mount routers
315-
app.use('/api/users', createUserRouter());
329+
mountRouter(app, '/api/users', createUserRouter());
316330
317331
// Start server
318332
app.listen(3000, () {
@@ -323,4 +337,4 @@ void main() {
323337

324338
## Source Code
325339

326-
The source code is available on [GitHub](https://github.com/melbournedeveloper/dart_node/tree/main/packages/dart_node_express).
340+
The source code is available on [GitHub](https://github.com/MelbourneDeveloper/dart_node/tree/main/packages/dart_node_express).

‎packages/dart_node_express/README_zh.md‎

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
```yaml
88
dependencies:
9-
dart_node_express: ^0.11.0-beta
9+
dart_node_express: ^0.13.0-beta
1010
```
1111
1212
通过 npm 安装 Express:
@@ -50,7 +50,7 @@ app.post('/users', handler((req, res) {
5050
}));
5151
5252
app.put('/users/:id', handler((req, res) {
53-
final id = req.params['id'];
53+
final id = req.params['id'].toString();
5454
res.jsonMap({'updated': id});
5555
}));
5656
@@ -64,8 +64,8 @@ app.delete('/users/:id', handler((req, res) {
6464

6565
```dart
6666
app.get('/users/:userId/posts/:postId', handler((req, res) {
67-
final userId = req.params['userId'];
68-
final postId = req.params['postId'];
67+
final userId = req.params['userId'].toString();
68+
final postId = req.params['postId'].toString();
6969
7070
res.jsonMap({
7171
'userId': userId,
@@ -78,8 +78,8 @@ app.get('/users/:userId/posts/:postId', handler((req, res) {
7878

7979
```dart
8080
app.get('/search', handler((req, res) {
81-
final query = req.query['q'];
82-
final page = int.tryParse(req.query['page'] ?? '1') ?? 1;
81+
final query = req.query['q'].toString();
82+
final page = int.tryParse(req.query['page']?.toString() ?? '1') ?? 1;
8383
8484
res.jsonMap({
8585
'query': query,
@@ -98,7 +98,7 @@ app.post('/api/data', handler((req, res) {
9898
final body = req.body;
9999
100100
// 请求头
101-
final contentType = req.headers['content-type'];
101+
final contentType = req.headers['content-type'].toString();
102102
103103
// URL 路径
104104
final path = req.path;
@@ -201,7 +201,7 @@ Router createUserRouter() {
201201
}));
202202
203203
router.get('/:id', handler((req, res) {
204-
res.jsonMap({'user': req.params['id']});
204+
res.jsonMap({'user': req.params['id'].toString()});
205205
}));
206206
207207
return router;
@@ -212,7 +212,9 @@ void main() {
212212
213213
// 挂载路由器
214214
final router = createUserRouter();
215-
app.use('/api/users', router);
215+
if (router case final JSFunction fn) {
216+
app.use('/api/users'.toJS, fn);
217+
}
216218
217219
app.listen(3000);
218220
}
@@ -312,7 +314,9 @@ void main() {
312314
}));
313315
314316
// 挂载路由器
315-
app.use('/api/users', createUserRouter());
317+
if (createUserRouter() case final JSFunction fn) {
318+
app.use('/api/users'.toJS, fn);
319+
}
316320
317321
// 启动服务器
318322
app.listen(3000, () {
@@ -323,4 +327,4 @@ void main() {
323327

324328
## 源代码
325329

326-
源代码可在 [GitHub](https://github.com/melbournedeveloper/dart_node/tree/main/packages/dart_node_express) 上获取。
330+
源代码可在 [GitHub](https://github.com/MelbourneDeveloper/dart_node/tree/main/packages/dart_node_express) 上获取。

0 commit comments

Comments
 (0)