mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Docs: allow docs to be built on Windows
This commit is contained in:
parent
39ddb6a175
commit
bf1b326988
25
docs/build.js
Normal file
25
docs/build.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const fs = require('fs').promises;
|
||||||
|
const path = require('path');
|
||||||
|
const documentation = require('documentation');
|
||||||
|
|
||||||
|
[
|
||||||
|
'constructor',
|
||||||
|
'input',
|
||||||
|
'resize',
|
||||||
|
'composite',
|
||||||
|
'operation',
|
||||||
|
'colour',
|
||||||
|
'channel',
|
||||||
|
'output',
|
||||||
|
'utility'
|
||||||
|
].forEach(async (m) => {
|
||||||
|
const input = path.join('lib', `${m}.js`);
|
||||||
|
const output = path.join('docs', `api-${m}.md`);
|
||||||
|
|
||||||
|
const ast = await documentation.build(input, { shallow: true });
|
||||||
|
const markdown = await documentation.formats.md(ast, { markdownToc: false });
|
||||||
|
|
||||||
|
await fs.writeFile(output, markdown);
|
||||||
|
});
|
@ -4,6 +4,7 @@
|
|||||||
"public": ".",
|
"public": ".",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
".*",
|
".*",
|
||||||
|
"build.js",
|
||||||
"firebase.json",
|
"firebase.json",
|
||||||
"*.md",
|
"*.md",
|
||||||
"image/**",
|
"image/**",
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
"test-licensing": "license-checker --production --summary --onlyAllow=\"Apache-2.0;BSD;ISC;MIT\"",
|
"test-licensing": "license-checker --production --summary --onlyAllow=\"Apache-2.0;BSD;ISC;MIT\"",
|
||||||
"test-coverage": "./test/coverage/report.sh",
|
"test-coverage": "./test/coverage/report.sh",
|
||||||
"test-leak": "./test/leak/leak.sh",
|
"test-leak": "./test/leak/leak.sh",
|
||||||
"docs-build": "documentation lint lib && for m in constructor input resize composite operation colour channel output utility; do documentation build --shallow --format=md --markdown-toc=false lib/$m.js >docs/api-$m.md; done && node docs/search-index/build",
|
"docs-build": "documentation lint lib && node docs/build && node docs/search-index/build",
|
||||||
"docs-serve": "cd docs && npx serve",
|
"docs-serve": "cd docs && npx serve",
|
||||||
"docs-publish": "cd docs && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"
|
"docs-publish": "cd docs && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user