Skip to content

Commit

Permalink
fix beta docs build (#24326)
Browse files Browse the repository at this point in the history
## Summary & Motivation
fix master beta docs build:
- fixed broken link (seems an oversight intro'ed from
#24267)
- ran `yarn lint`, `yarn build`

## How I Tested These Changes
`yarn build` passes


- before:
https://vercel.com/elementl/dagster-docs-beta/8XXsNCL1WTPyenbCKJtCH1YaxBsy?filter=errors
   ```
    Exhaustive list of all broken links found:
     - Broken link on source page path = /:
        -> linking to /tutorial/quick-start
   ```
- after:
https://vercel.com/elementl/dagster-docs-beta/ARCKGoxukSyZt1wvM1aGqJ9fsHXk
is green and https://dagster-docs-beta-4qfhiknub-elementl.vercel.app/
builds

## Changelog

`NOCHANGELOG`
  • Loading branch information
yuhan authored Sep 9, 2024
1 parent 0176b4a commit d48d2cb
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 45 deletions.
2 changes: 1 addition & 1 deletion docs/docs-beta/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ To build the site for production:
yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.
This command generates static content into the `build` directory and can be served using any static contents hosting service. This also checks for any broken links in the documentation.
5 changes: 2 additions & 3 deletions docs/docs-beta/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ import { Card, CardGroup } from '@site/src/components/Cards';

Dagster is a data orchestrator built for data engineers, with integrated lineage, observability, a declarative programming model and best-in-class testability.


<CodeExample filePath="getting-started/hello-world.py" language="python" />

## Get started

<CardGroup cols={3}>
<Card title="Quickstart" href="/tutorial/quick-start">
<Card title="Quickstart" href="/getting-started/quickstart">
Build your first Dagster pipeline in our Quickstart tutorial.
</Card>
<Card title="Thinking in Assets" href="/concepts/assets/thinking-in-assets">
Expand All @@ -40,4 +39,4 @@ Dagster is a data orchestrator built for data engineers, with integrated lineage
<Card title="Youtube" href="https://www.youtube.com/@dagsterio">
Watch our latest videos on YouTube.
</Card>
</CardGroup>
</CardGroup>
10 changes: 4 additions & 6 deletions docs/docs-beta/src/components/Cards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface CardProps {
children: React.ReactNode;
}

const Card: React.FC<CardProps> = ({ title, icon, href, children }) => (
const Card: React.FC<CardProps> = ({title, icon, href, children}) => (
<Link to={href} className="card">
<h3>{title}</h3>

Check warning on line 13 in docs/docs-beta/src/components/Cards.tsx

View workflow job for this annotation

GitHub Actions / deploy

Do not use any of the `<hn>` tags for headings. Use the `<Heading />` component from `@theme/Heading` instead
<i className={`icon-${icon}`}></i>
Expand All @@ -21,10 +21,8 @@ interface CardGroupProps {
children: React.ReactNode;
}

const CardGroup: React.FC<CardGroupProps> = ({ cols, children }) => (
<div className={`card-group cols-${cols}`}>
{children}
</div>
const CardGroup: React.FC<CardGroupProps> = ({cols, children}) => (
<div className={`card-group cols-${cols}`}>{children}</div>
);

export { Card, CardGroup };
export {Card, CardGroup};
70 changes: 35 additions & 35 deletions docs/docs-beta/src/components/CodeExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,47 @@ import React from 'react';
import CodeBlock from '@theme/CodeBlock';

interface CodeExampleProps {
filePath: string;
language?: string;
title?: string;
filePath: string;
language?: string;
title?: string;
}

const CodeExample: React.FC<CodeExampleProps> = ({ filePath, language, title }) => {
const [content, setContent] = React.useState<string>('');
const [error, setError] = React.useState<string | null>(null);
const CodeExample: React.FC<CodeExampleProps> = ({filePath, language, title}) => {
const [content, setContent] = React.useState<string>('');
const [error, setError] = React.useState<string | null>(null);

language = language || 'python';
language = language || 'python';

React.useEffect(() => {
// Adjust the import path to start from the docs directory
import(`!!raw-loader!/../../examples/docs_beta_snippets/docs_beta_snippets/${filePath}`)
.then((module) => {
const lines = module.default.split('\n').map((line) => {
return line.replaceAll(/#.*?noqa.*?$/g, '');
});
const mainIndex = lines.findIndex((line) => line.trim().startsWith('if __name__ == '));
const strippedContent =
mainIndex !== -1 ? lines.slice(0, mainIndex).join('\n') : lines.join('\n');
setContent(strippedContent);
setError(null);
})
.catch((error) => {
console.error(`Error loading file: ${filePath}`, error);
setError(
`Failed to load file: ${filePath}. Please check if the file exists and the path is correct.`,
);
});
}, [filePath]);
React.useEffect(() => {
// Adjust the import path to start from the docs directory
import(`!!raw-loader!/../../examples/docs_beta_snippets/docs_beta_snippets/${filePath}`)
.then((module) => {
const lines = module.default.split('\n').map((line) => {
return line.replaceAll(/#.*?noqa.*?$/g, '');
});
const mainIndex = lines.findIndex((line) => line.trim().startsWith('if __name__ == '));
const strippedContent =
mainIndex !== -1 ? lines.slice(0, mainIndex).join('\n') : lines.join('\n');
setContent(strippedContent);
setError(null);
})
.catch((error) => {
console.error(`Error loading file: ${filePath}`, error);
setError(
`Failed to load file: ${filePath}. Please check if the file exists and the path is correct.`,
);
});
}, [filePath]);

if (error) {
return <div style={{ color: 'red', padding: '1rem', border: '1px solid red' }}>{error}</div>;
}
if (error) {
return <div style={{color: 'red', padding: '1rem', border: '1px solid red'}}>{error}</div>;
}

return (
<CodeBlock language={language} title={title}>
{content || 'Loading...'}
</CodeBlock>
);
return (
<CodeBlock language={language} title={title}>
{content || 'Loading...'}
</CodeBlock>
);
};

export default CodeExample;

1 comment on commit d48d2cb

@github-actions
Copy link

@github-actions github-actions bot commented on d48d2cb Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for dagster-docs-beta ready!

✅ Preview
https://dagster-docs-beta-ltmw91oe0-elementl.vercel.app
https://dagster-docs-beta.dagster-docs.io

Built with commit d48d2cb.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.