Skip to content

Commit

Permalink
fix: use TS 4.4.4 to prevent tsc from hanging on build (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
alesmit committed Feb 23, 2022
1 parent cf28a16 commit ad9efd3
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 202 deletions.
7 changes: 0 additions & 7 deletions components/Header/Header.test.tsx
Expand Up @@ -9,11 +9,4 @@ describe('Header', () => {
expect(screen.getByRole('navigation')).toBeInTheDocument();
expect(asFragment()).toMatchSnapshot();
});

it('should render transparent', () => {
const { asFragment } = render(<Header transparent />);

expect(screen.getByRole('navigation')).toBeInTheDocument();
expect(asFragment()).toMatchSnapshot();
});
});
170 changes: 0 additions & 170 deletions components/Header/__snapshots__/Header.test.tsx.snap
Expand Up @@ -169,173 +169,3 @@ exports[`Header should render 1`] = `
</header>
</DocumentFragment>
`;

exports[`Header should render transparent 1`] = `
<DocumentFragment>
<header
class="z-10 h-16 w-full top-0 fixed"
>
<div
class="container mx-auto px-4 h-full flex items-center justify-between"
>
<div
class="flex items-center"
>
<a
class="flex"
href="/"
>
<span
style="box-sizing: border-box; display: inline-block; overflow: hidden; background: none; opacity: 1; border: 0px; margin: 0px; padding: 0px; position: relative; max-width: 100%;"
>
<span
style="box-sizing: border-box; display: block; background: none; opacity: 1; border: 0px; margin: 0px; padding: 0px; max-width: 100%;"
>
<img
alt=""
aria-hidden="true"
src="data:image/svg+xml,%3csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20version=%271.1%27%20width=%2740%27%20height=%2740%27/%3e"
style="display: block; max-width: 100%; background: none; opacity: 1; border: 0px; margin: 0px; padding: 0px;"
/>
</span>
<img
alt="Logo"
data-nimg="intrinsic"
decoding="async"
src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
style="position: absolute; top: 0px; left: 0px; bottom: 0px; right: 0px; box-sizing: border-box; padding: 0px; margin: auto; display: block; width: 0px; height: 0px; min-width: 100%; max-width: 100%; min-height: 100%; max-height: 100%;"
/>
<noscript />
</span>
</a>
<h4 />
</div>
<div
class="flex items-center space-x-8"
>
<nav>
<div
class="tablet:hidden block"
data-testid="MainNavMobile"
>
<button
class="w-10 h-10 relative focus:outline-none"
type="button"
>
<span
class="sr-only"
>
Open main menu
</span>
<div
class="block w-5 absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2"
>
<span
aria-hidden="true"
class="block absolute h-0.5 w-5 bg-white transform transition ease-in-out -translate-y-1.5"
/>
<span
aria-hidden="true"
class="block absolute h-0.5 w-5 bg-white transform transition ease-in-out"
/>
<span
aria-hidden="true"
class="block absolute h-0.5 w-5 bg-white transform transition ease-in-out translate-y-1.5"
/>
</div>
</button>
<div
class="absolute inset-x-0 -z-10 shadow-lg transition -translate-y-full"
>
<ul
class="flex-col space-y-4 items-center pt-4 pb-8 hidden"
>
<li>
<a
class="text-lg"
href="/docs"
>
Docs
</a>
</li>
<li>
<a
class="text-lg"
href="/enterprise"
>
Enterprise
</a>
</li>
<li>
<a
class="text-lg"
href="/sponsors"
>
Sponsors
</a>
</li>
</ul>
</div>
</div>
<ul
class="hidden tablet:flex space-x-8"
data-testid="MainNavDesktop"
>
<li>
<a
class="text-lg"
href="/docs"
>
Docs
</a>
</li>
<li>
<a
class="text-lg"
href="/enterprise"
>
Enterprise
</a>
</li>
<li>
<a
class="text-lg"
href="/sponsors"
>
Sponsors
</a>
</li>
</ul>
</nav>
<a
class="flex"
href="https://github.com/pequehq"
>
<span
style="box-sizing: border-box; display: inline-block; overflow: hidden; background: none; opacity: 1; border: 0px; margin: 0px; padding: 0px; position: relative; max-width: 100%;"
>
<span
style="box-sizing: border-box; display: block; background: none; opacity: 1; border: 0px; margin: 0px; padding: 0px; max-width: 100%;"
>
<img
alt=""
aria-hidden="true"
src="data:image/svg+xml,%3csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20version=%271.1%27%20width=%2724%27%20height=%2724%27/%3e"
style="display: block; max-width: 100%; background: none; opacity: 1; border: 0px; margin: 0px; padding: 0px;"
/>
</span>
<img
alt="Peque on GitHub"
data-nimg="intrinsic"
decoding="async"
src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
style="position: absolute; top: 0px; left: 0px; bottom: 0px; right: 0px; box-sizing: border-box; padding: 0px; margin: auto; display: block; width: 0px; height: 0px; min-width: 100%; max-width: 100%; min-height: 100%; max-height: 100%;"
/>
<noscript />
</span>
</a>
</div>
</div>
</header>
</DocumentFragment>
`;
1 change: 0 additions & 1 deletion components/Project/Project.test.tsx
Expand Up @@ -14,7 +14,6 @@ describe('Project', () => {
docsLink="/docs/framework"
command="npx peque new project-name"
renderExample={() => <Code>{SNIPPET_FRAMEWORK}</Code>}
examplePosition={examplePosition as 'left' | 'right'}
bgClassName="bg-primary-800 skew-y-2"
/>,
);
Expand Down
17 changes: 10 additions & 7 deletions lib/markdown.helpers.ts
Expand Up @@ -2,6 +2,7 @@ import { parseSelector } from 'hast-util-parse-selector';
import { selectAll } from 'hast-util-select';
import { h } from 'hastscript';
import puppeteer from 'puppeteer';
import type { Transformer } from 'unified';
import { visit } from 'unist-util-visit';

const getAnchorSvg = () => {
Expand Down Expand Up @@ -57,12 +58,12 @@ function remarkMermaid() {
};
}

function rehypeAddClasses(options: Record<string, string>) {
function rehypeAddClasses(options: Record<string, string>): Transformer {
return (tree: any) => {
for (const [selectors, className] of Object.entries(options)) {
for (const selector of selectors.split(',')) {
for (const match of selectAll(selector, tree)) {
visit(tree, match, (node: any) => {
visit(tree, match as any, (node: any) => {
node.properties.class = `${node.properties.class ?? ''} ${className}`.trim();
});
}
Expand All @@ -71,13 +72,15 @@ function rehypeAddClasses(options: Record<string, string>) {
};
}

function rehypeTableResponsive() {
function rehypeTableResponsive(): Transformer {
return (tree: any) => {
for (const match of selectAll('table', tree)) {
visit(tree, match, (node: any, index: number, parent: any) => {
const wrapper = parseSelector('div.table-responsive');
wrapper.children = [node];
parent.children[index] = wrapper;
visit(tree, match as any, (node, index, parent) => {
if (index !== null) {
const wrapper = parseSelector('div.table-responsive');
wrapper.children = [node];
parent.children[index] = wrapper;
}
});
}
};
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -28,6 +28,7 @@
"remark": "^14.0.2",
"remark-gfm": "^3.0.1",
"remark-html": "^15.0.1",
"unified": "^10.1.1",
"unist-util-visit": "^4.1.0"
},
"devDependencies": {
Expand All @@ -48,6 +49,6 @@
"postcss": "^8.4.6",
"prettier": "^2.5.1",
"tailwindcss": "^3.0.19",
"typescript": "4.5.5"
"typescript": "4.4.4"
}
}
34 changes: 18 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit ad9efd3

@vercel
Copy link

@vercel vercel bot commented on ad9efd3 Feb 23, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.