Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small cleanup + docusaurus 3 update #1

Merged
merged 8 commits into from
Mar 22, 2024
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
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VITE_API_URL="https://api.swan.io/sandbox-partner/graphql"
VITE_API_URL="https://api.swan.io/sandbox-partner/graphql"
13 changes: 4 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Build & test

on:
Expand All @@ -14,17 +11,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: lts/*
node-version: 20
cache: yarn

- run: yarn install --pure-lockfile
- run: yarn typecheck
- run: yarn test
- run: yarn build
- run: yarn prepack

- name: Build docs
run: cd docs && yarn && yarn build
Expand Down
16 changes: 10 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# dependencies
/node_modules

# production
/dist

# misc
.DS_Store
.DS_Store?
node_modules/
# example/graphql-env.d.ts
.env
docs/node_modules/
.docusaurus
dist/

yarn-debug.log*
yarn-error.log*
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
example/graphql-env.d.ts
dist/
docs/.docusaurus
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Swan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 4 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

### Installation

```console
```
$ yarn
```

### Local Development

```console
```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```console
```
$ yarn build
```

Expand Down
39 changes: 24 additions & 15 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
// `@type` JSDoc annotations allow editor autocompletion and type checking
// (when paired with `@ts-check`).
// There are various equivalent ways to declare your Docusaurus config.
// See: https://docusaurus.io/docs/api/docusaurus-config

const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/oceanicNext");
import { themes as prismThemes } from "prism-react-renderer";

/** @type {import('@docusaurus/types').Config} */
module.exports = {
const config = {
title: "GraphQL Client",
tagline: "A simple, typesafe GraphQL client for React",
favicon: "img/favicon.png",

// Set the production url of your site here
url: "https://swan-io.github.io",
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: "/graphql-client/",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
favicon: "img/favicon.png",

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: "swan-io", // Usually your GitHub org/user name.
projectName: "graphql-client", // Usually your repo name.

// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",

// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
// may want to replace "en" with "zh-Hans".
i18n: {
defaultLocale: "en",
locales: ["en"],
Expand All @@ -34,13 +41,13 @@ module.exports = {
({
docs: {
routeBasePath: "/",
sidebarPath: require.resolve("./sidebars.js"),
sidebarPath: "./sidebars.js",
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: "https://github.com/swan-io/boxed/edit/main/docs/",
editUrl: "https://github.com/swan-io/graphql-client/edit/main/docs/",
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
customCss: "./src/css/custom.css",
},
}),
],
Expand Down Expand Up @@ -80,8 +87,10 @@ module.exports = {
copyright: `Copyright © ${new Date().getFullYear()} Swan`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
}),
};

export default config;
29 changes: 13 additions & 16 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,17 @@
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "2.4.0",
"@docusaurus/preset-classic": "2.4.0",
"@docusaurus/theme-search-algolia": "2.4.0",
"@mdx-js/react": "^1.6.22",
"@svgr/webpack": "^5.5.0",
"clsx": "^1.2.1",
"file-loader": "^6.2.0",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"url-loader": "^4.1.1"
"@docusaurus/core": "3.1.1",
"@docusaurus/preset-classic": "3.1.1",
"@mdx-js/react": "^3.0.1",
"clsx": "^2.1.0",
"prism-react-renderer": "^2.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.4.0"
"@docusaurus/module-type-aliases": "3.1.1",
"@docusaurus/types": "3.1.1"
},
"browserslist": {
"production": [
Expand All @@ -36,12 +33,12 @@
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
"last 3 chrome version",
"last 3 firefox version",
"last 5 safari version"
]
},
"engines": {
"node": ">=16.14"
"node": ">=18.0"
}
}
4 changes: 3 additions & 1 deletion docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// @ts-check

/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
module.exports = {
const sidebars = {
docs: [
{
type: "doc",
Expand All @@ -36,3 +36,5 @@ module.exports = {
},
],
};

export default sidebars;
1 change: 0 additions & 1 deletion docs/src/components/HomepageFeatures/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import clsx from "clsx";
import React from "react";
import styles from "./styles.module.css";

const FeatureList = [
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/HomepageFeatures/styles.module.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.features {
display: flex;
align-items: center;
padding: 3rem 0;
padding: 5rem 0;
width: 100%;
}

Expand Down
7 changes: 5 additions & 2 deletions docs/src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
* work well for content-centric websites.
*/

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap");

/* You can override the default Infima variables here. */
:root {
--ifm-color-primary: #6240b5;
--ifm-navbar-link-hover-color: #8166c4;
--ifm-color-primary-dark: #4e3391;
--ifm-color-primary-darker: #3b266d;
--ifm-color-primary-darkest: #271a48;
Expand All @@ -17,6 +18,7 @@
--ifm-code-font-size: 95%;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.08);

--ifm-navbar-link-hover-color: #8166c4;
--ifm-font-family-base: Inter, system-ui, -apple-system, Segoe UI, Roboto,
Ubuntu, Cantarell, Noto Sans, sans-serif, BlinkMacSystemFont, "Segoe UI",
Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
Expand All @@ -26,12 +28,13 @@
/* For readability concerns, you should choose a lighter palette in dark mode. */
[data-theme="dark"] {
--ifm-color-primary: #af9ddc;
--ifm-navbar-link-hover-color: #c0b2e1;
--ifm-color-primary-dark: #a08ad6;
--ifm-color-primary-darker: #9278d0;
--ifm-color-primary-darkest: #8267c8;
--ifm-color-primary-light: #d0c5e8;
--ifm-color-primary-lighter: #dfd9ef;
--ifm-color-primary-lightest: #efecf7;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);

--ifm-navbar-link-hover-color: #c0b2e1;
}
Loading