Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ability to generate local docs by disabling s3 syncing #76

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions generate-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,6 @@ const runCmd = async (cmd, path) => {
'--version',
version,
'--ignorePreviouslyIndexedDoc',
'--no-sync'
]).stdout.pipe(process.stdout)
})()
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ let specificDocsVersion = argv.version ? argv.version : ''
let ignorePreviouslyIndexedDoc =
projects.length !== 0 && specificDocsVersion !== '' && argv.ignorePreviouslyIndexedDoc
let runClean = !!argv.clean
let noSync = !!argv.noSync

const { apiDocsProcessor } = require('./main.js')
apiDocsProcessor(projects, specificDocsVersion, ignorePreviouslyIndexedDoc, runClean)
apiDocsProcessor(projects, specificDocsVersion, ignorePreviouslyIndexedDoc, runClean, noSync)
8 changes: 5 additions & 3 deletions lib/read-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ export default function readDocs(
)

if (!runClean) {
availableSourceVersions = availableSourceVersions.filter(
version => !prevIndexedVersions.includes(version)
)
if (!ignorePreviouslyIndexedDoc) {
availableSourceVersions = availableSourceVersions.filter(
version => !prevIndexedVersions.includes(version)
)
}

folders = folders.filter(f => {
if (!prevIndexedVersions.includes(f) || ignorePreviouslyIndexedDoc) {
Expand Down
20 changes: 11 additions & 9 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import revProjVersionFiles from './lib/rev-docs'
import { downloadExistingDocsToLocal, uploadDocsToS3 } from './lib/s3-sync'
import fixBorkedYuidocFiles from './lib/fix-borked-yuidoc-files'

export function apiDocsProcessor(
export async function apiDocsProcessor(
projects,
specificDocsVersion,
ignorePreviouslyIndexedDoc,
runClean
runClean,
noSync
) {
RSVP.on('error', reason => {
console.log(reason)
Expand All @@ -28,13 +29,14 @@ export function apiDocsProcessor(
let docsVersionMsg = specificDocsVersion !== '' ? `. For version ${specificDocsVersion}` : ''
console.log(`Downloading docs for ${projects.join(' & ')}${docsVersionMsg}`)

downloadExistingDocsToLocal()
.then(() => fetchYuiDocs(projects, specificDocsVersion, ignorePreviouslyIndexedDoc || runClean))
.then(async filesToProcess => {
await fs.mkdirp('tmp/s3-original-docs')
return await RSVP.Promise.all(filesToProcess.map(fixBorkedYuidocFiles))
})
.then(() => readDocs(projects, specificDocsVersion, ignorePreviouslyIndexedDoc, runClean))
if (!noSync) {
await downloadExistingDocsToLocal()
let filesToProcess = await fetchYuiDocs(projects, specificDocsVersion, runClean)
await fs.mkdirp('tmp/s3-original-docs')
await RSVP.Promise.all(filesToProcess.map(fixBorkedYuidocFiles))
}

await readDocs(projects, specificDocsVersion, ignorePreviouslyIndexedDoc, runClean)
.then(docs => {
return RSVP.map(projects, projectName => {
return RSVP.map(docs[projectName], doc => {
Expand Down