mirror of
https://github.com/twirl/The-API-Book.git
synced 2025-02-16 18:34:31 +02:00
epub build
This commit is contained in:
parent
89b608c5b4
commit
620f913bbb
BIN
docs/API.en.epub
BIN
docs/API.en.epub
Binary file not shown.
BIN
docs/API.ru.epub
BIN
docs/API.ru.epub
Binary file not shown.
@ -7,7 +7,7 @@
|
||||
"version": "2.0.0",
|
||||
"devDependencies": {
|
||||
"@jest/globals": "^29.6.4",
|
||||
"@twirl/book-builder": "0.0.25",
|
||||
"@twirl/book-builder": "0.0.26",
|
||||
"@types/jest": "^29.5.4",
|
||||
"express": "^4.18.2",
|
||||
"jest": "^29.6.4",
|
||||
|
@ -1,47 +1,51 @@
|
||||
import { readFileSync, readdirSync, unlinkSync } from 'fs';
|
||||
import { resolve as pathResolve } from 'path';
|
||||
//import { init, plugins } from '@twirl/book-builder';
|
||||
import { init, plugins } from '../../The-Book-Builder/index.js';
|
||||
import { init, plugins } from '@twirl/book-builder';
|
||||
import { templates } from '../src/templates.mjs';
|
||||
import { apiHighlight } from '../src/api-highlight.mjs';
|
||||
import { buildLanding } from './build-landing.mjs';
|
||||
|
||||
const flags = process.argv.reduce((flags, v) => {
|
||||
switch (v) {
|
||||
case '--clean-cache':
|
||||
flags.cleanCache = true;
|
||||
break;
|
||||
const { flags, args } = process.argv.slice(2).reduce(
|
||||
({ flags, args }, v) => {
|
||||
switch (v) {
|
||||
case '--no-cache':
|
||||
flags.noCache = true;
|
||||
break;
|
||||
}
|
||||
if (!v.startsWith('--')) {
|
||||
args.push(v);
|
||||
}
|
||||
return { flags, args };
|
||||
},
|
||||
{
|
||||
args: [],
|
||||
flags: {}
|
||||
}
|
||||
return flags;
|
||||
}, {});
|
||||
|
||||
if (flags.cleanCache) {
|
||||
console.log('Cleaning cache…');
|
||||
clean();
|
||||
}
|
||||
);
|
||||
|
||||
const l10n = {
|
||||
en: JSON.parse(readFileSync('./src/en/l10n.json', 'utf-8')),
|
||||
ru: JSON.parse(readFileSync('./src/ru/l10n.json', 'utf-8'))
|
||||
};
|
||||
|
||||
const langsToBuild = (process.argv[2] &&
|
||||
process.argv[2].split(',').map((s) => s.trim())) || ['ru', 'en'];
|
||||
const langsToBuild = (args[0] && args[0].split(',').map((s) => s.trim())) || [
|
||||
'ru',
|
||||
'en'
|
||||
];
|
||||
|
||||
const targets = (
|
||||
(process.argv[3] && process.argv[3].split(',')) || [
|
||||
'html',
|
||||
'pdf',
|
||||
'epub',
|
||||
'landing'
|
||||
]
|
||||
(args[1] && args[1].split(',')) || ['html', 'pdf', 'epub', 'landing']
|
||||
).reduce((targets, arg) => {
|
||||
targets[arg.trim()] = true;
|
||||
return targets;
|
||||
}, {});
|
||||
|
||||
const chapters = process.argv[4];
|
||||
const noCache = process.argv[5] == '--no-cache';
|
||||
const chapters = args[2];
|
||||
const noCache = flags.noCache;
|
||||
|
||||
if (flags.noCache) {
|
||||
clean();
|
||||
}
|
||||
|
||||
console.log(`Building langs: ${langsToBuild.join(', ')}…`);
|
||||
(async () => {
|
||||
|
@ -8,34 +8,6 @@ body {
|
||||
background: transparent none;
|
||||
}
|
||||
|
||||
code,
|
||||
pre {
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
code {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
pre {
|
||||
margin: 1em 0;
|
||||
padding: 1em;
|
||||
border-radius: 0.25em;
|
||||
border-top: 1px solid rgba(0, 0, 0, 0.45);
|
||||
border-left: 1px solid rgba(0, 0, 0, 0.45);
|
||||
box-shadow: 0.1em 0.1em 0.1em rgba(0, 0, 0, 0.45);
|
||||
page-break-inside: avoid;
|
||||
overflow-x: auto;
|
||||
font-size: 80%;
|
||||
widows: 20;
|
||||
orphans: 20;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
pre code {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
"description": "API-first development is one of the hottest technical topics nowadays since many companies have started to realize that APIs serves as a multiplier to their opportunities — but it amplifies the design mistakes as well. This book is written to share expertise and describe best practices in designing and developing APIs. It comprises six sections dedicated to the following topics: the API design, API patterns, maintaining backward compatibility, HTTP APIs & the REST architectural principles, SDKs and UI libraries, API product management.",
|
||||
"publisher": "Sergey Konstantinov",
|
||||
"copyright": "© Sergey Konstantinov, 2023",
|
||||
"locale": "en_US",
|
||||
"locale": "en-US",
|
||||
"file": "API",
|
||||
"isbn": "ISBN",
|
||||
"references": "References",
|
||||
|
@ -7,7 +7,7 @@
|
||||
"publisher": "Сергей Константинов",
|
||||
"copyright": "© Сергей Константинов, 2023",
|
||||
"isbn": "ISBN",
|
||||
"locale": "ru_RU",
|
||||
"locale": "ru-RU",
|
||||
"file": "API",
|
||||
"references": "Примечания",
|
||||
"landingFile": "index.ru.html",
|
||||
|
Loading…
x
Reference in New Issue
Block a user