Skip to content

Commit

Permalink
feat(command-dev): support Docusaurus V2 (#1228)
Browse files Browse the repository at this point in the history
  • Loading branch information
monsonjeremy authored Sep 14, 2020
1 parent 39b0f31 commit f7459ff
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/detectors/docusaurus.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
const { hasRequiredDeps, hasRequiredFiles, getYarnOrNPMCommand, scanScripts } = require('./utils/jsdetect')
module.exports = function() {
// REQUIRED FILES
if (!hasRequiredFiles(['package.json', 'siteConfig.js'])) return false
if (!hasRequiredFiles(['package.json'])) return false

const hasV1 = hasRequiredDeps(['docusaurus'])
const hasV2 = hasRequiredDeps(['@docusaurus/core'])

// REQUIRED DEPS
if (!hasRequiredDeps(['docusaurus'])) return false
if (!hasV1 && !hasV2) return false

// REQUIRED CONFIG FILE
const hasConfigFile = hasV1 ? hasRequiredFiles(['siteConfig.js']) : hasRequiredFiles(['docusaurus.config.js'])

if (!hasConfigFile) return false

/** everything below now assumes that we are within gatsby */

const possibleArgsArrs = scanScripts({
const v1Command = {
preferredScriptsArr: ['start'],
preferredCommand: 'docusaurus-start',
})
}

const v2Command = {
preferredScriptsArr: ['start'],
preferredCommand: 'docusaurus start',
}

const possibleArgsArrs = scanScripts(hasV1 ? v1Command : v2Command)

return {
framework: 'docusaurus',
Expand Down

0 comments on commit f7459ff

Please sign in to comment.