Files
cereale/scripts/check-entry-points.mjs
T
SenrokaiandClaude Opus 5.5 e4b8c0f6aa CI sur Gitea Actions par le workflow commun avalon-vanguard/ci
.gitea/workflows/ci.yml appelle node.yml@v1 sur la même matrice (Node 20.x,
22.x, 24.x) et les mêmes déclencheurs que .github/workflows/ci.yml. Comme
node.yml ne connaît que lint, typecheck, test, build et check :
- « typecheck » renvoie à « type-check » ;
- « check » enchaîne, dans l'ordre de la CI GitHub, les contrôles
  post-build : points d'entrée publiés, démo, check:types, check:docs,
  check:docs-sync.

Les cinq « node -e » de chargement des points d'entrée passent dans
scripts/check-entry-points.mjs, que la CI GitHub appelle aussi : les deux
CI vérifient la même chose.

node.yml lance « npm test » et non « test:coverage » : vitest.config.ts ne
fixe aucun seuil et rien ne lit le rapport lcov, donc ce sont les mêmes
tests qui décident. La CI GitHub garde test:coverage.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 17:03:33 +02:00

19 lines
1015 B
JavaScript

/**
* Fails if a published entry point does not load from dist/: `.` and `./vite`, each as ESM
* and as CommonJS, and the flat `./min` bundle. Run after `npm run build` (first step of
* `npm run check`). Moved here from inline `node -e` lines in .github/workflows/ci.yml so
* that the GitHub and Gitea workflows run the same check.
*/
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const assert = (ok, what) => {
if (!ok) throw new Error(`${what} broken`);
};
assert(typeof (await import('../dist/esm/index.js')).toInstance === 'function', 'ESM entry point');
assert(typeof require('../dist/cjs/index.js').toInstance === 'function', 'CJS entry point');
assert((await import('../dist/esm/vite.js')).standardDecorators().enforce === 'pre', 'ESM cereale/vite');
assert(require('../dist/cjs/vite.js').standardDecorators().enforce === 'pre', 'CJS cereale/vite');
assert(typeof (await import('../dist/cereale.min.js')).toInstanceSync === 'function', 'flat bundle');