2021-06-15 16:38:40 -04:00
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const path = require ( 'path' );
2022-07-27 16:39:04 +00:00
2023-06-20 10:26:05 -04:00
// read this text file
const fs = require ( 'fs' );
const versions = fs . readFileSync ( '../../version.txt' , 'utf8' ). split ( '\n' );
2021-06-15 16:38:40 -04:00
// This probably only makes sense for the beta phase, temporary
2022-07-27 16:39:04 +00:00
// function getNextBetaVersionName() {
// const expectedPrefix = '';
2021-06-15 16:38:40 -04:00
2022-07-27 16:39:04 +00:00
// const lastReleasedVersion = versions[0];
// if (!lastReleasedVersion.includes(expectedPrefix)) {
// throw new Error(
// 'this code is only meant to be used during the 2.0 beta phase.'
// );
// }
// const version = parseInt(lastReleasedVersion.replace(expectedPrefix, ''), 10);
// return `${expectedPrefix}${version + 1}`;
// }
2021-06-15 16:38:40 -04:00
2022-07-27 16:39:04 +00:00
// const allDocHomesPaths = [
// '/docs/',
// '/docs/next/',
// ...versions.slice(1).map(version => `/docs/${version}/`),
// ];
2021-06-15 16:38:40 -04:00
const isDev = process . env . NODE_ENV === 'development' ;
2023-09-01 16:19:39 -04:00
const isDeployPreview = process . env . NETLIFY && process . env . CONTEXT === 'deploy-preview' ;
2021-06-15 16:38:40 -04:00
2021-06-16 08:30:10 -04:00
const baseUrl = process . env . BASE_URL || '/' ;
2021-06-15 16:38:40 -04:00
const isBootstrapPreset = process . env . DOCUSAURUS_PRESET === 'bootstrap' ;
// Special deployment for staging locales until they get enough translations
// https://app.netlify.com/sites/docusaurus-i18n-staging
// https://docusaurus-i18n-staging.netlify.app/
const isI18nStaging = process . env . I18N_STAGING === 'true' ;
2021-06-15 19:11:09 -04:00
// const isVersioningDisabled = !!process.env.DISABLE_VERSIONING || isI18nStaging;
2021-06-15 16:38:40 -04:00
2021-06-15 11:50:38 -04:00
/** @type {import('@docusaurus/types').DocusaurusConfig} */
2022-07-27 16:39:04 +00:00
module . exports = {
2021-06-15 23:32:37 -04:00
title : 'OHIF' ,
2021-08-24 14:13:54 +02:00
tagline : 'Open-source web-based medical imaging platform' ,
2021-07-15 00:04:36 +02:00
organizationName : 'Open Health Imaging Foundation' ,
2021-06-15 23:32:37 -04:00
projectName : 'OHIF' ,
2021-06-15 16:38:40 -04:00
baseUrl ,
baseUrlIssueBanner : true ,
2023-06-06 13:34:26 -04:00
url : 'https://docs.ohif.org' ,
2021-06-15 16:38:40 -04:00
i18n : {
defaultLocale : 'en' ,
locales : isDeployPreview
? // Deploy preview: keep it fast!
2022-07-27 16:39:04 +00:00
[ 'en' ]
2021-06-15 16:38:40 -04:00
: isI18nStaging
2024-01-09 10:15:56 -05:00
? // Staging locales: https://docusaurus-i18n-staging.netlify.app/
[ 'en' ]
: // Production locales
[ 'en' ],
2021-06-15 16:38:40 -04:00
},
onBrokenLinks : 'warn' ,
2021-06-15 11:50:38 -04:00
onBrokenMarkdownLinks : 'warn' ,
2021-06-22 17:12:00 -04:00
favicon : 'img/favicon.ico' ,
2021-06-15 16:38:40 -04:00
// customFields: {
// description:
// 'An optimized site generator in React. Docusaurus helps you to move fast and write content. Build documentation websites, blogs, marketing pages, and more.',
// },
themes : [ '@docusaurus/theme-live-codeblock' ],
plugins : [
2023-09-25 23:13:43 -04:00
() => ({
name : 'resolve-react' ,
configureWebpack () {
return {
resolve : {
alias : {
// assuming root node_modules is up from "./packages/<your-docusaurus>
react : path . resolve ( '../../node_modules/react' ),
},
},
};
},
}),
2021-07-13 23:48:16 +02:00
path . resolve ( __dirname , './pluginOHIFWebpackConfig.js' ),
2024-01-09 10:15:56 -05:00
'docusaurus-plugin-image-zoom' , // 3rd party plugin for image click to pop
2021-06-15 16:38:40 -04:00
[
'@docusaurus/plugin-client-redirects' ,
{
fromExtensions : [ 'html' ],
2021-07-05 20:47:30 -04:00
redirects : [
{
// we need this for https://cloud.google.com/healthcare/docs/how-tos/dicom-viewers
2023-06-20 10:26:05 -04:00
to : '/2.0-deprecated/deployment/recipes/google-cloud-healthcare' ,
2021-07-13 23:48:16 +02:00
from : [
'/connecting-to-image-archives/google-cloud-healthcare' ,
'/connecting-to-image-archives/google-cloud-healthcare.html' ,
],
},
],
2021-07-05 20:47:30 -04:00
// createRedirects: function(path) {
// // redirect to /docs from /docs/introduction,
// // as introduction has been made the home doc
// // if (allDocHomesPaths.includes(path)) {
// // return [`${path}/introduction`];
// // }
// if (path.includes("/connecting-to-image-archives/google-cloud-healthcare")) {
// return ["/deployment/recipes/google-cloud-healthcare"]
// }
// },
2021-06-15 16:38:40 -04:00
// redirects: [
// {
// from: ['/'],
// to: '/docs',
// },
// {
// from: ['/docs/support', '/docs/next/support'],
// to: '/community/support',
// },
// {
// from: ['/docs/team', '/docs/next/team'],
// to: '/community/team',
// },
// {
// from: ['/docs/resources', '/docs/next/resources'],
// to: '/community/resources',
// },
// ],
},
],
[
'@docusaurus/plugin-ideal-image' ,
{
quality : 70 ,
max : 1030 , // max resized image's size.
min : 640 , // min resized image's size. if original is lower, use that size.
steps : 2 , // the max number of images generated between min and max (inclusive)
},
],
2021-07-05 20:47:30 -04:00
// [
// '@docusaurus/plugin-pwa',
// {
// debug: isDeployPreview,
// offlineModeActivationStrategies: [
// 'appInstalled',
// 'standalone',
// 'queryString',
// ],
// // swRegister: false,
// // swCustom: path.resolve(__dirname, 'src/sw.js'),
// pwaHead: [
// {
// tagName: 'link',
// rel: 'icon',
// href: 'img/docusaurus.png',
// },
// {
// tagName: 'link',
// rel: 'manifest',
// href: `${baseUrl}manifest.json`,
// },
// {
// tagName: 'meta',
// name: 'theme-color',
// content: 'rgb(37, 194, 160)',
// },
// {
// tagName: 'meta',
// name: 'apple-mobile-web-app-capable',
// content: 'yes',
// },
// {
// tagName: 'meta',
// name: 'apple-mobile-web-app-status-bar-style',
// content: '#000',
// },
// {
// tagName: 'link',
// rel: 'apple-touch-icon',
// href: 'img/docusaurus.png',
// },
// {
// tagName: 'link',
// rel: 'mask-icon',
// href: 'img/docusaurus.svg',
// color: 'rgb(62, 204, 94)',
// },
// {
// tagName: 'meta',
// name: 'msapplication-TileImage',
// content: 'img/docusaurus.png',
// },
// {
// tagName: 'meta',
// name: 'msapplication-TileColor',
// content: '#000',
// },
// ],
// },
2021-08-24 14:13:54 +02:00
// ]
2021-06-15 16:38:40 -04:00
],
presets : [
[
2022-07-27 16:39:04 +00:00
'classic' ,
/** @type {import('@docusaurus/preset-classic').Options} */
({
2021-06-15 16:38:40 -04:00
debug : true , // force debug plugin usage
docs : {
routeBasePath : '/' ,
path : 'docs' ,
sidebarPath : require . resolve ( './sidebars.js' ),
editUrl : ({ locale , docPath }) => {
2021-08-24 14:13:54 +02:00
/*if (locale !== 'en') {
2021-06-15 16:38:40 -04:00
return `https://crowdin.com/project/docusaurus-v2/${locale}`;
2021-08-24 14:13:54 +02:00
}*/
2021-06-15 16:38:40 -04:00
// We want users to submit doc updates to the upstream/next version!
// Otherwise we risk losing the update on the next release.
2023-06-06 13:34:26 -04:00
return `https://github.com/OHIF/Viewers/edit/master/platform/docs/docs/ ${ docPath } ` ;
2021-06-15 16:38:40 -04:00
},
showLastUpdateAuthor : true ,
showLastUpdateTime : true ,
// remarkPlugins: [
// [require('@docusaurus/remark-plugin-npm2yarn'), { sync: true }],
// ],
2021-06-15 19:11:09 -04:00
// disableVersioning: isVersioningDisabled,
2021-08-24 14:13:54 +02:00
lastVersion : 'current' ,
2021-06-15 19:11:09 -04:00
// onlyIncludeVersions:
// !isVersioningDisabled && (isDev || isDeployPreview)
// ? ['current', ...versions.slice(0, 2)]
// : undefined,
2021-08-24 14:13:54 +02:00
versions : {
current : {
2023-06-20 10:26:05 -04:00
label : ` ${ versions } (Latest)` ,
2021-08-24 14:13:54 +02:00
},
},
2021-06-15 16:38:40 -04:00
},
theme : {
customCss : [ require . resolve ( './src/css/custom.css' )],
},
2023-06-12 22:05:01 -04:00
gtag : {
trackingID : 'G-DDBJFE34EG' ,
anonymizeIP : true ,
},
2022-07-27 16:39:04 +00:00
}),
2021-06-15 16:38:40 -04:00
],
],
2022-07-27 16:39:04 +00:00
themeConfig :
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
liveCodeBlock : {
playgroundPosition : 'bottom' ,
},
docs : {
sidebar : {
hideable : true ,
autoCollapseCategories : true ,
},
},
colorMode : {
defaultMode : 'dark' ,
disableSwitch : false ,
// respectPrefersColorScheme: true,
},
2023-07-27 12:39:12 -04:00
announcementBar : {
id : 'healthimaging' ,
content :
2024-04-29 13:00:14 -04:00
'🎉 OHIF 3.8 has landed! Explore 4D and volume rendering, enhanced layout menus, streamlined visualization controls, workflow steps, and more. You can find the release notes by following this <a target="_blank" rel="noopener noreferrer" href="https://ohif.org/release-notes/3p8/">Link!</a> 🌟' ,
2023-07-27 12:39:12 -04:00
},
2022-07-27 16:39:04 +00:00
prism : {
theme : require ( 'prism-react-renderer/themes/github' ),
darkTheme : require ( 'prism-react-renderer/themes/dracula' ),
2021-06-15 11:50:38 -04:00
},
2022-07-27 16:39:04 +00:00
algolia : {
appId : 'EFLT6YIHHZ' ,
apiKey : 'c220dd24fe4f86248eea3b1238a1fb60' ,
indexName : 'ohif' ,
},
2024-01-09 10:15:56 -05:00
// zoom: {
// selector: '.markdown > img',
// background: {
// light: 'rgb(255, 255, 255)',
// dark: 'rgb(50, 50, 50)',
// },
// config: {
// // options you can specify via https://github.com/francoischalifour/medium-zoom#usage
// },
// },
2022-07-27 16:39:04 +00:00
navbar : {
hideOnScroll : false ,
logo : {
alt : 'OHIF Logo' ,
src : 'img/ohif-logo-light.svg' ,
srcDark : 'img/ohif-logo.svg' ,
2021-06-15 11:50:38 -04:00
},
2022-07-27 16:39:04 +00:00
items : [
{
2023-06-20 10:26:05 -04:00
href : 'https://ohif.org/showcase' ,
2023-06-12 22:05:01 -04:00
label : 'Showcase' ,
2023-06-06 13:34:26 -04:00
target : '_blank' ,
2022-07-27 16:39:04 +00:00
position : 'left' ,
},
{
position : 'left' ,
to : '/' ,
activeBaseRegex : '^(/next/|/)$' ,
docId : 'Introduction' ,
label : 'Docs' ,
},
{
2023-06-20 10:26:05 -04:00
href : 'https://ohif.org/collaborate' ,
2023-06-12 22:05:01 -04:00
label : 'Collaborate' ,
2023-06-06 13:34:26 -04:00
target : '_blank' ,
2022-07-27 16:39:04 +00:00
position : 'left' ,
},
2023-06-20 10:26:05 -04:00
{
to : '/migration-guide' ,
label : 'Migration Guides' ,
position : 'left' ,
className : 'new-badge' ,
},
2022-07-27 16:39:04 +00:00
{
to : '/help' ,
//activeBaseRegex: '(^/help$)|(/help)',
label : 'Help' ,
position : 'right' ,
},
{
type : 'docsVersionDropdown' ,
position : 'right' ,
dropdownActiveClassDisabled : true ,
dropdownItemsAfter : [
{
type : 'html' ,
value : '<hr class="dropdown-separator">' ,
},
{
to : '/versions' ,
label : 'All versions' ,
},
],
},
{
type : 'localeDropdown' ,
position : 'right' ,
dropdownItemsAfter : [
{
to : '/platform/internationalization' ,
label : 'Help Us Translate' ,
},
],
},
{
to : 'https://github.com/OHIF/Viewers' ,
position : 'right' ,
className : 'header-github-link' ,
'aria-label' : 'GitHub Repository' ,
},
],
},
footer : {
style : 'dark' ,
links : [
{
title : ' ' ,
items : [
{
// This doesn't show up on dev for some reason, but displays in build
html : `
2021-08-30 09:36:05 -04:00
<a href="https://www.massgeneral.org/" target="_blank" rel="noreferrer noopener">
2021-08-31 10:30:53 -04:00
<img src="/img/mgh-logo.png" id="mgh-logo" alt="MGH" />
2021-06-22 21:02:14 -04:00
</a>
` ,
2022-07-27 16:39:04 +00:00
},
],
},
{
title : 'Learn' ,
items : [
{
label : 'Introduction' ,
to : '/' ,
},
{
2023-06-20 10:26:05 -04:00
label : 'Getting Started' ,
2022-07-27 16:39:04 +00:00
to : 'development/getting-started' ,
},
2023-06-20 10:26:05 -04:00
{
label : 'FAQ' ,
to : '/faq' ,
},
{
label : 'Resources' ,
to : '/resources' ,
},
2022-07-27 16:39:04 +00:00
],
},
{
title : 'Community' ,
items : [
{
label : 'Discussion board' ,
2023-06-20 10:26:05 -04:00
href : 'https://community.ohif.org/' ,
2022-07-27 16:39:04 +00:00
},
{
label : 'Help' ,
to : '/help' ,
},
],
},
{
title : 'More' ,
items : [
{
label : 'Donate' ,
2023-06-20 10:26:05 -04:00
href : 'https://giving.massgeneral.org/ohif' ,
2022-07-27 16:39:04 +00:00
},
{
label : 'GitHub' ,
2023-06-20 10:26:05 -04:00
href : 'https://github.com/OHIF/Viewers' ,
2022-07-27 16:39:04 +00:00
},
{
label : 'Twitter' ,
2023-06-20 10:26:05 -04:00
href : 'https://twitter.com/OHIFviewer' ,
2022-07-27 16:39:04 +00:00
},
],
},
],
logo : {
alt : 'OHIF ' ,
src : 'img/netlify-color-accent.svg' ,
2023-06-06 13:34:26 -04:00
href : 'https://viewer.ohif.org/' ,
2021-06-21 19:35:41 -04:00
},
2022-07-27 16:39:04 +00:00
copyright : `OHIF is open source software released under the MIT license.` ,
2021-08-30 09:36:05 -04:00
},
2022-07-27 16:39:04 +00:00
}),
};