Remove import x statements (#20594)
* Clear out most import x * Update rimraf use * Move up readme blocks in scripts
This commit is contained in:
@@ -1,25 +1,4 @@
|
||||
#!/usr/bin/env node
|
||||
import { fileURLToPath } from 'url'
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
import { execSync } from 'child_process'
|
||||
import createApp from '../../lib/app.js'
|
||||
import scrape from 'website-scraper'
|
||||
import program from 'commander'
|
||||
import xRimraf from 'rimraf'
|
||||
import xEnterpriseServerReleases from '../../lib/enterprise-server-releases.js'
|
||||
import loadRedirects from '../../lib/redirects/precompile.js'
|
||||
import { loadPageMap } from '../../lib/page-data.js'
|
||||
const __filename = fileURLToPath(import.meta.url)
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
const port = '4001'
|
||||
const host = `http://localhost:${port}`
|
||||
const rimraf = xRimraf.sync
|
||||
const version = xEnterpriseServerReleases.oldestSupported
|
||||
const archivalRepoName = 'help-docs-archived-enterprise-versions'
|
||||
const archivalRepoUrl = `https://github.com/github/${archivalRepoName}`
|
||||
const remoteImageStoreBaseURL = 'https://githubdocs.azureedge.net/github-images'
|
||||
|
||||
// [start-readme]
|
||||
//
|
||||
@@ -29,6 +8,27 @@ const remoteImageStoreBaseURL = 'https://githubdocs.azureedge.net/github-images'
|
||||
//
|
||||
// [end-readme]
|
||||
|
||||
import { fileURLToPath } from 'url'
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
import { execSync } from 'child_process'
|
||||
import createApp from '../../lib/app.js'
|
||||
import scrape from 'website-scraper'
|
||||
import program from 'commander'
|
||||
import rimraf from 'rimraf'
|
||||
import EnterpriseServerReleases from '../../lib/enterprise-server-releases.js'
|
||||
import loadRedirects from '../../lib/redirects/precompile.js'
|
||||
import { loadPageMap } from '../../lib/page-data.js'
|
||||
const __filename = fileURLToPath(import.meta.url)
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
const port = '4001'
|
||||
const host = `http://localhost:${port}`
|
||||
const version = EnterpriseServerReleases.oldestSupported
|
||||
const archivalRepoName = 'help-docs-archived-enterprise-versions'
|
||||
const archivalRepoUrl = `https://github.com/github/${archivalRepoName}`
|
||||
const remoteImageStoreBaseURL = 'https://githubdocs.azureedge.net/github-images'
|
||||
|
||||
program
|
||||
.description(
|
||||
'Scrape HTML of the oldest supported Enterprise version and add it to the archival repository.'
|
||||
@@ -148,10 +148,10 @@ async function main() {
|
||||
const tempDirectory = path.join(__dirname, '../website-scraper-temp')
|
||||
|
||||
// remove temp directory
|
||||
rimraf(tempDirectory)
|
||||
rimraf.sync(tempDirectory)
|
||||
|
||||
// remove and recreate empty target directory
|
||||
rimraf(finalDirectory)
|
||||
rimraf.sync(finalDirectory)
|
||||
fs.mkdirSync(finalDirectory, { recursive: true })
|
||||
|
||||
const scraperOptions = {
|
||||
@@ -176,7 +176,7 @@ async function main() {
|
||||
})
|
||||
|
||||
fs.renameSync(path.join(tempDirectory, `/localhost_${port}`), path.join(finalDirectory))
|
||||
rimraf(tempDirectory)
|
||||
rimraf.sync(tempDirectory)
|
||||
|
||||
console.log(
|
||||
`\n\ndone scraping! added files to ${path.relative(process.cwd(), finalDirectory)}\n`
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// [start-readme]
|
||||
//
|
||||
// Run this script after an Enterprise deprecation to remove redirects
|
||||
// for the deprecated version. See the Enterprise deprecation issue template for instructions.
|
||||
//
|
||||
// [end-readme]
|
||||
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import program from 'commander'
|
||||
@@ -8,13 +15,6 @@ import { deprecated } from '../../lib/enterprise-server-releases.js'
|
||||
const DEVELOPER_REDIRECTS_FILEPATH = 'lib/redirects/static/developer.json'
|
||||
const developerRedirects = readJsonFile(`./${DEVELOPER_REDIRECTS_FILEPATH}`)
|
||||
|
||||
// [start-readme]
|
||||
//
|
||||
// Run this script after an Enterprise deprecation to remove redirects
|
||||
// for the deprecated version. See the Enterprise deprecation issue template for instructions.
|
||||
//
|
||||
// [end-readme]
|
||||
|
||||
program
|
||||
.description(
|
||||
'Remove developer redirects for deprecated versions. The redirects for deprecated versions live in the respective directory in the github/help-docs-archived-enterprise-versions repository.'
|
||||
|
||||
@@ -1,16 +1,4 @@
|
||||
#!/usr/bin/env node
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import xRimraf from 'rimraf'
|
||||
import { allVersions } from '../../lib/all-versions.js'
|
||||
|
||||
const rimraf = xRimraf.sync
|
||||
|
||||
const graphqlDataDir = path.join(process.cwd(), 'data/graphql')
|
||||
const webhooksStaticDir = path.join(process.cwd(), 'lib/webhooks/static')
|
||||
const graphqlStaticDir = path.join(process.cwd(), 'lib/graphql/static')
|
||||
const restDecoratedDir = path.join(process.cwd(), 'lib/rest/static/decorated')
|
||||
const restDereferencedDir = path.join(process.cwd(), 'lib/rest/static/dereferenced')
|
||||
|
||||
// [start-readme]
|
||||
//
|
||||
@@ -18,6 +6,17 @@ const restDereferencedDir = path.join(process.cwd(), 'lib/rest/static/dereferenc
|
||||
//
|
||||
// [end-readme]
|
||||
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import rimraf from 'rimraf'
|
||||
import { allVersions } from '../../lib/all-versions.js'
|
||||
|
||||
const graphqlDataDir = path.join(process.cwd(), 'data/graphql')
|
||||
const webhooksStaticDir = path.join(process.cwd(), 'lib/webhooks/static')
|
||||
const graphqlStaticDir = path.join(process.cwd(), 'lib/graphql/static')
|
||||
const restDecoratedDir = path.join(process.cwd(), 'lib/rest/static/decorated')
|
||||
const restDereferencedDir = path.join(process.cwd(), 'lib/rest/static/dereferenced')
|
||||
|
||||
const supportedEnterpriseVersions = Object.values(allVersions).filter(
|
||||
(v) => v.plan === 'enterprise-server'
|
||||
)
|
||||
@@ -47,6 +46,6 @@ function removeFiles(dir, baseName, supportedVersions) {
|
||||
.forEach((file) => {
|
||||
const fullPath = path.join(dir, file)
|
||||
console.log(`removing ${fullPath}`)
|
||||
rimraf(fullPath)
|
||||
rimraf.sync(fullPath)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
#!/usr/bin/env node
|
||||
import fs from 'fs'
|
||||
import program from 'commander'
|
||||
import frontmatter from '../../lib/read-frontmatter.js'
|
||||
import removeLiquidStatements from '../../script/helpers/remove-liquid-statements.js'
|
||||
import removeDeprecatedFrontmatter from '../../script/helpers/remove-deprecated-frontmatter.js'
|
||||
import { all, getNextReleaseNumber } from '../../lib/enterprise-server-releases.js'
|
||||
import walkFiles from '../helpers/walk-files.js'
|
||||
|
||||
// [start-readme]
|
||||
//
|
||||
@@ -14,6 +7,14 @@ import walkFiles from '../helpers/walk-files.js'
|
||||
//
|
||||
// [end-readme]
|
||||
|
||||
import fs from 'fs'
|
||||
import program from 'commander'
|
||||
import frontmatter from '../../lib/read-frontmatter.js'
|
||||
import removeLiquidStatements from '../../script/helpers/remove-liquid-statements.js'
|
||||
import removeDeprecatedFrontmatter from '../../script/helpers/remove-deprecated-frontmatter.js'
|
||||
import { all, getNextReleaseNumber } from '../../lib/enterprise-server-releases.js'
|
||||
import walkFiles from '../helpers/walk-files.js'
|
||||
|
||||
program
|
||||
.description(
|
||||
'Remove Liquid conditionals and update versions frontmatter for a given Enterprise Server release.'
|
||||
|
||||
Reference in New Issue
Block a user