From 51d70c45749c4d50c7102934a696c115da102f09 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Mon, 6 Jan 2020 14:48:35 +0000 Subject: [PATCH] Docs: switch hosting from Readthedocs to Firebase --- .github/CONTRIBUTING.md | 2 +- .gitignore | 1 + docs/css/extra.css | 5 --- docs/firebase.json | 96 +++++++++++++++++++++++++++++++++++++++++ mkdocs.yml | 27 ------------ package.json | 6 +-- 6 files changed, 101 insertions(+), 36 deletions(-) delete mode 100644 docs/css/extra.css create mode 100644 docs/firebase.json delete mode 100644 mkdocs.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index f94d61a1..ba9cf0d5 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -71,7 +71,7 @@ The public API is documented with [JSDoc](http://usejsdoc.org/) annotated commen These can be converted to Markdown by running: ```sh -npm run docs +npm run docs-build ``` Please include documentation updates in any Pull Request that modifies the public API. diff --git a/.gitignore b/.gitignore index e7f89dee..f5dd9a65 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ vendor .vscode/ package-lock.json .idea +.firebase diff --git a/docs/css/extra.css b/docs/css/extra.css deleted file mode 100644 index e2bc8e06..00000000 --- a/docs/css/extra.css +++ /dev/null @@ -1,5 +0,0 @@ -/* Nest document subheadings in navigation */ -ul.subnav ul:not(.subnav) { - padding-left: 2em; - font-size: 80%; -} diff --git a/docs/firebase.json b/docs/firebase.json new file mode 100644 index 00000000..04d08434 --- /dev/null +++ b/docs/firebase.json @@ -0,0 +1,96 @@ +{ + "hosting": { + "site": "pixelplumbing-sharp", + "public": ".", + "ignore": [ + ".*", + "*.json", + "*.md", + "image/**" + ], + "headers": [ + { + "source": "**", + "headers": [ + { + "key": "Cache-Control", + "value": "max-age=86400" + } + ] + } + ], + "redirects": [ + { + "source": "**/install/**", + "destination": "/install", + "type": 301 + }, + { + "source": "**/api-constructor/**", + "destination": "/api-constructor", + "type": 301 + }, + { + "source": "**/api-input/**", + "destination": "/api-input", + "type": 301 + }, + { + "source": "**/api-output/**", + "destination": "/api-output", + "type": 301 + }, + { + "source": "**/api-resize/**", + "destination": "/api-resize", + "type": 301 + }, + { + "source": "**/api-compsite/**", + "destination": "/api-compsite", + "type": 301 + }, + { + "source": "**/api-operation/**", + "destination": "/api-operation", + "type": 301 + }, + { + "source": "**/api-colour/**", + "destination": "/api-colour", + "type": 301 + }, + { + "source": "**/api-channel/**", + "destination": "/api-channel", + "type": 301 + }, + { + "source": "**/api-utility/**", + "destination": "/api-utility", + "type": 301 + }, + { + "source": "**/performance/**", + "destination": "/performance", + "type": 301 + }, + { + "source": "**/changelog/**", + "destination": "/changelog", + "type": 301 + }, + { + "source": "/en/**", + "destination": "/", + "type": 301 + } + ], + "rewrites": [ + { + "source": "**", + "destination": "/index.html" + } + ] + } +} diff --git a/mkdocs.yml b/mkdocs.yml deleted file mode 100644 index 80c55200..00000000 --- a/mkdocs.yml +++ /dev/null @@ -1,27 +0,0 @@ -site_name: sharp -site_url: https://sharp.pixelplumbing.com/ -repo_url: https://github.com/lovell/sharp -site_description: High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP and TIFF images -copyright: pixelplumbing.com -google_analytics: ['UA-13034748-12', 'sharp.pixelplumbing.com'] -theme: readthedocs -extra_css: - - css/extra.css -markdown_extensions: - - toc: - permalink: True -pages: - - Home: index.md - - Installation: install.md - - API: - - Constructor: api-constructor.md - - Input: api-input.md - - Output: api-output.md - - "Resizing images": api-resize.md - - "Compositing images": api-composite.md - - "Image operations": api-operation.md - - "Colour manipulation": api-colour.md - - "Channel manipulation": api-channel.md - - Utilities: api-utility.md - - Performance: performance.md - - Changelog: changelog.md diff --git a/package.json b/package.json index 211baf70..226b47df 100644 --- a/package.json +++ b/package.json @@ -74,13 +74,13 @@ "test-licensing": "license-checker --production --summary --onlyAllow=\"Apache-2.0;BSD;ISC;MIT\"", "test-coverage": "./test/coverage/report.sh", "test-leak": "./test/leak/leak.sh", - "docs": "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" + "docs-build": "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", + "docs-serve": "cd docs && npx serve", + "docs-publish": "cd docs && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp" }, "main": "lib/index.js", "files": [ "binding.gyp", - "docs/**", - "!docs/css/**", "install/**", "lib/**", "src/**"