1
0
mirror of synced 2025-12-21 10:57:10 -05:00

remove old unused scripts (#22650)

This commit is contained in:
Rachael Sewell
2021-11-08 09:43:59 -08:00
committed by GitHub
parent 981d79715a
commit a83c0cfd50
4 changed files with 0 additions and 67 deletions

View File

@@ -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

View File

@@ -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.

View File

@@ -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
}

View File

@@ -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)
})
}