the check can look at either plugins directory, and knows what is not a plugin
there are two now. `platform/plugins/` is what this machine has INSTALLED; `officer-dev/plugins/` is every repo in the org cloned side by side, which is where a plugin is worked on from now on. they hold different sets, so the check has to be pointable rather than assuming the one it sits next to. and it skips a repo with no manifest.ts instead of reporting it broken. `av-club` is the case — a standalone media service in the plugins org, meant to become a plugin in time. checking it against a plugin's conventions would flag its branch name as a defect for ever, and a check that cries wolf is one people stop reading. presence is the declaration here exactly as in discover.ts: the manifest is what makes something a plugin, so its absence is what makes something not one yet.
This commit is contained in:
@@ -28,7 +28,14 @@
|
|||||||
import { readdirSync, existsSync } from 'node:fs';
|
import { readdirSync, existsSync } from 'node:fs';
|
||||||
import { join } from 'node:path';
|
import { join } from 'node:path';
|
||||||
|
|
||||||
const PLUGINS_DIR = join(import.meta.dir, '..', 'plugins');
|
/*
|
||||||
|
Which plugins directory to check.
|
||||||
|
|
||||||
|
There are two as of 2026-08-27: `platform/plugins/` — what this machine has INSTALLED — and
|
||||||
|
`officer-dev/plugins/`, every repo in the org cloned side by side for working on. They hold different
|
||||||
|
sets, so the check has to be pointable at either rather than assuming the one it happens to sit next to.
|
||||||
|
*/
|
||||||
|
const PLUGINS_DIR = process.env.PLUGINS_DIR ?? join(import.meta.dir, '..', 'plugins');
|
||||||
const HOST = 'git@gitea.officer.dev';
|
const HOST = 'git@gitea.officer.dev';
|
||||||
const BRANCH = 'master';
|
const BRANCH = 'master';
|
||||||
const REFSPEC = '+refs/heads/*:refs/remotes/origin/*';
|
const REFSPEC = '+refs/heads/*:refs/remotes/origin/*';
|
||||||
@@ -50,7 +57,20 @@ const dirs = readdirSync(PLUGINS_DIR, { withFileTypes: true })
|
|||||||
.filter((name) => existsSync(join(PLUGINS_DIR, name, '.git')))
|
.filter((name) => existsSync(join(PLUGINS_DIR, name, '.git')))
|
||||||
.sort();
|
.sort();
|
||||||
|
|
||||||
for (const name of dirs) {
|
/*
|
||||||
|
A repo with no `manifest.ts` is not a plugin, and that is not drift.
|
||||||
|
|
||||||
|
`av-club` is the case: a standalone media service living in the plugins org, intended to become a
|
||||||
|
plugin in time. Checking it against a plugin's conventions would report its branch name as a defect
|
||||||
|
forever, and a check that cries wolf is one people stop reading.
|
||||||
|
|
||||||
|
Presence is the declaration here exactly as it is in `plugins/discover.ts` — the manifest is what makes
|
||||||
|
something a plugin, so its absence is what makes something not one yet.
|
||||||
|
*/
|
||||||
|
const notYet = dirs.filter((name) => !existsSync(join(PLUGINS_DIR, name, 'manifest.ts')));
|
||||||
|
const checkable = dirs.filter((name) => !notYet.includes(name));
|
||||||
|
|
||||||
|
for (const name of checkable) {
|
||||||
const dir = join(PLUGINS_DIR, name);
|
const dir = join(PLUGINS_DIR, name);
|
||||||
const expected = `${HOST}:plugins/${name}.git`;
|
const expected = `${HOST}:plugins/${name}.git`;
|
||||||
|
|
||||||
@@ -107,8 +127,10 @@ for (const name of dirs) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const skipped = notYet.length ? ` (${notYet.length} not a plugin yet: ${notYet.join(', ')})` : '';
|
||||||
|
|
||||||
if (!problems.length) {
|
if (!problems.length) {
|
||||||
console.log(`plugins:check — ${dirs.length} plugin repositories, all well-formed`);
|
console.log(`plugins:check — ${checkable.length} plugin repositories, all well-formed${skipped}`);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user