зеркало из https://github.com/github/docs.git
Move test & script utils out of `/lib` (#17517)
* Remove an unused file * Move authenticate-to-aws to scripts/utils * Move crowdin-config to tests/utils * Remove add-frontmatter-to-file * Move find-unused-assets * Move git-utils to script/utils * Move lib/github to script/utils * Revert "Remove an unused file" This reverts commit cd93ad846a0354e957359f23124eb0724c9147cf. * Move find-extraneous-translation-files to script/utils * We already have tests/helpers * Rename script/utils => helpers for consistency * Forgot a path * Fix path to crowdin-config Co-authored-by: Chiedo John <2156688+chiedo@users.noreply.github.com>
This commit is contained in:
Родитель
0e04893e4a
Коммит
8d4f3e65fe
|
@ -1,8 +0,0 @@
|
|||
const fs = require('fs')
|
||||
const matter = require('gray-matter')
|
||||
|
||||
module.exports = function addFrontmatterToFile (frontmatter, file) {
|
||||
const { content, data } = matter(fs.readFileSync(file, 'utf8'))
|
||||
Object.assign(data, frontmatter)
|
||||
fs.writeFileSync(file, matter.stringify(content, data, { lineWidth: 10000 }))
|
||||
}
|
|
@ -9,7 +9,7 @@ const allVersions = require('../lib/all-versions')
|
|||
const nonEnterpriseDefaultVersion = require('../lib/non-enterprise-default-version')
|
||||
const { getS3BucketPathFromVersion, getVersionFromS3BucketPath } = require('../lib/s3-bucket-path-utils')
|
||||
const patterns = require('../lib/patterns')
|
||||
const authenticateToAWS = require('../lib/authenticate-to-aws.js')
|
||||
const authenticateToAWS = require('./helpers/authenticate-to-aws.js')
|
||||
const readlineSync = require('readline-sync')
|
||||
const { execSync } = require('child_process')
|
||||
const enterpriseServerVersions = Object.keys(allVersions).filter(v => v.startsWith('enterprise-server@'))
|
||||
|
|
|
@ -14,7 +14,7 @@ assert(process.env.HEROKU_API_TOKEN)
|
|||
const { chain } = require('lodash')
|
||||
const chalk = require('chalk')
|
||||
const Heroku = require('heroku-client')
|
||||
const github = require('../lib/github')()
|
||||
const github = require('./helpers/github')()
|
||||
const heroku = new Heroku({ token: process.env.HEROKU_API_TOKEN })
|
||||
const owner = 'github'
|
||||
const repo = 'docs-internal'
|
||||
|
|
|
@ -7,7 +7,7 @@ const yaml = require('js-yaml')
|
|||
const { execSync } = require('child_process')
|
||||
const graphqlDataDir = path.join(process.cwd(), 'data/graphql')
|
||||
const graphqlStaticDir = path.join(process.cwd(), 'lib/graphql/static')
|
||||
const { getContents, listMatchingRefs } = require('../../lib/git-utils')
|
||||
const { getContents, listMatchingRefs } = require('../helpers/git-utils')
|
||||
const dataFilenames = require('./utils/data-filenames')
|
||||
const allVersions = require('../../lib/all-versions')
|
||||
const processPreviews = require('./utils/process-previews')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const path = require('path')
|
||||
const { difference } = require('lodash')
|
||||
const walk = require('walk-sync').entries
|
||||
const languages = require('../lib/languages')
|
||||
const languages = require('../../lib/languages')
|
||||
|
||||
module.exports = function findExtraneousTranslatedFiles () {
|
||||
const files = []
|
|
@ -5,10 +5,10 @@ const path = require('path')
|
|||
const walk = require('walk-sync')
|
||||
const { execSync } = require('child_process')
|
||||
const assert = require('assert')
|
||||
const loadSiteData = require('./site-data')
|
||||
const { loadPages } = require('./pages')
|
||||
const patterns = require('./patterns')
|
||||
const getDataReferences = require('./get-liquid-data-references')
|
||||
const loadSiteData = require('../../lib/site-data')
|
||||
const { loadPages } = require('../../lib/pages')
|
||||
const patterns = require('../../lib/patterns')
|
||||
const getDataReferences = require('../../lib/get-liquid-data-references')
|
||||
const imagesPath = '/assets/images'
|
||||
|
||||
// these paths should remain in the repo even if they are not referenced directly
|
|
@ -1,4 +1,4 @@
|
|||
const github = require('../lib/github')()
|
||||
const github = require('./github')()
|
||||
|
||||
// https://docs.github.com/rest/reference/git#get-a-reference
|
||||
async function getCommitSha (owner, repo, ref) {
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const fs = require('fs')
|
||||
const findExtraneousFiles = require('../lib/find-extraneous-translation-files')
|
||||
const findExtraneousFiles = require('./helpers/find-extraneous-translation-files')
|
||||
|
||||
// [start-readme]
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const findUnusedAssets = require('../lib/find-unused-assets')
|
||||
const findUnusedAssets = require('./helpers/find-unused-assets')
|
||||
|
||||
// [start-readme]
|
||||
//
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const { getContents } = require('../lib/git-utils')
|
||||
const { getContents } = require('./helpers/git-utils')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const enterpriseDatesFile = path.join(__dirname, '../lib/enterprise-dates.json')
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const authenticateToAWS = require('../lib/authenticate-to-aws.js')
|
||||
const authenticateToAWS = require('./helpers/authenticate-to-aws.js')
|
||||
|
||||
// [start-readme]
|
||||
//
|
||||
|
|
|
@ -4,7 +4,7 @@ const fs = require('fs')
|
|||
const path = require('path')
|
||||
const program = require('commander')
|
||||
const allVersions = require('../lib/all-versions')
|
||||
const authenticateToAWS = require('../lib/authenticate-to-aws')
|
||||
const authenticateToAWS = require('./helpers/authenticate-to-aws')
|
||||
const nonEnterpriseDefaultVersion = require('../lib/non-enterprise-default-version')
|
||||
const { getS3BucketPathFromVersion } = require('../lib/s3-bucket-path-utils')
|
||||
const walk = require('walk-sync')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const config = require('../../lib/crowdin-config').read()
|
||||
const config = require('../helpers/crowdin-config').read()
|
||||
const { loadPages } = require('../../lib/pages')
|
||||
const ignoredPagePaths = config.files[0].ignore
|
||||
const ignoredDataPaths = config.files[2].ignore
|
||||
|
|
|
@ -3,7 +3,7 @@ const path = require('path')
|
|||
const yaml = require('js-yaml')
|
||||
|
||||
const read = function () {
|
||||
const filename = path.join(__dirname, '../crowdin.yml')
|
||||
const filename = path.join(__dirname, '../../crowdin.yml')
|
||||
return yaml.load(fs.readFileSync(filename, 'utf8'), { filename })
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче