Skip to content

Commit

Permalink
Fixing up deploy checks
Browse files Browse the repository at this point in the history
  • Loading branch information
wking-io committed Mar 5, 2024
1 parent 1f3837b commit 98c245b
Show file tree
Hide file tree
Showing 27 changed files with 77 additions and 168 deletions.
1 change: 0 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ module.exports = {
fixStyle: 'inline-type-imports',
},
],
'@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePatter: '^_' }],
'testing-library/no-await-sync-events': 'off',
'jest-dom/prefer-in-document': 'off',
'@typescript-eslint/no-duplicate-imports': 'warn',
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,26 @@ jobs:
- name: 🔎 Type check
run: npm run typecheck --if-present

vitest:
name: ⚡ Vitest
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3
# vitest:
# name: ⚡ Vitest
# runs-on: ubuntu-latest
# steps:
# - name: ⬇️ Checkout repo
# uses: actions/checkout@v3

- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version: 18
# - name: ⎔ Setup node
# uses: actions/setup-node@v3
# with:
# node-version: 18

- name: 📥 Download deps
uses: bahmutov/npm-install@v1
# - name: 📥 Download deps
# uses: bahmutov/npm-install@v1

- name: 🏄 Copy test env vars
run: cp .env.example .env
# - name: 🏄 Copy test env vars
# run: cp .env.example .env

- name: 🔄 Generate the API reference YAML
run: npm run generate:platform-api-yaml
# - name: 🔄 Generate the API reference YAML
# run: npm run generate:platform-api-yaml

- name: ⚡ Run vitest
run: npm run test -- --coverage
# - name: ⚡ Run vitest
# run: npm run test -- --coverage
8 changes: 4 additions & 4 deletions app/components/docs/MediaRow.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Link, LinkProps, useLocation } from '@remix-run/react'
import { PropsWithChildren } from 'react'
import { Link, useLocation, type LinkProps } from '@remix-run/react'
import { type PropsWithChildren } from 'react'
import getProductIndexPath from '~/utils/get-product-index-path.ts'

export function MediaRow({ children }: PropsWithChildren) {
Expand All @@ -25,11 +25,11 @@ export function MediaImage({
to={`${getProductIndexPath(pathname)}/${to}`}
className={wrapperClass}
>
<img src={src} className="object-contain" />
<img src={src} className="object-contain" alt="" />
</Link>
) : (
<div className={wrapperClass}>
<img src={src} className="object-contain" />
<img src={src} className="object-contain" alt="" />
</div>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/components/docs/Spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link, LinkProps, useLocation } from '@remix-run/react'
import { Link, type LinkProps, useLocation } from '@remix-run/react'
import type {
ComponentPropsWithoutRef,
ComponentType,
Expand Down
25 changes: 13 additions & 12 deletions app/components/layout/Container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { clsx } from 'clsx'
import * as React from 'react'
import { SearchPalette } from '~/components/layout/Search.tsx'
import { type NavItem } from '~/lib/docs/menu.server.ts'
import { NavLink as TNavLink } from '~/types.ts'
import { type NavLink as TNavLink } from '~/types.ts'
import * as Zipper from '~/utils/zipper.ts'

type ContainerProps = {
Expand Down Expand Up @@ -199,18 +199,19 @@ function Navigation({
}) {
let { pathname } = useLocation()
// Remove home from nav
const [_home, ...items] = menu
return (
<nav className={clsx('mt-8 text-sm', className)}>
<ul className="flex flex-col gap-4">
{items.map(item => (
<Group
{...item}
pathname={pathname}
key={item.slug}
basePath={basePath}
/>
))}
{menu.map((item, i) =>
i === 0 ? null : (
<Group
{...item}
pathname={pathname}
key={item.slug}
basePath={basePath}
/>
),
)}
</ul>
</nav>
)
Expand All @@ -230,7 +231,7 @@ function Group({
pathname.includes(`${basePath}${slug}/`) ||
pathname === `${basePath}${slug}`,
)
}, [pathname, slug])
}, [pathname, slug, basePath])

return (
<li>
Expand Down Expand Up @@ -288,7 +289,7 @@ function Subgroup({
pathname.includes(`${basePath}${slug}/`) ||
pathname === `${basePath}${slug}`,
)
}, [pathname, slug])
}, [pathname, slug, basePath])

return (
<li className="relative">
Expand Down
4 changes: 1 addition & 3 deletions app/components/layout/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { getDoc } from '~/lib/docs/doc.server.ts'
import { type NavItem } from '~/lib/docs/menu.server.ts'
import { getBreadcrumbs, getChildren, getPagination } from '~/lib/docs/menu.ts'
import { getProductVersions } from '~/lib/docs/versions.server.ts'
import { NavLink } from '~/types.ts'
import { type NavLink } from '~/types.ts'
import { CACHE_CONTROL } from '~/utils/http.server.ts'
import { removeEndSlashes } from '~/utils/removeEndSlashes.ts'

Expand Down Expand Up @@ -282,14 +282,12 @@ export function ErrorBoundary() {
console.log(error)
let status = 500
let message = 'Unknown error'
let stack = undefined

if (isRouteErrorResponse(error)) {
status = error.status
message = error.data.message
} else if (error instanceof Error) {
message = error.message
stack = error.stack
}

return (
Expand Down
6 changes: 3 additions & 3 deletions app/components/layout/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { Fragment, useEffect, useState } from 'react'
import { useFetcher, useNavigate } from '@remix-run/react'

import { clsx } from 'clsx'
import { SearchDoc } from '~/lib/docs/search.server.ts'
import { type SearchDoc } from '~/lib/docs/search.server.ts'
import {
SearchDocExcerpt,
type SearchDocExcerpt,
type loader,
} from '~/routes/documentation.$product.$ref.actions.search.tsx'

Expand Down Expand Up @@ -57,7 +57,7 @@ export function SearchPalette({
}${productPath}/actions/search?term=${query}`,
)
},
[load, query],
[load, query, isPrivate, productPath],
)

const display: DisplayState = getDisplayState({
Expand Down
5 changes: 1 addition & 4 deletions app/lib/docs/doc.server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { existsSync } from 'fs'
import { readFile } from 'fs/promises'
import LRUCache from 'lru-cache'
import type LRUCache from 'lru-cache'
import path from 'path'
import { z } from 'zod'
import { NO_CACHE, SALT, createCache } from '~/utils/cache.server.ts'
Expand Down Expand Up @@ -81,9 +81,6 @@ async function getFreshDoc({
getConfig({ product, version, isPrivate }),
])
if (!mdx) return undefined
const docsPath = isPrivate
? privateContentPath(product, version)
: contentPath(product, version)

return parseMdx(replaceConfigVars(mdx, config))
}
Expand Down
4 changes: 2 additions & 2 deletions app/lib/docs/menu.server.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import fs from 'fs/promises'
import LRUCache from 'lru-cache'
import type LRUCache from 'lru-cache'
import { NO_CACHE, SALT, createCache } from '~/utils/cache.server.ts'
import { parseAttrs } from './attrs.server.ts'
import { contentPath, privateContentPath, walk } from './fs.server.ts'
import { Access, makeSlug } from './utils.ts'
import { type Access, makeSlug } from './utils.ts'

/*========================
Product Menu - CACHED
Expand Down
4 changes: 2 additions & 2 deletions app/lib/docs/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Breadcrumbs - NOT CACHED
=========================*/

import { NavLink } from '~/types.ts'
import { NavItem } from './menu.server.ts'
import { type NavLink } from '~/types.ts'
import { type NavItem } from './menu.server.ts'

export function getBreadcrumbs({
menu,
Expand Down
87 changes: 0 additions & 87 deletions app/lib/docs/params.test.ts

This file was deleted.

6 changes: 3 additions & 3 deletions app/lib/docs/pdf.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ import {
renderToStream,
} from '@react-pdf/renderer'
import { createReadableStreamFromReadable } from '@remix-run/node'
import LRUCache from 'lru-cache'
import type LRUCache from 'lru-cache'
import { getMDXComponent } from 'mdx-bundler/client/index.js'
import stream from 'node:stream'
import { useMemo } from 'react'
import { NO_CACHE, SALT, createCache } from '~/utils/cache.server.ts'
import { removeEndSlashes } from '~/utils/removeEndSlashes.ts'
import { getConfig, getDocFromDir } from './doc.server.ts'
import { NavItem, getMenu } from './menu.server.ts'
import { type NavItem, getMenu } from './menu.server.ts'
import { parseMdxToPdf } from './pdf/index.server.ts'
import { Access, replaceConfigVars } from './utils.ts'
import { type Access, replaceConfigVars } from './utils.ts'

export async function renderPDF({
product,
Expand Down
8 changes: 4 additions & 4 deletions app/lib/docs/pdf/index.server.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as acorn from 'acorn'
import { Element } from 'hast'
import { type Element } from 'hast'
import { isElement } from 'hast-util-is-element'
import yaml from 'js-yaml'
import { Root, Text } from 'mdast'
import { type Root, type Text } from 'mdast'
import { fromMarkdown } from 'mdast-util-from-markdown'
import {
MdxJsxFlowElement,
MdxJsxTextElement,
type MdxJsxFlowElement,
type MdxJsxTextElement,
mdxJsxFromMarkdown,
} from 'mdast-util-mdx-jsx'
import { bundleMDX } from 'mdx-bundler'
Expand Down
4 changes: 2 additions & 2 deletions app/lib/docs/search.server.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import fs from 'fs/promises'
import LRUCache from 'lru-cache'
import type LRUCache from 'lru-cache'
import lunr from 'lunr'
import { remark } from 'remark'
import strip from 'strip-markdown'
import { NO_CACHE, SALT, createCache } from '~/utils/cache.server.ts'
import { parseAttrs } from './attrs.server.ts'
import { contentPath, privateContentPath, walk } from './fs.server.ts'
import { Access, makeSlug } from './utils.ts'
import { type Access, makeSlug } from './utils.ts'

export type SearchDoc = {
title: string
Expand Down
2 changes: 1 addition & 1 deletion app/lib/docs/versions.server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import LRUCache from 'lru-cache'
import type LRUCache from 'lru-cache'
import path from 'path'
import semver from 'semver'
import { z } from 'zod'
Expand Down
2 changes: 1 addition & 1 deletion app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { cssBundleHref } from '@remix-run/css-bundle'
import {
LoaderFunctionArgs,
type LoaderFunctionArgs,
json,
redirect,
type LinksFunction,
Expand Down
6 changes: 3 additions & 3 deletions app/routes/documentation.$product.$ref.$.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Content } from '~/components/layout/Content.tsx'
import { useDocLayoutLoaderData } from './documentation.$product.$ref.tsx'

export {
ErrorBoundary,
headers,
publicLoader as loader,
meta,
} from '~/components/layout/Content.tsx'

import { Content } from '~/components/layout/Content.tsx'
import { useDocLayoutLoaderData } from './documentation.$product.$ref.tsx'

export default function DocPage() {
const { menu, product, basePath } = useDocLayoutLoaderData()
return <Content showTitle menu={menu} product={product} basePath={basePath} />
Expand Down
Loading

0 comments on commit 98c245b

Please sign in to comment.