Files
poli0981andClaude Opus 5.5 0c56acd806 ci: Qodana analysis and a licence check over the whole dependency tree (#135)
* ci: Qodana analysis and a licence check over the whole dependency tree

- Qodana (JetBrains, Qodana for JS) runs on every PR, on main and by hand
  (.github/workflows/qodana.yml, settings in qodana.yaml): native mode on the runner's
  Node 26 after `npm ci --ignore-scripts` and the generated types, profile
  qodana.recommended over the whole repository, build output, generated files, the
  content submodule and the design docs excluded, spelling/grammar checks off (they do
  not read Vietnamese). Results go to Qodana Cloud and, for main, to code scanning as
  SARIF. Dependabot and fork PRs skip it (no secrets), so it stays advisory.
- Licences: the allowlist moves to scripts/license-policy.mjs, shared by gen-notices
  (direct dependencies, THIRD-PARTY-NOTICES.md) and a new check-licenses step in the
  build job that reads every package in package-lock.json — transitive ones and every
  platform binary — with a small SPDX evaluator (OR, AND, WITH, parentheses). Packages
  with no licence fail; reviews are per package with a reason instead of per licence
  (an MPL note written for satori used to clear @axe-core/playwright too). Today:
  735 packages, 42 cleared (MPL-2.0 build/test tools, sharp's LGPL libvips).
- README badges and Quality row, THIRD-PARTY-NOTICES tool list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: Qodana's first findings, and a zero-problem quality gate

The first Qodana run reported 11 problems; all are handled:
- scripts/smoke-worker.mjs: the forged Access JWT is now built from its JSON parts at run
  time (same bytes) instead of sitting in the source as a token literal, which secret
  scanners rightly flag; the "did not come up" case reports through the same helper as
  any other failure instead of throwing into its own catch.
- scripts/check-csp-hashes.mjs: ("|') → ["'] in the JSON-LD matcher.
- src/lib/format.ts: drop the two escapes of `]` outside a character class (a lone `]`
  is a literal there); the classes keep theirs.
- src/lib/legal-lang.ts: the heading → language table is a Map, so "Tiếng Việt" is data,
  not a property name mixing scripts.
- qodana.yaml: ES6PreferShortImport off, with the reason — the build scripts and
  astro.config.mjs run under plain Node, where the `@/` alias doesn't resolve and a
  TypeScript import keeps its `.ts`.
- failThreshold: 0, so any new problem turns the check red.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: sort the licence report with an explicit compare function

Sonar S2871: Array#sort() without a compare function sorts by UTF-16 code units, which
is not alphabetical for every name. Both lists now sort with localeCompare.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 07:55:31 +07:00

94 lines
3.5 KiB
JSON

{
"name": "poli0981-dev",
"type": "module",
"version": "0.0.0",
"private": true,
"license": "SEE LICENSE IN LICENSE",
"engines": {
"node": ">=26"
},
"allowScripts": {
"esbuild": true,
"workerd": true,
"lefthook": true,
"fsevents": true
},
"scripts": {
"dev": "astro dev",
"build": "astro build && node scripts/gen-og.mjs && pagefind --site dist/client && node scripts/check-csp-hashes.mjs",
"check-csp": "node scripts/check-csp-hashes.mjs",
"smoke": "node scripts/smoke-worker.mjs",
"probe:ratelimit": "node scripts/probe-ratelimit.mjs",
"test": "node --import ./tests/support/register.mjs --test \"tests/**/*.test.ts\"",
"pretest:coverage": "node -e \"require('node:fs').mkdirSync('coverage', { recursive: true })\"",
"test:coverage": "node --import ./tests/support/register.mjs --test --experimental-test-coverage --test-coverage-include=\"src/**/*.ts\" --test-coverage-include=\"workers/widgets/src/**/*.ts\" --test-coverage-exclude=\"**/*.d.ts\" --test-coverage-exclude=\"src/lib/easter.ts\" --test-coverage-exclude=\"src/content.config.ts\" --test-coverage-lines=80 --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=coverage/lcov.info \"tests/**/*.test.ts\"",
"test:a11y": "node --test --test-concurrency=1 \"tests/a11y/*.spec.ts\"",
"gen-notices": "node scripts/gen-notices.mjs",
"check-licenses": "node scripts/check-licenses.mjs",
"new:post": "node scripts/new-post.mjs",
"gen-og": "node scripts/gen-og.mjs",
"preview": "astro preview",
"astro": "astro",
"check": "astro check",
"typecheck": "node node_modules/@typescript/native/bin/tsc -p tsconfig.json && node node_modules/@typescript/native/bin/tsc -p workers/widgets/tsconfig.json",
"types": "wrangler types --strict-vars=false",
"types:widgets": "wrangler types --config workers/widgets/wrangler.jsonc workers/widgets/worker-configuration.d.ts",
"lint": "eslint .",
"format": "prettier --write .",
"format:check": "prettier --check .",
"knip": "knip",
"deploy": "wrangler deploy",
"strip-exif": "node scripts/strip-exif.mjs",
"check-exif": "node scripts/check-exif.mjs",
"check-install-scripts": "node scripts/check-install-scripts.mjs"
},
"overrides": {
"fflate": "^0.7.5",
"minimatch": "^11.0.4",
"sharp": "$sharp",
"miniflare": {
"undici": "^7.30.1"
}
},
"dependencies": {
"@astrojs/cloudflare": "^14.4.8",
"@astrojs/mdx": "^8.1.6",
"@astrojs/rss": "^4.0.19",
"@astrojs/sitemap": "^3.7.5",
"@astrojs/svelte": "^9.1.6",
"@tailwindcss/vite": "^4.3.5",
"astro": "^7.4.12",
"jose": "^6.2.17",
"marked": "^18.2.1",
"sharp": "^0.35.5",
"svelte": "^5.57.3",
"tailwindcss": "^4.3.5",
"yaml": "^2.9.1",
"zod": "^4.6.7"
},
"devDependencies": {
"@astrojs/check": "^0.9.12",
"@axe-core/playwright": "^4.14.0",
"@resvg/resvg-js": "^2.6.2",
"@types/node": "^26.6.6",
"@typescript/native": "npm:typescript@^7.0.2",
"eslint": "^10.15.0",
"eslint-plugin-astro": "^3.2.1",
"eslint-plugin-svelte": "^3.24.1",
"exifr": "^7.1.3",
"knip": "^6.45.1",
"lefthook": "^2.2.2",
"pagefind": "^1.6.0",
"playwright": "^1.65.1",
"prettier": "^3.10.1",
"prettier-plugin-astro": "^0.14.1",
"prettier-plugin-svelte": "^4.2.0",
"prettier-plugin-tailwindcss": "^0.8.1",
"satori": "^0.63.2",
"satori-html": "^0.3.2",
"typescript": "~6.0.3",
"typescript-eslint": "~8.73.0",
"wrangler": "^4.164.0"
}
}