Browse Source
Update the docs build to use the `package.json` file from the `main` branch. See gh-40072pull/44847/head
6 changed files with 58 additions and 3323 deletions
@ -1,3 +1,5 @@
@@ -1,3 +1,5 @@
|
||||
node_modules |
||||
.vscode |
||||
build |
||||
package.json |
||||
package-lock.json |
||||
|
||||
@ -1,15 +0,0 @@
@@ -1,15 +0,0 @@
|
||||
{ |
||||
"scripts": { |
||||
"antora": "node npm/antora.js" |
||||
}, |
||||
"devDependencies": { |
||||
"@antora/cli": "3.2.0-alpha.4", |
||||
"@antora/site-generator": "3.2.0-alpha.4", |
||||
"@antora/atlas-extension": "1.0.0-alpha.2", |
||||
"@springio/antora-extensions": "1.8.2", |
||||
"@springio/antora-xref-extension": "1.0.0-alpha.3", |
||||
"@springio/antora-zip-contents-collector-extension": "1.0.0-alpha.2", |
||||
"@asciidoctor/tabs": "1.0.0-beta.6", |
||||
"@springio/asciidoctor-extensions": "1.0.0-alpha.10" |
||||
} |
||||
} |
||||
@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
|
||||
;(function () { |
||||
'use strict' |
||||
|
||||
const childProcess = require('child_process') |
||||
const fs = require('fs'); |
||||
|
||||
async function main() { |
||||
try { |
||||
checkout(process.argv.includes('--no-checkout')) |
||||
install(process.argv.includes('--no-install')) |
||||
run(process.argv.includes('--no-run')) |
||||
} catch (error) { |
||||
console.log("Unexpected error") |
||||
process.exitCode = (error.exitCode) ? error.exitCode : 1 |
||||
} |
||||
} |
||||
|
||||
function checkout(skip) { |
||||
if (skip) return |
||||
console.log('Checking out Antora package.json files from `main`') |
||||
const packageJson = childProcess.execSync('git show main:antora/package.json', {env: process.env}) |
||||
const packageLockJson = childProcess.execSync('git show main:antora/package-lock.json', {env: process.env}) |
||||
fs.writeFileSync('package.json', packageJson) |
||||
fs.writeFileSync('package-lock.json', packageLockJson) |
||||
} |
||||
|
||||
function install(skip) { |
||||
if (skip) return |
||||
console.log('Installing modules') |
||||
childProcess.execSync('npm ci --silent --no-progress', {stdio: 'inherit', env: process.env}) |
||||
} |
||||
|
||||
function run(skip) { |
||||
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8')) |
||||
const uiBundleUrl = packageJson.config['ui-bundle-url']; |
||||
const command = `npx antora antora-playbook.yml --stacktrace --ui-bundle-url ${uiBundleUrl}` |
||||
if (uiBundleUrl.includes('/latest/')) { |
||||
console.log('Refusing to run Antora with development build of UI') |
||||
console.log(`$ ${command}`) |
||||
process.exitCode = 1 |
||||
return |
||||
} |
||||
console.log((!skip) ? 'Running Antora' : 'Use the following command to run Antora') |
||||
console.log(`$ ${command}`) |
||||
if (!skip) childProcess.execSync(command, {stdio: 'inherit', env: process.env}) |
||||
} |
||||
|
||||
main() |
||||
|
||||
})() |
||||
Loading…
Reference in new issue