Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 9 additions & 33 deletions scripts/check-docs-claims.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ import { basename, dirname, extname, join, relative, sep } from "node:path";
import { compile } from "@mdx-js/mdx";

import { splitFrontmatter } from "./check-docs-compile.mjs";
import {
RETIRED_CATEGORY,
RETIRED_CATEGORY_TAG,
namesRetiredCategory,
} from "./retired-category.mjs";

/**
* Files come from git's index, not from a directory walk.
Expand Down Expand Up @@ -232,41 +237,12 @@ export function context7Findings(config, coreDescription) {
}

/**
* The category the project moved away from.
*
* A hyphen or whitespace between the words, because the repository has spelled
* it both ways and a reader sees no difference, and an optional plural, because
* "one of several app frameworks" is the same claim about the same category.
*/
export const RETIRED_CATEGORY = /\bapp(?:-|\s+)frameworks?\b/i;

/**
* The same category, as a whole tag rather than a phrase in prose.
* The retired-category patterns and their classifier, defined in `retired-category.mjs`.
*
* npm keywords and GitHub topics are both single tokens on a surface people search, and both
* were left carrying `framework` after the prose was cleared. The word is the one the whole
* repositioning turned on: it could mean an application framework, a UI framework or a backend
* framework, which made it the least informative word available.
*
* `RETIRED_CATEGORY` cannot serve here — it requires the `app` prefix, so a bare `framework`
* tag would pass. Anchored rather than substring-matched: `page-builder` and `nextly-plugin`
* are tags this must never touch.
* Re-exported so an importer of this module keeps a path to them, while a job that cannot install
* packages imports the dependency-free module directly instead of this one.
*/
export const RETIRED_CATEGORY_TAG = /^(?:app-)?frameworks?$/i;

/**
* The single answer to "does this tag name the retired category", for every tag surface.
*
* A tag can carry the category two ways, and one pattern cannot see both: as the whole tag
* (`framework`), or with the phrase embedded in a longer one (`nextjs-app-framework`). Two
* checks used to answer this for npm keywords — the prose check matched the phrase, the
* keyword check matched the whole tag — so a keyword like `app-framework` was reported twice
* under two names, and their patterns were free to drift apart. This is now the only answer,
* shared by npm keywords and GitHub topics.
*/
export function namesRetiredCategory(tag) {
return typeof tag === "string" && (RETIRED_CATEGORY_TAG.test(tag) || RETIRED_CATEGORY.test(tag));
}
export { RETIRED_CATEGORY, RETIRED_CATEGORY_TAG, namesRetiredCategory };

/**
* The keywords npm derives from a manifest, which is not always the keywords it was given.
Expand Down
2 changes: 1 addition & 1 deletion scripts/check-repo-metadata.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import { readFileSync } from "node:fs";
import { join } from "node:path";

import { RETIRED_CATEGORY, namesRetiredCategory } from "./check-docs-claims.mjs";
import { RETIRED_CATEGORY, namesRetiredCategory } from "./retired-category.mjs";

const OWNER = "nextlyhq";
const REPO = "nextly";
Expand Down
53 changes: 53 additions & 0 deletions scripts/retired-category.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* The category the project moved away from, as two patterns and one classifier, with no imports.
*
* Its own module, and importing nothing, because a job that installs no packages loads it. The
* scheduled repository-metadata check runs straight after checkout — the GitHub About line and the
* topic list are repository settings rather than files, so only a scheduled run can observe them —
* and any module in that check's import closure that reaches for an npm package fails the job
* before it examines anything.
*
* Kept apart from the docs-claims check, which compiles MDX: the metadata check needs these three
* definitions and nothing else, and must not load a compiler to get them. There is still exactly
* one definition — the docs-claims check imports and re-exports it rather than restating it.
*
* `no-install-jobs.test.mjs` holds the property for every script a workflow starts without
* installing: its whole import graph must be Node builtins.
*/

/**
* The category the project moved away from.
*
* A hyphen or whitespace between the words, because the repository has spelled
* it both ways and a reader sees no difference, and an optional plural, because
* "one of several app frameworks" is the same claim about the same category.
*/
export const RETIRED_CATEGORY = /\bapp(?:-|\s+)frameworks?\b/i;

/**
* The same category, as a whole tag rather than a phrase in prose.
*
* npm keywords and GitHub topics are both single tokens on a surface people search, and both
* were left carrying `framework` after the prose was cleared. The word is the one the whole
* repositioning turned on: it could mean an application framework, a UI framework or a backend
* framework, which made it the least informative word available.
*
* `RETIRED_CATEGORY` cannot serve here — it requires the `app` prefix, so a bare `framework`
* tag would pass. Anchored rather than substring-matched: `page-builder` and `nextly-plugin`
* are tags this must never touch.
*/
export const RETIRED_CATEGORY_TAG = /^(?:app-)?frameworks?$/i;

/**
* The single answer to "does this tag name the retired category", for every tag surface.
*
* A tag can carry the category two ways, and one pattern cannot see both: as the whole tag
* (`framework`), or with the phrase embedded in a longer one (`nextjs-app-framework`). Two
* checks used to answer this for npm keywords — the prose check matched the phrase, the
* keyword check matched the whole tag — so a keyword like `app-framework` was reported twice
* under two names, and their patterns were free to drift apart. This is now the only answer,
* shared by npm keywords and GitHub topics.
*/
export function namesRetiredCategory(tag) {
return typeof tag === "string" && (RETIRED_CATEGORY_TAG.test(tag) || RETIRED_CATEGORY.test(tag));
}
Loading