Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ nodevu is composed of a set of modules:
## Development

- `npm test` and `npm run coverage` run every module's tests.
- `npm run lint` checks the whole repo with oxlint and oxfmt.
- `npm run lint` checks the whole repo with oxlint and oxfmt, and checks with [docov](https://github.com/cutenode/docov) that everything the modules export has JSDoc. `docov.jsonc` sets what it scans.
- `npm run types` type-checks the JSDoc and writes each module's TypeScript declarations to its `types/` folder. Commit them: CI fails when they're out of date.
- `npm run docs:dev` builds the docs from `docs/pages/` with [doc-kit](https://doc-kit.nodejs.org/) and serves them locally. `npm run docs` only builds them, into `out/`.

Expand Down
5 changes: 5 additions & 0 deletions core/util/dev/beforeEachTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ const {
const staticIndex = require('../../test/data/static/index.json');
const staticSchedule = require('../../test/data/static/schedule.json');

/**
* Mocks the network for a test: the default and `https://bnb.im` index.json
* and schedule.json URLs serve core's static snapshots, and any other request
* fails.
*/
function beforeEachTemplate() {
// this fixes a bug in Node.js - it should be fixed _eventually_ and can be removed: https://github.com/nodejs/undici/issues/1248
dns.setDefaultResultOrder('ipv4first');
Expand Down
10 changes: 6 additions & 4 deletions core/util/dev/fixtures.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const index = require('../../test/data/static/index.json');
const schedule = require('../../test/data/static/schedule.json');

// returns options for @nodevu/core (and the packages built on it) that serve
// `data` (core's index.json and schedule.json snapshots by default) instead of
// fetching them, only including releases that were out by `now`, like the
// real index.json. any other URL throws, so tests never touch the network.
/**
* Returns options for @nodevu/core (and the packages built on it) that serve
* `data` (core's index.json and schedule.json snapshots by default) instead of
* fetching them, only including releases that were out by `now`, like the
* real index.json. Any other URL throws, so tests never touch the network.
*/
function at(now, data = { index, schedule }) {
return {
now,
Expand Down
3 changes: 3 additions & 0 deletions core/util/dev/write.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const { writeFile } = require('node:fs/promises');
const { resolve } = require('node:path');

/**
* Writes `data` to `path` as tab-indented JSON.
*/
async function write(path, data) {
const outputJSON = JSON.stringify(data, null, '\t');
const filepath = resolve(path);
Expand Down
12 changes: 12 additions & 0 deletions docov.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://raw.githubusercontent.com/cutenode/docov/v0.1.1/docov.schema.json",
"exclude": [
"**/test/**",
// generated from the JSDoc by `npm run types`, and TypeScript 7 leaves
// @typedef descriptions out of them
"*/types/**",
// vendored oxlint plugin
"tools/oxlint/anti-slop/**",
],
"threshold": 100,
}
8 changes: 5 additions & 3 deletions docs/theme/Navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import Logo from '#theme/Logo';

import styles from '@node-core/ui-components/Containers/NavBar/index.module.css';

// doc-kit's navigation bar, except the logo links to the site's index
// relative to the page. the NavBar links it to `/`, which leaves the site
// when it's served from a subpath, like GitHub Pages' /nodevu/
/**
* doc-kit's navigation bar, except the logo links to the site's index
* relative to the page. The NavBar links it to `/`, which leaves the site
* when it's served from a subpath, like GitHub Pages' /nodevu/.
*/
export default ({ metadata }) => {
const home = `${relativeOrAbsolute('/index', metadata.path)}.html`;

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "comprehensive node.js version tooling",
"main": "index.js",
"scripts": {
"lint": "oxlint && oxfmt --check",
"lint": "oxlint && oxfmt --check && docov",
"lint:write": "oxlint --fix && oxfmt",
"coverage": "npm run coverage --ws --if-present",
"test": "npm run test --ws",
Expand Down Expand Up @@ -42,6 +42,7 @@
"devDependencies": {
"@doc-kit/cli": "1.0.5",
"@doc-kit/generator-react": "0.5.0",
"@docov/cli": "0.1.1",
"@node-core/ui-components": "1.8.1",
"@oxlint/plugins": "1.89.0",
"@types/luxon": "3.7.6",
Expand Down
3 changes: 3 additions & 0 deletions static/util/dev/write.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const { writeFile } = require('node:fs/promises');
const { resolve } = require('node:path');

/**
* Writes `data` to `path` as JSON indented with two spaces.
*/
async function write(path, data) {
const outputJSON = JSON.stringify(data, null, 2);
let filepath = resolve(path);
Expand Down
Loading