Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions .github/actions/setup-deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,14 @@ name: 'Setup Dependencies'
runs:
using: 'composite'
steps:
- name: Setup Node.js LTS
uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
shell: bash

- uses: actions/cache@v3
id: yarn-cache
- name: Setup Node.js LTS
uses: actions/setup-node@v4
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: 24

- name: Install Dependencies
run: yarn --frozen-lockfile
run: pnpm install --no-frozen-lockfile
shell: bash
49 changes: 49 additions & 0 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy docs to GitHub Pages

on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: ./.github/actions/setup-deps

- name: Configure GitHub Pages
uses: actions/configure-pages@v5

- name: Export documentation site
run: pnpm docs:export
env:
NEXT_PUBLIC_BASE_PATH: /${{ github.event.repository.name }}

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v4
with:
path: docs/out

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: 'Create Pull Request or Publish to npm'
uses: changesets/action@v1
with:
publish: yarn release
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: ./.github/actions/setup-deps

- name: Unit tests
run: yarn jest --ci --runInBand
run: pnpm jest --ci --runInBand

linting:
name: Linting
Expand All @@ -31,10 +31,10 @@ jobs:
- uses: ./.github/actions/setup-deps

- name: Prettier
run: yarn lint:prettier
run: pnpm lint:prettier

- name: ESLint
run: yarn lint:eslint
run: pnpm lint:eslint

- name: TypeScript
run: yarn lint:types
run: pnpm lint:types
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dist

# Next.js build output
.next
out

# Logs
logs
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/gallium
24
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Emery

<a href="https://emery-ts.vercel.app/">
<a href="https://thinkmill.github.io/emery/">
<img alt="Polish for the rough parts of TypeScript" src=".github/assets/banner.svg">
</a>
<p>
Expand All @@ -10,7 +10,7 @@
<a title="View the project license" href="LICENSE">
<img alt="License SDPX identifier" src="https://img.shields.io/npm/l/emery.svg?style=for-the-badge&labelColor=579805">
</a>
<a title="View emery website" href="https://emery-ts.vercel.app/">
<a title="View emery website" href="https://thinkmill.github.io/emery/">
<img alt="Website" src="https://img.shields.io/badge/Website-2F6BFF.svg?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmZmZmYiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0iZmVhdGhlciBmZWF0aGVyLWdsb2JlIj48Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCI+PC9jaXJjbGU+PGxpbmUgeDE9IjIiIHkxPSIxMiIgeDI9IjIyIiB5Mj0iMTIiPjwvbGluZT48cGF0aCBkPSJNMTIgMmExNS4zIDE1LjMgMCAwIDEgNCAxMCAxNS4zIDE1LjMgMCAwIDEtNCAxMCAxNS4zIDE1LjMgMCAwIDEtNC0xMCAxNS4zIDE1LjMgMCAwIDEgNC0xMHoiPjwvcGF0aD48L3N2Zz4=&labelColor=0737ad&locoColor=white&logoWidth=0">
</a>
<a title="Visit Thinkmill" href="https://www.thinkmill.com.au/open-source?utm_campaign=github-emery">
Expand Down
12 changes: 10 additions & 2 deletions docs/components/layouts/DocsLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { RenderableTreeNode, Tag } from '@markdoc/markdoc';
import { RenderableTreeNode, RenderableTreeNodes, Tag } from '@markdoc/markdoc';

import { Footer, SideNav, SectionNav, Section } from '../shell';
import { LayoutProps } from './types';
Expand Down Expand Up @@ -107,7 +107,15 @@ function isTag(node: RenderableTreeNode): node is Tag {
return Boolean(node) && typeof node !== 'string';
}

function collectSections(node: RenderableTreeNode, sections: Section[] = []) {
function collectSections(node: RenderableTreeNodes, sections: Section[] = []): Section[] {
if (Array.isArray(node)) {
for (const child of node) {
collectSections(child, sections);
}

return sections;
}

if (isTag(node)) {
if (node.name === 'Heading') {
const title = node.children[0];
Expand Down
13 changes: 3 additions & 10 deletions docs/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
import withMarkdoc from '@markdoc/next.js';

const markdocConfig = { schemaPath: 'docs/markdoc' };
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || '';

// @ts-check
/**
* @type {import('next').NextConfig}
**/
const nextConfig = {
basePath,
pageExtensions: ['ts', 'tsx', 'md'],

redirects() {
return [
{
source: '/docs',
destination: '/docs/getting-started',
permanent: false,
},
];
},
trailingSlash: true,
};

export default withMarkdoc(markdocConfig)(nextConfig);
19 changes: 12 additions & 7 deletions docs/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ type PageProps = MarkdocNextJsPageProps & {

const BRAND = 'Emery';
const SUMMARY = 'Polish for the rough parts of TypeScript.';
const BASE_PATH = process.env.NEXT_PUBLIC_BASE_PATH || '';
const SITE_URL = 'https://thinkmill.github.io/emery';

export default function MyApp(props: AppProps<PageProps>) {
const sidenavContext = useSidenavState();
Expand Down Expand Up @@ -72,10 +74,14 @@ export default function MyApp(props: AppProps<PageProps>) {
<meta name="application-name" content="Emery" />
<meta name="theme-color" content="#ffffff" />

<link rel="shortcut icon" href="/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="shortcut icon" href={`${BASE_PATH}/favicon.ico`} />
<link
rel="apple-touch-icon"
sizes="180x180"
href={`${BASE_PATH}/favicon-180x180.png`}
/>
<link rel="icon" type="image/png" sizes="32x32" href={`${BASE_PATH}/favicon-32x32.png`} />
<link rel="icon" type="image/png" sizes="16x16" href={`${BASE_PATH}/favicon-16x16.png`} />

<meta name="twitter:site" content="@thethinkmill" />
<meta name="twitter:creator" content="@jossmackison" />
Expand Down Expand Up @@ -117,7 +123,6 @@ export default function MyApp(props: AppProps<PageProps>) {
// ------------------------------

function canonicalUrl(path?: string) {
const url = 'https://emery-ts.vercel.app';
if (!path) return url;
return url + path;
if (!path) return SITE_URL;
return SITE_URL + path;
}
20 changes: 20 additions & 0 deletions docs/public/docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="refresh" content="0; url=/emery/docs/getting-started/" />
<link rel="canonical" href="https://thinkmill.github.io/emery/docs/getting-started/" />
<title>Redirecting to Emery documentation</title>
<script>
window.location.replace(
'/emery/docs/getting-started/' + window.location.search + window.location.hash
);
</script>
</head>
<body>
<p>
Redirecting to
<a href="/emery/docs/getting-started/">Emery documentation</a>…
</p>
</body>
</html>
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"./package.json": "./package.json"
},
"repository": "https://github.com/thinkmill/emery.git",
"homepage": "https://emery-ts.vercel.app",
"homepage": "https://thinkmill.github.io/emery",
"packageManager": "pnpm@11.0.0",
"author": "jossmac <jossmac@users.noreply.github.com>",
"license": "MIT",
"private": false,
Expand Down Expand Up @@ -60,9 +61,10 @@
"lint:eslint": "eslint ./src --ext .js,.ts",
"lint:prettier": "prettier --check ./src",
"lint:types": "tsc",
"lint": "yarn lint:prettier && yarn lint:eslint && yarn lint:types",
"lint": "pnpm lint:prettier && pnpm lint:eslint && pnpm lint:types",
"docs:dev": "next dev docs",
"docs:build": "next build docs",
"docs:export": "pnpm docs:build && next export docs -o docs/out",
"prepublishOnly": "preconstruct build",
"release": "changeset publish",
"changeset": "changeset"
Expand Down
Loading
Loading