ci: expand shared package validation and test coverage
- Add lint, formatting, vet, and publish workflow checks - Run Go database tests with PostgreSQL and add Java tests - Make consumer sync opt-in; update docs and Go dependency
This commit is contained in:
1 parent
937f51b4fb
commit
0ff94f9b10
107 files changed
+10124
-410
No files matched your search
@@ -1,19 +1,18 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Lint all JS/TS packages sequentially with clear section headers, plus a repo-wide Prettier
|
||||
* format check.
|
||||
* Lint all JS/TS packages sequentially with clear section headers, plus the Prettier format check.
|
||||
* Exits non‑zero if any package fails its lint step.
|
||||
*
|
||||
* Shared extraction note: the monorepo version of this script discovered the monorepo root
|
||||
* by walking up for a MediaShared/package.json marker, iterated nine sibling Media* packages
|
||||
* against a shared root eslint.config.mjs/.stylelintrc.json, and ran Prettier/Stylelint out of
|
||||
* MediaShared/node_modules (npm workspace hoisting). None of that exists in this repo: there is
|
||||
* no root package.json, no shared devDependency hoisting, and webui/ is the only JS/TS package —
|
||||
* it already ships its own local eslint.config.js and prettier.config.js. The Stylelint section
|
||||
* has been dropped entirely rather than pointed at a nonexistent .stylelintrc.json: webui has no
|
||||
* stylelint devDependency and its CSS is Tailwind-authored, so there was nothing equivalent to
|
||||
* carry over. If CSS linting is wanted later, it would need its own stylelint config added to
|
||||
* webui/ (or a new root package.json) first.
|
||||
* MediaShared/node_modules (npm workspace hoisting). Here the only JS/TS package with a lint
|
||||
* target is packages/web-ui, linted with the root eslint.config.js (ESLint is a root
|
||||
* devDependency, so `npx eslint` resolves it). Prettier is checked through the root
|
||||
* `format:check` script, which covers only the files written to the Prettier style (see
|
||||
* .prettierrc.json): the older sources were never formatted with it. The Stylelint section has
|
||||
* been dropped entirely rather than pointed at a nonexistent .stylelintrc.json: web-ui's CSS is
|
||||
* Tailwind-authored, so there was nothing equivalent to carry over.
|
||||
*/
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
@@ -23,7 +22,7 @@ import { existsSync } from 'node:fs';
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const root = resolve(__dirname, '..', '..');
|
||||
|
||||
const packages = [{ name: 'webui', path: 'webui' }];
|
||||
const packages = [{ name: 'web-ui', path: 'packages/web-ui' }];
|
||||
|
||||
function resolveEslintInvocation({ pkgDir }) {
|
||||
const pkgEslintJs = resolve(pkgDir, 'node_modules', 'eslint', 'bin', 'eslint.js');
|
||||
@@ -80,23 +79,15 @@ for (const pkg of packages) {
|
||||
}
|
||||
}
|
||||
|
||||
// ===== webui: Prettier format check =====
|
||||
console.log('\n===== FORMAT CHECK (Prettier, webui) =====');
|
||||
// ===== Prettier format check (the files covered by the root format:check script) =====
|
||||
console.log('\n===== FORMAT CHECK (Prettier) =====');
|
||||
{
|
||||
const webuiDir = resolve(root, 'webui');
|
||||
const prettierBin = resolve(webuiDir, 'node_modules', 'prettier', 'bin', 'prettier.cjs');
|
||||
const npxCmd = process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
||||
const fmtResult = existsSync(prettierBin)
|
||||
? spawnCrossPlatform(process.execPath, [prettierBin, '--check', '.'], {
|
||||
cwd: webuiDir,
|
||||
stdio: 'inherit',
|
||||
env: process.env,
|
||||
})
|
||||
: spawnCrossPlatform(npxCmd, ['prettier', '--check', '.'], {
|
||||
cwd: webuiDir,
|
||||
stdio: 'inherit',
|
||||
env: process.env,
|
||||
});
|
||||
const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
||||
const fmtResult = spawnCrossPlatform(npmCmd, ['run', 'format:check'], {
|
||||
cwd: root,
|
||||
stdio: 'inherit',
|
||||
env: process.env,
|
||||
});
|
||||
if (fmtResult.error || fmtResult.status !== 0) {
|
||||
failures++;
|
||||
console.error('✖ Format check failed');
|
||||
|
||||
Reference in new issue
Block a user