Skip to content

Commit

Permalink
chore: update docusaurus template (#408)
Browse files Browse the repository at this point in the history
Signed-off-by: aeneasr <[email protected]>
  • Loading branch information
aeneasr authored Apr 12, 2020
1 parent 9f26506 commit aeb5201
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"scripts": {
"gen": "node ./docs/scripts/fix-api.js ./docs/docs/reference/api.md && node ./docs/scripts/config.js docs/config.js",
"gen": "cd .. && node ./docs/scripts/fix-api.js ./docs/docs/reference/api.md && node ./docs/scripts/config.js docs/config.js",
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
Expand Down
8 changes: 4 additions & 4 deletions docs/scripts/docker-tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ const replace = (path, replacer) =>
});
});

config.updateTags.forEach(({ files, image, pattern }) => {
config.updateTags.forEach(({files, image, replacer}) => {
files.forEach((loc) => {
replace(loc, (content) => {
if (pattern) {
content.replace(new RegExp(pattern, 'g'), `${image}:${next}`);
if (replacer) {
return replacer({ content, next })
}

return content.replace(
new RegExp(`${image}:v[0-9a-zA-Z\\.\\+\\_\\-]+`, 'g'),
`${image}:${next}`
);
)
})
.then(() => {
console.log('Done!');
Expand Down
2 changes: 1 addition & 1 deletion docs/scripts/fix-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fs.readFile(file, (err, b) => {

const t = b
.toString()
.replace(/^id: api/gim, '')
.replace(/^id: api/img,'')
.replace(/^title:(.*)/im, 'title: REST API\nid: api') // improve title, add docusaurus id
.replace(/^language_tabs:.*\n/im, '') // not supported by docusaurus
.replace(/^toc_footers.*\n/im, '') // not supported by docusaurus
Expand Down
28 changes: 15 additions & 13 deletions docs/scripts/rerelease.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
const path = require('path');
const name = process.argv[2];
const fs = require('fs');

const p = path.join(__dirname, '../versions.json');

fs.writeFile(p, JSON.stringify(require(p).filter((v) => v !== name)), function (
err
) {
if (err) {
return console.error(err);
}
});
const path = require('path')
const name = process.argv[2];
const fs = require('fs');

const p = path.join(__dirname, '../versions.json');

fs.writeFile(
p,
JSON.stringify(require(p).filter(v => v !== name)),
function(err) {
if (err) {
return console.error(err);
}
}
);

0 comments on commit aeb5201

Please sign in to comment.