chore(config): trim comments in build config, scripts and docs tooling

Compress the CSS-channel note in tsdown.config.ts, the vitest lane
explainer and the release workflow header; fix the install-hooks header
(git only consults .git/hooks when core.hooksPath is unset); slim the
social-preview generator and bundle-patch comments.
This commit is contained in:
bowenliang123 committed 2026-08-24 17:16:40 +08:00
1 parent 89fc5674c7
commit d0b8f0daa0
6 files changed
+15 -32

No files matched your search

+3 -6
View File
@@ -1,11 +1,8 @@
name: Publish to npm
# Fires when a release tag (v*) is pushed — the same tag our release flow
# creates (`git tag vX.Y.Z && gh release create`). Publishing uses npm
# Trusted Publishing (OIDC): no long-lived token is needed, and provenance
# attestations are generated automatically (npm CLI >= 11.5.1 auto-detects
# the OIDC environment). The npm-side trusted publisher must be configured
# with this exact workflow filename: `release.yml`.
# Fires on a release tag (v*) push. Publishing uses npm Trusted Publishing
# (OIDC), so no long-lived token is needed — the npm-side trusted publisher
# must be configured with this exact workflow filename.
on:
push:
tags:
+3 -7
View File
@@ -1,10 +1,6 @@
# dsh-context — bundle patch layer.
#
# Installing this package into a profile (`dsh plugin --profile <name> add dsh-context`)
# appends it to `dsh.profile.bundles`; this patch is then applied as that
# bundle's layer. The row below loads the package's main entry as the host
# half (a plain Cordis plugin) and, because the package declares `dsh.client`,
# the web app also loads its `./client` bundle as the browser half.
# Bundle patch layer: the row loads the package's main entry as the host half
# (a plain Cordis plugin); the `dsh.client` declaration makes the web app load
# its ./client bundle as the browser half.
- insert:
- id: dsh-context
name: dsh-context
+3 -5
View File
@@ -1,6 +1,6 @@
// Renders social-preview.html to docs/social-preview.png (exactly 1280x640).
// Renders at 2x (2560x1280) first, then downsamples via Chromium's high-quality
// image smoothing, so text and the embedded screenshot stay sharp.
// Renders social-preview.html to docs/social-preview.png (exactly 1280x640):
// 2x first (2560x1280), then downsampled via Chromium's high-quality image
// smoothing so text and the embedded screenshot stay sharp.
// Usage: node docs/social-preview/generate.ts (or: npm run social-preview)
import { chromium } from 'playwright-core';
import { homedir } from 'node:os';
@@ -22,14 +22,12 @@ const executablePath = path.join(
fs.mkdirSync(tmpDir, { recursive: true });
const browser = await chromium.launch({ executablePath });
// Pass 1: render the design at 2x.
const page1 = await browser.newPage({ viewport: { width: 1280, height: 640 }, deviceScaleFactor: 2 });
await page1.goto(pathToFileURL(htmlPath).href);
await page1.waitForLoadState('load');
await page1.screenshot({ path: hiResPath, clip: { x: 0, y: 0, width: 1280, height: 640 } });
await page1.close();
// Pass 2: downsample the 2x render to the final 1280x640.
const dataUrl = `data:image/png;base64,${fs.readFileSync(hiResPath).toString('base64')}`;
const page2 = await browser.newPage({ viewport: { width: 1280, height: 640 } });
await page2.setContent(
+2 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Installs the repo's git hooks natively (no husky), so `pnpm run typecheck`
# runs on every commit. Requires the repo to be a git working tree.
# Installs a native pre-commit hook that runs `pnpm run typecheck`. Git only
# executes .git/hooks when `core.hooksPath` is unset (husky sets it to .husky/_).
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+3 -9
View File
@@ -49,20 +49,15 @@ const isProductionDependency = (specifier: string): boolean =>
const NODE_ENV = process.env.NODE_ENV ?? 'production'
// ---- CSS channels, mirrored from the official preset ---------------------
// (packages/client/tsdown.client.ts). The virtual-id wrapper keeps stylesheets
// away from tsdown's own css pipeline: its guard matches ids ending in `.css`,
// so the virtual id must not. `.module.css` yields a hashed class map and
// injects a tagged style at factory execution; `.css?inline` exports compiled
// text; a plain `.css` import injects the sheet unhashed (the plugin's own
// lc-* namespace stays the anti-collision discipline).
// CSS channels, mirrored from packages/client/tsdown.client.ts. The virtual
// ids must NOT end in `.css` — tsdown's own css-pipeline guard matches on that
// suffix; the plugin's flat lc-* class namespace is the anti-collision rule.
const CSS_VIRTUAL_PREFIX = '\0dsh-css:'
const GLOBAL_CSS_VIRTUAL_PREFIX = '\0dsh-global-css:'
const INLINE_CSS_VIRTUAL_PREFIX = '\0dsh-inline-css:'
const CSS_VIRTUAL_SUFFIX = '.mjs'
const INLINE_CSS_QUERY = '?inline'
/** Emit one plugin-owned style injector and an optional CSS Modules export. */
function styleInjectionModule(
id: string,
fileId: string,
@@ -84,7 +79,6 @@ function styleInjectionModule(
return source.join('\n')
}
/** Resolve a stylesheet import against the importing source file. */
function sourceAssetPath(source: string, importer: string): string {
return resolvePath(dirname(importer), source)
}
+1 -3
View File
@@ -2,9 +2,7 @@ import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
// Specs exercise the BUILT artifacts (lib/), so `pnpm run build` first.
// `*.client.spec.ts` is the browser lane (jsdom pragma per file); the
// plain `*.spec.ts` files run in node with their own fakes.
// Specs exercise the built lib/ artifacts — `pnpm run build` first; *.client.spec.ts is the jsdom browser lane.
include: ['tests/**/*.spec.ts'],
},
})