-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6db3dc5
commit 98f9405
Showing
8 changed files
with
52 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
const fs = require('fs') | ||
import { writeFile } from 'node:fs/promises' | ||
|
||
const files = [ | ||
'swagger-ui.css', | ||
|
@@ -10,6 +10,6 @@ Promise.all( | |
files.map(f => | ||
fetch('https://unpkg.com/[email protected]/' + f) | ||
.then(res => res.text()) | ||
.then(text => fs.promises.writeFile('www_root/' + f, text)) | ||
.then(text => writeFile('www_root/' + f, text)) | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
const fs = require('fs') | ||
const swaggerJsdoc = require('swagger-jsdoc') | ||
const norchVersion = require('../package.json').version | ||
import { readFileSync, writeFileSync } from 'node:fs' | ||
import swaggerJsdoc from 'swagger-jsdoc' | ||
|
||
const version = JSON.parse(readFileSync('./package.json', 'utf8')).version | ||
|
||
const swaggerDefinition = { | ||
openapi: '3.0.1', | ||
info: { | ||
title: 'Norch', | ||
description: | ||
'This is the API documentation for `norch@' + | ||
norchVersion + | ||
version + | ||
'`. You can use this page to get familiar with what Norch can do. If you want to try out the API calls on a server other than `localhost`, fill out the server variable below in the input box labeled `URL`', | ||
contact: { | ||
email: '[email protected]' | ||
|
@@ -17,7 +18,7 @@ const swaggerDefinition = { | |
// name: 'MIT', | ||
// url: 'https://github.com/fergiemcdowall/search-index/blob/master/LICENSE' | ||
// }, | ||
version: norchVersion | ||
version | ||
}, | ||
externalDocs: { | ||
description: 'Find out more about Swagger', | ||
|
@@ -281,8 +282,8 @@ const swaggerDefinition = { | |
} | ||
} | ||
|
||
fs.writeFileSync( | ||
'www_root/openapi-norch-' + norchVersion + '.json', | ||
writeFileSync( | ||
'www_root/openapi-norch-' + version + '.json', | ||
JSON.stringify( | ||
swaggerJsdoc({ | ||
swaggerDefinition, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters