Skip to content

Commit

Permalink
Brand update (#284)
Browse files Browse the repository at this point in the history
* duplicate components from other rebranded docs site

* add index skeleton, images, and nearform logo

* upgrading docusaurus and react

* convert docusaurus config and sidebards to ts after upgrade and move docs directory so that autogenerated routing works properly

* add docusaurus-search-local

* updating styles to match other docusaurus cover pages

* landing content

* update intro banner and revert primary colors to groq specific ones

* readme tweaks

* fix broken links and add docusaurus/theme-classic to deal with type error

* fix type check errors

* Remove edit links

* update open source title and swap in figlog

---------

Co-authored-by: Christy Presler <cpresler@users.noreply.github.com>
Co-authored-by: Charlie Brown <carbonrobot@gmail.com>
  • Loading branch information
3 people committed May 1, 2024
1 parent 584b7ce commit b042725
Show file tree
Hide file tree
Showing 42 changed files with 4,783 additions and 3,473 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ On a merge of a feature PR, the changesets GitHub action will open a new PR titl

## Documentation

We're using [Docusaurus](https://docusaurus.io/) to for the scaffolding of our documentation. The docs source files live in `docs` (so they can be viewed on GitHub), but the docusaurus site is built from `website`. To run the docs locally, run the following.
We're using [Docusaurus](https://docusaurus.io/) to for the scaffolding of our documentation. The docs source files live in `website/docs` (so they can be viewed on GitHub), but the docusaurus site is built from `website`. To run the docs locally, run the following.

```shell
pnpm run dev:docs
Expand Down
7,303 changes: 4,141 additions & 3,162 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion website/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
This website is built using [Docusaurus 3](https://docusaurus.io/), a modern static website generator.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/introduction.md → website/docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ slug: /

# Introduction

[![GROQD — Formidable, We build the modern web](https://raw.githubusercontent.com/FormidableLabs/groqd/main/groqd-Hero.png)](https://formidable.com/open-source/)
[![GROQD](https://oss.nearform.com/api/banner?badge=groqd&bg=c99f46)](https://commerce.nearform.com/open-source/groqd)


`groqd` is a schema-unaware, runtime-safe query builder for [GROQ](https://www.sanity.io/docs/groq). **The goal of `groqd` is to give you (most of) the flexibility of GROQ, with the runtime/type safety of [Zod](https://github.com/colinhacks/zod) and TypeScript.**
Expand Down
6 changes: 3 additions & 3 deletions docs/query-building.md → website/docs/query-building.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ q("*").grab({
});
```

See [Schema Types](/schema-types) for available schema options, such as `q.string()`. These generally correspond to Zod primitives, so you can do something like:
See [Schema Types](/docs/schema-types) for available schema options, such as `q.string()`. These generally correspond to Zod primitives, so you can do something like:

```ts
q("*").grab({
Expand Down Expand Up @@ -120,11 +120,11 @@ type SanityPokemon = InferType<typeof pokemonQuery>
// )[]
```
If you find that you are using the conditional argument with an empty base selection, we recommend using the [.select](/query-building#select) method instead.
If you find that you are using the conditional argument with an empty base selection, we recommend using the [.select](/docs/query-building#select) method instead.
## `.grab$`
Just like `.grab`, but uses the `nullToUndefined` helper [outlined here](/utility-methods#nulltoundefined) to convert `null` values to `undefined` which makes writing queries with "optional" values a bit easier.
Just like `.grab`, but uses the `nullToUndefined` helper [outlined here](/docs/utility-methods#nulltoundefined) to convert `null` values to `undefined` which makes writing queries with "optional" values a bit easier.
```ts
q("*")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ q("*")
```

:::tip
The [`.grab$`](/query-building#grab-1) and [`.grabOne$`](/query-building#grabone-1) methods use this under the hood – in most instances, we recommend you just use `.grab$` and `.grabOne$` instead of this utility.
The [`.grab$`](/docs/query-building#grab-1) and [`.grabOne$`](/docs/query-building#grabone-1) methods use this under the hood – in most instances, we recommend you just use `.grab$` and `.grabOne$` instead of this utility.
:::

## `sanityImage`
Expand Down
File renamed without changes.
125 changes: 0 additions & 125 deletions website/docusaurus.config.js

This file was deleted.

129 changes: 129 additions & 0 deletions website/docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
import { themes as prismThemes } from "prism-react-renderer";
import type { Config } from "@docusaurus/types";
import type * as Preset from "@docusaurus/preset-classic";
import MonacoEditorWebpackPlugin from "monaco-editor-webpack-plugin";

const config: Config = {
title: "GROQD",
tagline: "Typesafe GROQ Query Builder",
url: "https://commerce.nearform.com/",
favicon: "img/nearform-icon.svg",
baseUrl: process.env.VERCEL_ENV === "preview" ? "/" : "/open-source/groqd",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
i18n: {
defaultLocale: "en",
locales: ["en"],
},
presets: [
[
"classic",
{
docs: {
sidebarPath: "./sidebars.ts",
},
blog: false,
theme: {
customCss: "./src/css/custom.css",
},
...(process.env.VERCEL_ENV === "production" && {
gtag: {
trackingID: process.env.GTAG_TRACKING_ID,
anonymizeIP: true,
},
googleTagManager: {
containerId: process.env.GTM_CONTAINER_ID,
},
}),
} satisfies Preset.Options,
],
],
themes: [
[
require.resolve("@easyops-cn/docusaurus-search-local"),
/** @type {import("@easyops-cn/docusaurus-search-local").PluginOptions} */
{
hashed: true,
},
],
],
plugins: [
async function twPlugin() {
return {
name: "tailwind-plugin",
configurePostCss(postcssOptions) {
postcssOptions.plugins = [
require("postcss-import"),
require("tailwindcss"),
require("autoprefixer"),
];
return postcssOptions;
},
};
},
async function monacoPlugin() {
return {
name: "monaco-plugin",
configureWebpack() {
return {
plugins: [
new MonacoEditorWebpackPlugin({
languages: ["typescript", "json"],
}),
],
};
},
};
},
],
themeConfig: {
metadata: [
{
name: "viewport",
content: "width=device-width, initial-scale=1, maximum-scale=1",
},
],
docs: {
sidebar: {
hideable: true,
},
},
navbar: {
title: "GROQD",
logo: {
alt: "Nearform logo",
src: "img/nearform-logo-white.svg",
},
items: [
{
type: "docSidebar",
sidebarId: "sidebar",
position: "left",
label: "Documentation",
},
{
href: "https://github.com/FormidableLabs/groqd",
className: "header-github-link",
"aria-label": "GitHub Repository",
position: "right",
},
],
},
footer: {
logo: {
alt: "Nearform logo",
src: "img/nearform-logo-white.svg",
href: "https://commerce.nearform.com",
width: 100,
height: 100,
},
copyright: `Copyright © ${new Date().getFullYear()} Nearform`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.okaidia,
},
} satisfies Preset.ThemeConfig,
};

export default config;
26 changes: 14 additions & 12 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@
"gather-types": "node ./scripts/gather-types.js"
},
"dependencies": {
"@docusaurus/core": "2.3.1",
"@docusaurus/preset-classic": "2.3.1",
"@docusaurus/theme-classic": "^2.4.0",
"@docusaurus/core": "3.1.1",
"@docusaurus/preset-classic": "3.1.1",
"@easyops-cn/docusaurus-search-local": "^0.40.1",
"@headlessui/react": "^1.7.14",
"@mdx-js/react": "^1.6.22",
"@mdx-js/react": "^3.0.0",
"@types/lodash.has": "^4.5.7",
"@uiw/react-split": "^5.8.10",
"autoprefixer": "^10.4.14",
"clsx": "^1.2.1",
"formidable-oss-badges": "^1.4.1",
"glob": "^10.0.0",
"groq-js": "^1.1.1",
"groqd": "workspace:*",
Expand All @@ -34,27 +35,28 @@
"lodash.has": "^4.5.2",
"lz-string": "^1.5.0",
"monaco-editor": "^0.37.1",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-hot-toast": "^2.4.1",
"react-icons": "^4.10.1",
"tailwindcss": "^3.3.2",
"zod": "^3.22.4"
},
"devDependencies": {
"@algolia/client-search": "^4.17.0",
"@docusaurus/module-type-aliases": "2.3.1",
"@docusaurus/types": "^2.4.0",
"@docusaurus/module-type-aliases": "3.1.1",
"@docusaurus/theme-classic": "^3.2.1",
"@docusaurus/tsconfig": "3.1.1",
"@docusaurus/types": "3.1.1",
"@faker-js/faker": "^7.6.0",
"@tsconfig/docusaurus": "^1.0.5",
"@types/lodash.debounce": "^4.0.7",
"@types/node": "^18.7.5",
"monaco-editor-webpack-plugin": "^7.0.1",
"nanoid": "^3.3.6",
"postcss": "^8.4.21",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
"typescript": "~5.2.2"
},
"browserslist": {
"production": [
Expand All @@ -69,6 +71,6 @@
]
},
"engines": {
"node": ">=16.14"
"node": ">=18.0"
}
}
Loading

0 comments on commit b042725

Please sign in to comment.