Skip to content

Commit

Permalink
Typescriptify docusaurus website code (#3448)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Jan 10, 2023
1 parent c790a4b commit 16da952
Show file tree
Hide file tree
Showing 22 changed files with 524 additions and 573 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ exports[`renders with a couple of categorized tracks 1`] = `
Filter tracks
</label>
<div
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedEnd css-13s3qt4-MuiInputBase-root-MuiInput-root"
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedEnd css-1blad95-MuiInputBase-root-MuiInput-root"
>
<input
aria-invalid="false"
Expand Down Expand Up @@ -178,7 +178,7 @@ exports[`renders with a couple of uncategorized tracks 1`] = `
Filter tracks
</label>
<div
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedEnd css-13s3qt4-MuiInputBase-root-MuiInput-root"
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedEnd css-1blad95-MuiInputBase-root-MuiInput-root"
>
<input
aria-invalid="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exports[`renders with the available plugins 1`] = `
Filter plugins
</label>
<div
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedEnd css-13s3qt4-MuiInputBase-root-MuiInput-root"
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedEnd css-1blad95-MuiInputBase-root-MuiInput-root"
>
<input
aria-invalid="false"
Expand Down
4 changes: 1 addition & 3 deletions products/jbrowse-cli/src/commands/text-index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ function mockRemote1(exampleSite: Scope) {

function mockRemote2(exampleSite: Scope) {
return exampleSite
.get(
'/GMOD/jbrowse-components/cli_trix_indexer_stub/test_data/volvox/volvox.sort.gff3.gz',
)
.get('/GMOD/jbrowse-components/main/test_data/volvox/volvox.sort.gff3.gz')
.reply(200, fs.createReadStream(dataDir('volvox.sort.gff3.gz')))
}

Expand Down
4 changes: 2 additions & 2 deletions products/jbrowse-cli/test/data/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@
"adapter": {
"type": "Gff3TabixAdapter",
"gffGzLocation": {
"uri": "https://github.com/GMOD/jbrowse-components/raw/cli_trix_indexer_stub/test_data/volvox/volvox.sort.gff3.gz",
"uri": "https://github.com/GMOD/jbrowse-components/raw/main/test_data/volvox/volvox.sort.gff3.gz",
"locationType": "UriLocation"
},
"index": {
"location": {
"uri": "https://github.com/GMOD/jbrowse-components/raw/cli_trix_indexer_stub/test_data/volvox/volvox.sort.gff3.gz.tbi",
"uri": "https://github.com/GMOD/jbrowse-components/raw/main/test_data/volvox/volvox.sort.gff3.gz.tbi",
"locationType": "UriLocation"
}
}
Expand Down
4 changes: 2 additions & 2 deletions products/jbrowse-cli/test/data/indexing_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@
"adapter": {
"type": "Gff3TabixAdapter",
"gffGzLocation": {
"uri": "https://github.com/GMOD/jbrowse-components/raw/cli_trix_indexer_stub/test_data/volvox/volvox.sort.gff3.gz",
"uri": "https://github.com/GMOD/jbrowse-components/raw/main/test_data/volvox/volvox.sort.gff3.gz",
"locationType": "UriLocation"
},
"index": {
"location": {
"uri": "https://github.com/GMOD/jbrowse-components/raw/cli_trix_indexer_stub/test_data/volvox/volvox.sort.gff3.gz.tbi",
"uri": "https://github.com/GMOD/jbrowse-components/raw/main/test_data/volvox/volvox.sort.gff3.gz.tbi",
"locationType": "UriLocation"
}
}
Expand Down
4 changes: 2 additions & 2 deletions products/jbrowse-cli/test/data/trix/volvox_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
"adapterConf": {
"type": "Gff3TabixAdapter",
"gffGzLocation": {
"uri": "https://github.com/GMOD/jbrowse-components/raw/cli_trix_indexer_stub/test_data/volvox/volvox.sort.gff3.gz",
"uri": "https://github.com/GMOD/jbrowse-components/raw/main/test_data/volvox/volvox.sort.gff3.gz",
"locationType": "UriLocation"
},
"index": {
"location": {
"uri": "https://github.com/GMOD/jbrowse-components/raw/cli_trix_indexer_stub/test_data/volvox/volvox.sort.gff3.gz.tbi",
"uri": "https://github.com/GMOD/jbrowse-components/raw/main/test_data/volvox/volvox.sort.gff3.gz.tbi",
"locationType": "UriLocation"
}
}
Expand Down
2 changes: 1 addition & 1 deletion website/blog/2021-11-04-v1.5.1-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ http://localhost:3000/?config=test_data%2Fconfig_demo.json&session=share-TSa1mZh

This can also appear in SVG exports

![](img/cytobands_svg.png)
![](/img/cytobands_svg.png)

## Plugins can integrate with "Add track" workflow better

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ tools (You can use `F12` or `Ctrl-Shift-I` or right-click the page and select
`Inspect`) and go to the "Network" tab. If you see something like the below with
a status of 200 for "jbrowse-linear-view.js", then you are good to go!

![Network tab of developer tools showing that script has loaded correctly](../../../img/bcc2020_network_success.png)
![Network tab of developer tools showing that script has loaded correctly](/img/bcc2020_network_success.png)

Now we need to actually instantiate a view. The code to do so looks like this:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ source ~/.bashrc
Now if you run the command `jbrowse --help` in the terminal, you should see
something like this:

![The output of `jbrowse --help` in a terminal](../../../img/bcc2020_jbrowse_help.png)
![The output of `jbrowse --help` in a terminal](/img/bcc2020_jbrowse_help.png)

:::note

Expand Down
1 change: 0 additions & 1 deletion website/img

This file was deleted.

43 changes: 27 additions & 16 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,45 @@
"homepage": ".",
"scripts": {
"prep": "npm run make cli.md && npm run fetchPlugins",
"fetchPlugins": "rimraf plugins.json && wget https://s3.amazonaws.com/jbrowse.org/plugin-store/plugins.json",
"prebuild": "npm run prep",
"prestart": "npm run prep",
"start": "docusaurus start",
"prebuild": "npm run prep",
"build": "docusaurus build",
"fetchPlugins": "rimraf plugins.json && wget https://s3.amazonaws.com/jbrowse.org/plugin-store/plugins.json",
"swizzle": "docusaurus swizzle",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"typecheck": "tsc",
"predeploy": "npm run build && npm run make",
"deploy": "aws s3 sync --delete build s3://jbrowse.org/jb2/ && aws s3 cp docs/jbrowse2.pdf s3://jbrowse.org/jb2/",
"postdeploy": "aws cloudfront create-invalidation --distribution-id E13LGELJOT4GQO --paths \"/jb2/*\"",
"make": "make -C docs"
},
"dependencies": {
"@cmfcmf/docusaurus-search-local": "^0.11.0",
"@docusaurus/core": "^2.1.0",
"@docusaurus/preset-classic": "^2.1.0",
"@emotion/react": "^11.10.4",
"@emotion/styled": "^11.10.4",
"@mui/icons-material": "^5.10.9",
"@mui/material": "^5.10.11",
"@docusaurus/core": "2.2.0",
"@docusaurus/preset-classic": "2.2.0",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@mdx-js/react": "^1.6.22",
"@mui/icons-material": "^5.11.0",
"@mui/material": "^5.11.4",
"acorn": "^8.8.1",
"acorn-jsx": "^5.3.1",
"clsx": "^1.1.1",
"copy-to-clipboard": "^3.3.2",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"acorn-jsx": "^5.3.2",
"clsx": "^1.2.1",
"copy-to-clipboard": "^3.3.3",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-player": "^2.11.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.2.0",
"@tsconfig/docusaurus": "^1.0.5",
"typescript": "^4.7.4"
},
"browserslist": {
"production": [
">0.2%",
">0.5%",
"not dead",
"not op_mini all"
],
Expand All @@ -43,5 +52,7 @@
"last 1 safari version"
]
},
"private": true
"engines": {
"node": ">=16.14"
}
}
58 changes: 0 additions & 58 deletions website/release_announcement_drafts/v2.3.0.md

This file was deleted.

1 change: 0 additions & 1 deletion website/release_announcement_drafts/v2.3.1.md

This file was deleted.

13 changes: 0 additions & 13 deletions website/release_announcement_drafts/v2.3.2.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react'
import ReactPlayer from 'react-player'
import clsx from 'clsx'

import styles from './styles.module.css'
import ReactPlayer from 'react-player'

const FeatureList = [
{
Expand Down
File renamed without changes.
9 changes: 6 additions & 3 deletions website/src/pages/cancer.js → website/src/pages/cancer.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React from 'react'
import { Alert, AlertTitle } from '@mui/material'
import clsx from 'clsx'
import Link from '@docusaurus/Link'
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
import Layout from '@theme/Layout'
import MiniFeatures from '@site/src/components/MiniFeatures'
import MiniPlugins from '../components/MiniPlugins'

// locals
import MiniPlugins from '../components/MiniPlugins'
import styles from './styles.module.css'
import { Alert, AlertTitle } from '@mui/material'

function Header() {
const { siteConfig } = useDocusaurusContext()
Expand All @@ -26,7 +27,9 @@ function Header() {
<div className={styles.buttons}>
<Link
className="button button--secondary button--lg"
href={`https://jbrowse.org/code/jb2/${siteConfig.customFields.currentVersion}/?config=test_data/config_demo.json&session=share-oTyYRpz9fN&password=fYAbt`}
href={`https://jbrowse.org/code/jb2/${
/* @ts-ignore */ siteConfig.customFields.currentVersion
}/?config=test_data/config_demo.json&session=share-oTyYRpz9fN&password=fYAbt`}
>
Browse a cancer annotations demo web instance
</Link>
Expand Down
2 changes: 2 additions & 0 deletions website/src/pages/index.js → website/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ import OpenInBrowserIcon from '@mui/icons-material/OpenInBrowser'
function Home() {
const context = useDocusaurusContext()
const { siteConfig = {} } = context
// @ts-ignore
const { currentVersion } = siteConfig.customFields

return (
// @ts-ignore
<Layout title={`${siteConfig.title}`}>
<Box sx={{ margin: { xs: '0.5em', sm: '0.5em', md: '3em' } }}>
<Box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ function PluginStore() {

return (
<ThemeProvider theme={theme}>
{/*
// @ts-ignore */}
<Layout title={`${siteConfig.title}`}>
<div className={pluginStyles.body}>
<div style={{ flexBasis: '50%' }}>
Expand Down
8 changes: 8 additions & 0 deletions website/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
// This file is not used in compilation. It is here just for a nice editor experience.
"extends": "@tsconfig/docusaurus/tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"resolveJsonModule": true
}
}
Loading

0 comments on commit 16da952

Please sign in to comment.