mirror of
https://github.com/pezkuwichain/phishing.git
synced 2026-10-20 18:56:29 +00:00
* Say where this repository actually is
On 2026-04-21 a commit pointed repository, homepage and bugs at our Gitea
instance — "migrate git dependencies to Gitea mirror". Nothing else moved.
origin is still GitHub, the published @pezkuwi/phishing still says GitHub, and
git.pezkuwichain.io/pezkuwichain/phishing answers 500, so everyone who installs
the package has been given a dead homepage and a dead bug tracker.
It also broke the Master build on 2026-09-13, when the toolchain began reading
the field. @pezkuwi/dev, which is ours, does this:
const repoPath = pkg.repository.url
.split('https://github.com/')[1]
.split('.git')[0];
A URL from any other host makes [1] undefined and the build dies with "Cannot
read properties of undefined (reading 'split')" — a message that names neither
the field nor the file. Three runs failed that way and master has had no green
build since.
The metadata now says what is true today. This is not a decision about where
the project should live: it is an alignment with where the code already is and
with what we already publish.
That migration is still worth finishing, and this is the sequencing it needs.
Moving the repository to Gitea for real means fixing @pezkuwi/dev first, so a
toolchain built for a state that hosts its own git stops assuming github.com.
scripts/checkRepoMeta.mjs is the tripwire: it fails the metadata here rather
than letting it surface as an unreadable stack trace or ship as a dead link.
The check runs in the Lists workflow, which has no toolchain to install and so
still runs when the build does not. Nails: restoring the April commit turns
three cases red, migrating only half the repository turns two red, and leaving
homepage behind on the old host turns one red.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Hold the new check to the repository's own lint rules
The file I added failed all seven of them and lint had been green: the licence
header every file here carries, import order, an optional chain, object keys in
ascending order and an argument on its own line. Verified with eslint run the
way CI runs it, without --fix.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
109 lines
3.8 KiB
JavaScript
109 lines
3.8 KiB
JavaScript
// Copyright 2020-2026 @pezkuwi/phishing authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// What this repository says about itself must be true, and must be something the
|
|
// build toolchain can read.
|
|
//
|
|
// On 2026-04-21 a commit pointed repository/homepage/bugs at our Gitea instance
|
|
// ("migrate git dependencies to Gitea mirror"). Nothing else moved: origin is
|
|
// still GitHub, the published package still says GitHub, and
|
|
// git.pezkuwichain.io/pezkuwichain/phishing answers 500 — so every installer of
|
|
// @pezkuwi/phishing got dead links for its homepage and its bug tracker.
|
|
//
|
|
// It also broke `yarn build` from 2026-09-13, when the toolchain started reading
|
|
// the field. @pezkuwi/dev does this, and it is ours:
|
|
//
|
|
// const repoPath = pkg.repository.url
|
|
// .split('https://github.com/')[1]
|
|
// .split('.git')[0];
|
|
//
|
|
// A URL from any other host makes [1] undefined and the build dies with
|
|
// "Cannot read properties of undefined (reading 'split')" — a message that names
|
|
// neither the field nor the file.
|
|
//
|
|
// So this check is also the tripwire for the migration that was started and left
|
|
// half-done: moving this repository to Gitea for real means fixing @pezkuwi/dev
|
|
// first, so that a toolchain built for a state that hosts its own git stops
|
|
// assuming github.com. Until that happens, this check turns the metadata red
|
|
// here rather than letting it fail as an unreadable stack trace, or ship as a
|
|
// dead link.
|
|
//
|
|
// node scripts/checkRepoMeta.mjs
|
|
|
|
import { execFileSync } from 'node:child_process';
|
|
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
|
|
const errors = [];
|
|
|
|
function check (name, ok, detail) {
|
|
console.log((ok ? 'ok ' : 'FAIL ') + name + (ok ? '' : ` — got: ${JSON.stringify(detail)}`));
|
|
|
|
if (!ok) {
|
|
errors.push(name);
|
|
}
|
|
}
|
|
|
|
// Exactly the expression @pezkuwi/dev uses, so this fails where the build fails.
|
|
function toolchainCanRead (url) {
|
|
try {
|
|
const path = String(url).split('https://github.com/')[1].split('.git')[0];
|
|
|
|
return !!path && path.includes('/');
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
const files = ['package.json'];
|
|
|
|
for (const dir of readdirSync('packages', { withFileTypes: true })) {
|
|
if (dir.isDirectory() && existsSync(`packages/${dir.name}/package.json`)) {
|
|
files.push(`packages/${dir.name}/package.json`);
|
|
}
|
|
}
|
|
|
|
check('every package describes itself', files.length > 1, files);
|
|
|
|
const hosts = new Set();
|
|
|
|
for (const file of files) {
|
|
const pkg = JSON.parse(readFileSync(file, 'utf8'));
|
|
const url = pkg.repository?.url;
|
|
|
|
check(`${file}: has a repository url`, !!url, pkg.repository);
|
|
check(`${file}: the build toolchain can read that url`, toolchainCanRead(url), url);
|
|
check(`${file}: homepage and bugs live on the same host as the repository`,
|
|
!!url && !!pkg.homepage && !!pkg.bugs &&
|
|
new URL(pkg.homepage).host === new URL(url).host &&
|
|
new URL(String(pkg.bugs)).host === new URL(url).host,
|
|
{ bugs: pkg.bugs, homepage: pkg.homepage, url });
|
|
|
|
if (url) {
|
|
hosts.add(new URL(url).host);
|
|
}
|
|
}
|
|
|
|
check('the whole repository agrees on one host', hosts.size === 1, [...hosts]);
|
|
|
|
// And that host is where the code actually is. Without this the metadata can be
|
|
// internally consistent and still point somewhere the code has never been.
|
|
let origin = '';
|
|
|
|
try {
|
|
origin = execFileSync('git', ['remote', 'get-url', 'origin'], { encoding: 'utf8' }).trim();
|
|
} catch {
|
|
origin = '';
|
|
}
|
|
|
|
if (origin) {
|
|
check('the metadata names the remote the code is actually pushed to',
|
|
hosts.has(new URL(origin.replace(/^git@([^:]+):/, 'https://$1/')).host),
|
|
{ hosts: [...hosts], origin }
|
|
);
|
|
} else {
|
|
console.log('ok (no origin remote here — nothing to compare against)');
|
|
}
|
|
|
|
console.log(errors.length ? `FAILED: ${errors.length}` : 'all repository metadata checks passed');
|
|
process.exit(errors.length ? 1 : 0);
|