From 83c4dbd21c1c6da070f2c8a966d97684d9dfc469 Mon Sep 17 00:00:00 2001 From: Bret Comnes Date: Mon, 18 May 2026 18:25:37 -0700 Subject: [PATCH 1/4] Update cpx2 to v9 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 47345e0..16be876 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "browser-sync": "^3.0.2", "chokidar": "^5.0.0", "clean-deep": "^3.4.0", - "cpx2": "^8.0.0", + "cpx2": "^9.0.0", "esbuild": "^0.28.0", "handlebars": "^4.7.8", "highlight.js": "^11.9.0", From 9aac646823ba1ace8aead1b250b9a6874d7646a7 Mon Sep 17 00:00:00 2001 From: Bret Comnes Date: Mon, 18 May 2026 18:42:33 -0700 Subject: [PATCH 2/4] Fix tests --- .github/workflows/tests.yml | 4 ++-- .gitignore | 1 + index.js | 7 +++---- lib/build-copy/index.js | 6 ++---- lib/build-static/index.js | 6 ++---- lib/helpers/generate-tree-data.js | 5 +++-- package.json | 7 +++---- 7 files changed, 16 insertions(+), 20 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bde822b..6ab85ba 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node-version: [lts/*, '23'] + node-version: [lts/*, latest] steps: - uses: actions/checkout@v6 @@ -34,7 +34,7 @@ jobs: uses: coverallsapp/github-action@v2 with: github-token: ${{ secrets.GITHUB_TOKEN }} - files: coverage/lcov.info + files: lcov.info parallel: true coverage: diff --git a/.gitignore b/.gitignore index d718427..1f2e3fe 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ sandbox.js package-lock.json public coverage +lcov.info .tap .tmp-* diff --git a/index.js b/index.js index 3a062db..1fdc92f 100644 --- a/index.js +++ b/index.js @@ -18,8 +18,7 @@ import { basename, dirname, relative, resolve } from 'node:path' // @ts-expect-error import makeArray from 'make-array' import ignore from 'ignore' -// @ts-expect-error -import cpx from 'cpx2' +import { watch as cpxWatch } from 'cpx2' import { inspect } from 'util' import browserSync from 'browser-sync' import { find } from '@11ty/dependency-tree-typescript' @@ -250,8 +249,8 @@ export class DomStack { const copyDirs = getCopyDirs(this.opts.copy) this.#cpxWatchers = [ - cpx.watch(getCopyGlob(this.#src), this.#dest, { ignore: this.opts.ignore }), - ...copyDirs.map(copyDir => cpx.watch(copyDir, this.#dest)) + cpxWatch(getCopyGlob(this.#src), this.#dest, { ignore: this.opts.ignore }), + ...copyDirs.map(copyDir => cpxWatch(copyDir, this.#dest)) ] if (serve) { const bs = browserSync.create() diff --git a/lib/build-copy/index.js b/lib/build-copy/index.js index 5b81b9e..693e8bb 100644 --- a/lib/build-copy/index.js +++ b/lib/build-copy/index.js @@ -2,10 +2,8 @@ * @import { BuildStepResult, BuildStep } from '../builder.js' */ -// @ts-expect-error -import cpx from 'cpx2' +import { copy } from 'cpx2' import { join } from 'node:path' -const copy = cpx.copy /** * @typedef {BuildStepResult<'static', CopyBuilderReport>} CopyBuildStepResult @@ -51,7 +49,7 @@ export async function buildCopy (_src, dest, _siteData, opts) { const buildError = new Error('Error copying copy folders', { cause: result.reason }) results.errors.push(buildError) } else { - results.report[copyDir] = result.value + /** @type {Record} */ (results.report)[copyDir] = result.value } } return results diff --git a/lib/build-static/index.js b/lib/build-static/index.js index 934dc33..08315db 100644 --- a/lib/build-static/index.js +++ b/lib/build-static/index.js @@ -2,9 +2,7 @@ * @import { BuildStepResult } from '../builder.js' * @import { BuildStep } from '../builder.js' */ -// @ts-ignore -import cpx from 'cpx2' -const copy = cpx.copy +import { copy } from 'cpx2' /** * @typedef {Awaited>} StaticBuilderReport @@ -42,7 +40,7 @@ export async function buildStatic (src, dest, _siteData, opts) { } try { - const report = await copy(getCopyGlob(src), dest, { ignore: opts?.ignore }) + const report = await copy(getCopyGlob(src), dest, ...(opts?.ignore ? [{ ignore: opts.ignore }] : [])) results.report = report } catch (err) { const buildError = new Error('Error copying static files', { cause: err }) diff --git a/lib/helpers/generate-tree-data.js b/lib/helpers/generate-tree-data.js index 8d18a06..12d4449 100644 --- a/lib/helpers/generate-tree-data.js +++ b/lib/helpers/generate-tree-data.js @@ -128,8 +128,9 @@ export function generateTreeData (cwd, src, dest, results) { if (layoutInfo.layoutClient) targetNode.leaf[layoutInfo.layoutClient.basename] = join(layoutInfo.parentName, layoutInfo.layoutClient.outputName ?? layoutInfo.layoutClient.basename) } - if (results?.staticResults?.report?.copied) { - for (const file of results?.staticResults?.report?.copied) { + const staticReport = /** @type {{ copied?: Array<{ source: string, output: string }> }} */ (results?.staticResults?.report ?? {}) + if (staticReport?.copied) { + for (const file of staticReport.copied) { const srcFile = relative(srcDir, file.source) const destFile = relative(destDir, file.output) const segments = srcFile.split(sep) diff --git a/package.json b/package.json index 16be876..7cf3297 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "url": "https://github.com/bcomnes/domstack/issues" }, "engines": { - "node": ">=22.0.0" + "node": "^22.0.0 || >=24.0.0" }, "dependencies": { "@11ty/dependency-tree-typescript": "^1.0.0", @@ -57,8 +57,6 @@ "write-package": "^7.0.1" }, "devDependencies": { - "c8": "^11.0.0", - "cheerio": "^1.0.0-rc.10", "@types/browser-sync": "^2.29.0", "@types/js-yaml": "^4.0.9", "@types/markdown-it": "^14.1.1", @@ -66,6 +64,7 @@ "@types/node": "^25.3.0", "@voxpelli/tsconfig": "^16.0.0", "auto-changelog": "^2.4.0", + "cheerio": "^1.0.0-rc.10", "gh-release": "^7.0.2", "installed-check": "^10.0.1", "jsonfeed-to-atom": "^1.2.5", @@ -89,7 +88,7 @@ "test": "npm run clean && run-s test:*", "test:installed-check": "installed-check --ignore-dev", "test:neostandard": "eslint . --ignore-pattern 'test-cases/build-errors/src/**/*.js' --ignore-pattern 'test-cases/page-build-errors/src/**/*.js'", - "test:node-test": "c8 --reporter=lcov --reporter=text node --test --test-reporter spec", + "test:node-test": "node --test --experimental-test-coverage --test-reporter=spec", "test:tsc": "tsc", "build-examples": "run-p example:*", "clean": "run-p clean:*", From 70522f4c5b90d377a2d77452640a73e57d291bb1 Mon Sep 17 00:00:00 2001 From: Bret Comnes Date: Mon, 18 May 2026 18:44:10 -0700 Subject: [PATCH 3/4] npm-run-all2 v9 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7cf3297..33c1a30 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "installed-check": "^10.0.1", "jsonfeed-to-atom": "^1.2.5", "neostandard": "^0.13.0", - "npm-run-all2": "^8.0.1", + "npm-run-all2": "^9.0.0", "typescript": "~5.9.2" }, "homepage": "https://github.com/bcomnes/domstack", From df1573ee8df547eb08fe6430d810a71569ade383 Mon Sep 17 00:00:00 2001 From: Bret Comnes Date: Mon, 18 May 2026 18:48:36 -0700 Subject: [PATCH 4/4] Coverage --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 33c1a30..547c7b1 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "test": "npm run clean && run-s test:*", "test:installed-check": "installed-check --ignore-dev", "test:neostandard": "eslint . --ignore-pattern 'test-cases/build-errors/src/**/*.js' --ignore-pattern 'test-cases/page-build-errors/src/**/*.js'", - "test:node-test": "node --test --experimental-test-coverage --test-reporter=spec", + "test:node-test": "node --test --experimental-test-coverage --test-reporter=spec --test-reporter=lcov --test-reporter-destination=stdout --test-reporter-destination=lcov.info", "test:tsc": "tsc", "build-examples": "run-p example:*", "clean": "run-p clean:*",