@antora/playbook-builder
Advanced tools
Comparing version 1.0.0-rc.1 to 1.0.0-rc.2
@@ -34,28 +34,18 @@ 'use strict' | ||
const specFileRelPath = config.get('playbook') | ||
if (specFileRelPath) { | ||
let specFileAbsPath = ospath.resolve(specFileRelPath) | ||
if (ospath.extname(specFileAbsPath)) { | ||
if (!fs.existsSync(specFileAbsPath)) throw new Error('playbook file does not exist') | ||
} else if (fs.existsSync(specFileAbsPath + '.yml')) { | ||
specFileAbsPath += '.yml' | ||
} else if (fs.existsSync(specFileAbsPath + '.json')) { | ||
specFileAbsPath += '.json' | ||
} else if (fs.existsSync(specFileAbsPath + '.cson')) { | ||
specFileAbsPath += '.cson' | ||
const relSpecFilePath = config.get('playbook') | ||
if (relSpecFilePath) { | ||
let absSpecFilePath = ospath.resolve(relSpecFilePath) | ||
if (ospath.extname(absSpecFilePath)) { | ||
if (!fs.existsSync(absSpecFilePath)) throw new Error('playbook file does not exist') | ||
} else if (fs.existsSync(absSpecFilePath + '.yml')) { | ||
absSpecFilePath += '.yml' | ||
} else if (fs.existsSync(absSpecFilePath + '.json')) { | ||
absSpecFilePath += '.json' | ||
} else if (fs.existsSync(absSpecFilePath + '.cson')) { | ||
absSpecFilePath += '.cson' | ||
} else { | ||
throw new Error('playbook file could not be resolved') | ||
} | ||
const playbookData = parseSpecFile(specFileAbsPath) | ||
// temporary migration | ||
if ('ui' in playbookData && typeof playbookData.ui.bundle === 'string') { | ||
playbookData.ui.bundle = { url: playbookData.ui.bundle } | ||
if ('start_path' in playbookData.ui) { | ||
playbookData.ui.bundle.start_path = playbookData.ui.start_path | ||
delete playbookData.ui.start_path | ||
} | ||
} | ||
// end temporary migration | ||
config.load(playbookData) | ||
if (specFileRelPath !== specFileAbsPath) config.set('playbook', specFileAbsPath) | ||
config.load(parseSpecFile(absSpecFilePath)) | ||
if (relSpecFilePath !== absSpecFilePath) config.set('playbook', absSpecFilePath) | ||
} | ||
@@ -62,0 +52,0 @@ |
{ | ||
"name": "@antora/playbook-builder", | ||
"version": "1.0.0-rc.1", | ||
"version": "1.0.0-rc.2", | ||
"description": "Builds a playbook object from user input for configuring successive documentation components in an Antora pipeline.", | ||
@@ -5,0 +5,0 @@ "license": "MPL-2.0", |
12240
332