diff --git a/package.json b/package.json index 6122bb6f534c..5fab270c9144 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,8 @@ "build:legacy::curriculum": "cross-env NODE_ENV=production NODE_OPTIONS=\"--no-warnings=ExperimentalWarning --loader ts-node/esm\" node build/build-curriculum.ts", "build:legacy::docs": "cross-env NODE_ENV=production NODE_OPTIONS=\"--no-warnings=ExperimentalWarning --loader ts-node/esm\" node build/cli.ts -n", "build:legacy:blog": "cross-env NODE_ENV=production NODE_OPTIONS=\"--no-warnings=ExperimentalWarning --loader ts-node/esm\" node build/build-blog.ts", - "build:legacy:prepare": "yarn build:client && yarn build:ssr && yarn tool:legacy popularities && yarn tool:legacy spas && yarn tool:legacy gather-git-history && yarn tool:legacy build-robots-txt", - "build:prepare": "yarn build:client && yarn build:ssr && yarn tool:legacy build-robots-txt", + "build:legacy:prepare": "yarn build:client && yarn build:ssr && yarn tool:legacy popularities && yarn tool:legacy spas && yarn tool:legacy gather-git-history", + "build:prepare": "yarn build:client && yarn build:ssr", "build:ssr": "cross-env NODE_ENV=production NODE_OPTIONS=\"--no-warnings=ExperimentalWarning --loader ts-node/esm\" node ssr/prepare.ts && webpack --mode=production --config=ssr/webpack.config.js", "build:sw": "cd client/pwa && yarn && yarn build:prod", "build:sw-dev": "cd client/pwa && yarn && yarn build", diff --git a/tool/build-robots-txt.ts b/tool/build-robots-txt.ts deleted file mode 100644 index 3bcd6044f2c0..000000000000 --- a/tool/build-robots-txt.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This script generates a /robots.txt file that depends on - * process.env.BUILD_ALWAYS_ALLOW_ROBOTS. - * - */ -import fs from "node:fs"; - -import { ALWAYS_ALLOW_ROBOTS } from "../libs/env/index.js"; - -const ALLOW_TEXT = ` -User-agent: * -Sitemap: https://developer.mozilla.org/sitemap.xml - -Disallow: /api/ -Disallow: /*/files/ -Disallow: /media -`; - -const DISALLOW_TEXT = ` -User-Agent: * - -Disallow: / -`; - -export async function runBuildRobotsTxt(outfile: string) { - const content = ALWAYS_ALLOW_ROBOTS ? ALLOW_TEXT : DISALLOW_TEXT; - fs.writeFileSync(outfile, `${content.trim()}\n`, "utf-8"); -} diff --git a/tool/cli.ts b/tool/cli.ts index 268c48db208e..efe617e31484 100644 --- a/tool/cli.ts +++ b/tool/cli.ts @@ -25,13 +25,11 @@ import { buildDocument, gatherGitHistory, buildSPAs } from "../build/index.js"; import { isValidLocale } from "../libs/locale-utils/index.js"; import type { Doc } from "../libs/types/document.js"; import { - ALWAYS_ALLOW_ROBOTS, BUILD_OUT_ROOT, CONTENT_ROOT, CONTENT_TRANSLATED_ROOT, } from "../libs/env/index.js"; import { runMakePopularitiesFile } from "./popularities.js"; -import { runBuildRobotsTxt } from "./build-robots-txt.js"; import { syncAllTranslatedContent } from "./sync-translated-content.js"; import { macroUsageReport } from "./macro-usage-report.js"; import * as kumascript from "../kumascript/index.js"; @@ -869,28 +867,6 @@ program }) ) - .command( - "build-robots-txt", - "Generate a robots.txt in the build root depending ALWAYS_ALLOW_ROBOTS" - ) - .option("--outfile ", "name of the generated file", { - default: path.join(BUILD_OUT_ROOT, "robots.txt"), - }) - .action( - tryOrExit(async ({ options, logger }: BuildRobotsTxtActionParameters) => { - const { outfile } = options; - await runBuildRobotsTxt(outfile); - logger.info( - chalk.yellow( - `Generated ${path.relative( - ".", - outfile - )} based on ALWAYS_ALLOW_ROBOTS=${ALWAYS_ALLOW_ROBOTS}` - ) - ); - }) - ) - .command("spas", "Build (SSR) all the skeleton apps for single page apps") .action( tryOrExit(async ({ options }) => {