diff --git a/.github/workflows/remove-unused-assets.yml b/.github/workflows/remove-unused-assets.yml index 7fba3f2db7..c23db2adfc 100644 --- a/.github/workflows/remove-unused-assets.yml +++ b/.github/workflows/remove-unused-assets.yml @@ -33,7 +33,6 @@ jobs: - name: Run scripts run: | script/remove-unused-assets.js > results.md - script/remove-extraneous-translation-files.js - name: Get script results to use in PR body id: results uses: juliangruber/read-file-action@e0a316da496006ffd19142f0fd594a1783f3b512 diff --git a/script/README.md b/script/README.md index 8c77a127b6..936650f12e 100644 --- a/script/README.md +++ b/script/README.md @@ -367,13 +367,6 @@ An automated test checks for discrepancies between filenames and [autogenerated --- -### [`remove-extraneous-translation-files.js`](remove-extraneous-translation-files.js) - -An [automated test](/tests/extraneous-translation-files.js) checks for files in the `translations/` directory that do not have an equivalent English file in the `content/` directory, and fails if it finds extraneous files. When the test fails, a human needs to run this script to remove the files. - ---- - - ### [`remove-stale-staging-apps.js`](remove-stale-staging-apps.js) This script removes all stale Heroku staging apps that outlasted the closure of their corresponding pull requests, or correspond to spammy pull requests. diff --git a/script/helpers/find-extraneous-translation-files.js b/script/helpers/find-extraneous-translation-files.js deleted file mode 100644 index ae79102aa6..0000000000 --- a/script/helpers/find-extraneous-translation-files.js +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env node -import { fileURLToPath } from 'url' -import path from 'path' -import { difference } from 'lodash-es' -import walkSync from 'walk-sync' -import languages from '../../lib/languages.js' - -const __dirname = path.dirname(fileURLToPath(import.meta.url)) -const walk = walkSync.entries - -export default function findExtraneousTranslatedFiles() { - const files = [] - const relativePaths = {} - - // group page.relativePath lists by language - for (const languageCode in languages) { - const language = languages[languageCode] - const languageDir = path.join(__dirname, '..', language.dir) - relativePaths[languageCode] = walk(languageDir, { directories: false }).map( - (file) => file.relativePath - ) - } - - for (const languageCode in languages) { - if (languageCode === 'en') continue - const language = languages[languageCode] - /* istanbul ignore next */ - difference(relativePaths[languageCode], relativePaths.en).forEach((file) => { - files.push(path.join(__dirname, '..', language.dir, file)) - }) - } - - return files -} diff --git a/script/remove-extraneous-translation-files.js b/script/remove-extraneous-translation-files.js deleted file mode 100755 index 1728d98d36..0000000000 --- a/script/remove-extraneous-translation-files.js +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env node - -// [start-readme] -// -// An [automated test](/tests/extraneous-translation-files.js) checks for files in the `translations/` directory -// that do not have an equivalent English file in the `content/` directory, and fails if it finds extraneous files. -// When the test fails, a human needs to run this script to remove the files. -// -// [end-readme] - -import fs from 'fs' -import findExtraneousFiles from './helpers/find-extraneous-translation-files.js' - -main() - -async function main() { - const files = findExtraneousFiles() - console.log( - `Found ${files.length} extraneous translation ${files.length === 1 ? 'file' : 'files'}\n\n` - ) - files.forEach((file) => { - console.log(file) - fs.unlinkSync(file) - }) -}