Skip to content

Commit 0b5dc59

Browse files
authored
Merge pull request #786 from dlt-hub/d#/devel_docs
D#/devel docs
2 parents ad33225 + 52004fb commit 0b5dc59

File tree

7 files changed

+112
-10
lines changed

7 files changed

+112
-10
lines changed

docs/website/docs/running-in-production/alerting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ receiving rich information on executed pipelines, including encountered errors a
4040

4141
## Slack
4242

43-
Read [here](/docs/running-in-production/running#using-slack-to-send-messages) about how to send
43+
Read [here](./running#using-slack-to-send-messages) about how to send
4444
messages to Slack.

docs/website/docusaurus.config.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// @ts-check
22
// Note: type annotations allow type checking and IDEs autocompletion
3+
require('dotenv').config()
34

45
const lightCodeTheme = require('prism-react-renderer/themes/dracula');
56
// const lightCodeTheme = require('prism-react-renderer/themes/github');
@@ -10,7 +11,7 @@ const config = {
1011
title: 'dlt Docs',
1112
tagline: 'data load tool',
1213
url: 'https://dlthub.com',
13-
baseUrl: '/docs',
14+
baseUrl: process.env.DOCUSAURUS_BASE_URL || '/docs',
1415
onBrokenLinks: 'throw',
1516
onBrokenMarkdownLinks: 'throw',
1617
favicon: 'img/favicon.ico',
@@ -29,6 +30,8 @@ const config = {
2930
locales: ['en'],
3031
},
3132

33+
34+
3235
presets: [
3336
[
3437
'@docusaurus/preset-classic',
@@ -77,6 +80,7 @@ const config = {
7780
href: 'https://dlthub.com'
7881
},
7982
items: [
83+
{ label: 'dlt ' + (process.env.IS_MASTER_BRANCH ? "stable ": "devel ") + (process.env.DOCUSAURUS_DLT_VERSION || "0.0.1"), position: 'left', href: 'https://github.com/dlt-hub/dlt', className: 'version-navbar' },
8084
{
8185
type: 'doc',
8286
docId: 'intro',
@@ -184,4 +188,15 @@ const config = {
184188
],
185189
};
186190

191+
if (!process.env.IS_MASTER_BRANCH && config.themeConfig) {
192+
config.themeConfig.announcementBar = {
193+
id: 'devel docs',
194+
content:
195+
'This is the development version of the dlt docs. <a target="_blank" rel="noopener noreferrer" href="https://dlthub.com/docs/intro">Go to the stable docs.</a>',
196+
backgroundColor: '#4c4898',
197+
textColor: '#fff',
198+
isCloseable: false,
199+
}
200+
}
201+
187202
module.exports = config;

docs/website/package-lock.json

Lines changed: 19 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/website/package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"private": true,
55
"scripts": {
66
"docusaurus": "docusaurus",
7-
"start": "PYTHONPATH=. poetry run pydoc-markdown && node tools/update_snippets.js && docusaurus start",
7+
"start": "PYTHONPATH=. poetry run pydoc-markdown && node tools/update_snippets.js && node tools/update_version_env.js && docusaurus start",
88
"watch-snippets": "node tools/update_snippets.js --watch",
9-
"build": "PYTHONPATH=. poetry run pydoc-markdown && node tools/update_snippets.js && docusaurus build",
10-
"build:netlify": "PYTHONPATH=. pydoc-markdown && node tools/update_snippets.js && docusaurus build --out-dir build/docs",
9+
"build": "PYTHONPATH=. poetry run pydoc-markdown && node tools/update_snippets.js && node tools/update_version_env.js && docusaurus build",
10+
"build:netlify": "PYTHONPATH=. pydoc-markdown && node tools/update_snippets.js && node tools/update_version_env.js && docusaurus build --out-dir build/docs",
1111
"swizzle": "docusaurus swizzle",
1212
"clear": "docusaurus clear",
1313
"serve": "docusaurus serve",
@@ -27,7 +27,9 @@
2727
"react": "^17.0.2",
2828
"react-dom": "^17.0.2",
2929
"react-twitter-embed": "^4.0.4",
30-
"string-dedent": "^3.0.1"
30+
"string-dedent": "^3.0.1",
31+
"dotenv": "^16.3.1",
32+
"toml": "^3.0.0"
3133
},
3234
"devDependencies": {
3335
"@docusaurus/module-type-aliases": "2.4.1"

docs/website/sidebars.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,4 +267,21 @@ const sidebars = {
267267
]
268268
};
269269

270+
// on the master branch link to devel and vice versa
271+
if (process.env.IS_MASTER_BRANCH) {
272+
sidebars.tutorialSidebar.push( {
273+
type: 'link',
274+
label: 'Switch to Devel Docs',
275+
href: 'https://dlthub.com/devel/intro',
276+
className: 'learn-more-link',
277+
})
278+
} else {
279+
sidebars.tutorialSidebar.push( {
280+
type: 'link',
281+
label: 'Switch to Stable Docs',
282+
href: 'https://dlthub.com/docs/intro',
283+
className: 'learn-more-link',
284+
})
285+
}
286+
270287
module.exports = sidebars;

docs/website/src/css/custom.css

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
--ifm-active-toc-link-color:#4C4898;
3939
--docsearch-highlight-color:#191937 !important;
4040
--docsearch-hit-color: #191937 !important;
41-
41+
--ifm-footer-background-color: #E4E8F0;
4242
}
4343

4444
/* For readability concerns, you should choose a lighter palette in dark mode. */
@@ -69,7 +69,7 @@
6969
--docsearch-hit-background: #191937 !important;
7070
--docsearch-hit-color: #ffffff !important;
7171
--ifm-color-primary-light:#f3ff36;
72-
72+
--ifm-footer-background-color: #191937;
7373
}
7474

7575
body {
@@ -358,6 +358,21 @@ html[data-theme='dark'] .footer__item a:hover{
358358
display: none;
359359
}
360360

361+
.version-navbar>svg {
362+
display: none;
363+
}
364+
365+
.switch-navbar>svg {
366+
display: none;
367+
}
368+
369+
.version-navbar {
370+
pointer-events: none;
371+
background: var(--ifm-color-primary-light);
372+
border-radius: 16px;
373+
color: var(--docsearch-text-color);
374+
margin-right: 16px;
375+
}
361376

362377
.github-navbar:hover,
363378
.slack-navbar:hover ,.navbar__items.navbar__items--right .clean-btn:hover {
@@ -665,6 +680,24 @@ html[data-theme='dark'] .theme-doc-sidebar-menu.menu__list>li:nth-child(8)>div>[
665680
background-image: url(../../static/img/Reference-Active-1.svg);
666681
}
667682

683+
/* Devel / Stable switch */
684+
685+
.theme-doc-sidebar-menu.menu__list>li:nth-child(9)>a svg {
686+
display: none;
687+
}
688+
689+
.theme-doc-sidebar-menu.menu__list>li:nth-child(9)>a {
690+
flex: none;
691+
}
692+
693+
.theme-doc-sidebar-menu.menu__list>li:nth-child(9) {
694+
margin-top:30px;
695+
padding-top: 10px;
696+
justify-content: center;
697+
border-top: 1px solid;
698+
border-color: var(--ifm-footer-background-color);
699+
}
700+
668701

669702
/* responsive css :start */
670703

@@ -741,7 +774,7 @@ html[data-theme='dark'] .overlayButton:hover {
741774
left:0px;
742775
top: 50%;
743776
transform: translateY(-50%);
744-
background-color: var(--ifm-background-color); ;
777+
background-color: var(--ifm-background-color);
745778
z-index: 1002;
746779
left: calc(50% - 350px);
747780
padding: 30px;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// creates an .env file with the current version of the dlt for consumption in docusaurus.config.js
2+
3+
const { readFile, writeFile } = require('fs/promises')
4+
const tom = require('toml');
5+
6+
const TOML_FILE = '../../pyproject.toml';
7+
const ENV_FILE = '.env'
8+
9+
async function update_env() {
10+
const fileContent = await readFile(TOML_FILE, 'utf8');
11+
const toml = tom.parse(fileContent);
12+
const version = toml['tool']['poetry']['version'];
13+
const envFileContent = `DOCUSAURUS_DLT_VERSION=${version}`;
14+
await writeFile(ENV_FILE, envFileContent, 'utf8');
15+
}
16+
17+
update_env();

0 commit comments

Comments
 (0)