Skip to content

Commit b3a02cf

Browse files
committed
feat(docs): first draft
1 parent 8623bdc commit b3a02cf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+14239
-41
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,6 @@ package-lock.json
101101

102102
# examples artefacts
103103
examples/*.ts
104-
examples/model/*
104+
examples/model/*
105+
106+
!docs/src/lib

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<p align="center">
2-
<img src="/logo/orval-logo-horizontal.png?raw=true" width="500" height="160" alt="Orval - Restfull Client Generator" />
2+
<img src="/logo/orval-logo-horizontal.png?raw=true" width="500" height="160" alt="orval - Restfull Client Generator" />
33
</p>
44
<h3 align="center">
55
Inspired by <a href="https://github.com/contiamo/restful-react">restful-react</a>

docs/.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.next
2+
.now
3+
.env
4+
.env.*
5+
node_modules
6+
*.log
7+
.DS_Store
8+
.vercel

docs/README.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# orval Docs
2+
3+
This is source code to orval.dev. It is forked from the [Formik](https://formik.org) docs and is built with:
4+
5+
- Next.js
6+
- MDX
7+
- Tailwind
8+
- Algolia
9+
- Notion
10+
11+
## Running locally
12+
13+
```sh
14+
yarn install
15+
```
16+
17+
At the moment, you need to signup for Notion, and [follow these instructions](https://github.com/ijjk/notion-blog#getting-blog-index-and-token) to get a token and create a blog in order to develop locally. Not ideal, but hopefully will fix soon.
18+
19+
With tokens and page index in hand, rename `.sample.env` and `.sample.env.build` to just `.env` and `.env.build`. In each one, add respective parameters:
20+
21+
```diff
22+
-NOTION_TOKEN=XXXX
23+
+NOTION_TOKEN=<YOUR_TOKEN>
24+
-BLOG_INDEX_ID=XXXXX
25+
+BLOG_INDEX_ID=<YOUR_BLOG_INDEX_ID>
26+
```
27+
28+
Now it will work. Run `yarn dev` to get going.
29+
30+
If you get stuck or need help, [send a DM to Jared](https://twitter.com/jaredpalmer) on Twitter.

docs/jsconfig.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": "./src"
4+
}
5+
}

docs/next.config.js

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
const path = require('path')
2+
const dotenvLoad = require('dotenv-load')
3+
const optimizedImages = require('next-optimized-images')
4+
dotenvLoad()
5+
6+
const remarkPlugins = [
7+
require('remark-slug'),
8+
require('./src/lib/docs/remark-paragraph-alerts'),
9+
[
10+
require('remark-autolink-headings'),
11+
{
12+
behavior: 'append',
13+
linkProperties: {
14+
class: ['anchor'],
15+
title: 'Direct link to heading',
16+
},
17+
},
18+
],
19+
20+
require('remark-emoji'),
21+
require('remark-footnotes'),
22+
require('remark-images'),
23+
[
24+
require('remark-github'),
25+
{ repository: 'https://github.com/tannerlinsley/react-query' },
26+
],
27+
require('remark-unwrap-images'),
28+
[
29+
require('remark-toc'),
30+
{
31+
skip: 'Reference',
32+
maxDepth: 6,
33+
},
34+
],
35+
]
36+
37+
module.exports = optimizedImages({
38+
pageExtensions: ['jsx', 'js', 'mdx', 'md'],
39+
env: {
40+
NEXT_PUBLIC_GA_TRACKING_ID: process.env.GA_TRACKING_ID || '',
41+
SENTRY_RELEASE: process.env.VERCEL_GITHUB_COMMIT_SHA || '',
42+
},
43+
async redirects() {
44+
return [
45+
{
46+
source: '/docs/:any*',
47+
destination: '/:any*', // Matched parameters can be used in the destination
48+
permanent: true,
49+
},
50+
]
51+
},
52+
experimental: {
53+
plugins: true,
54+
modern: true,
55+
},
56+
webpack: (config, { dev, isServer, ...options }) => {
57+
config.module.rules.push({
58+
test: /.mdx?$/, // load both .md and .mdx files
59+
use: [
60+
options.defaultLoaders.babel,
61+
{
62+
loader: '@mdx-js/loader',
63+
options: {
64+
remarkPlugins,
65+
},
66+
},
67+
path.join(__dirname, './src/lib/docs/md-loader'),
68+
],
69+
})
70+
71+
// only compile build-rss in production server build
72+
if (dev || !isServer) {
73+
return config
74+
}
75+
76+
// we're in build mode so enable shared caching for Notion data
77+
process.env.USE_CACHE = 'true'
78+
79+
const originalEntry = config.entry
80+
config.entry = async () => {
81+
const entries = {
82+
...(await originalEntry()),
83+
}
84+
// entries['./scripts/build-rss.js'] = './src/lib/build-rss.js'
85+
return entries
86+
}
87+
88+
return config
89+
},
90+
optimizeImages: {
91+
/* config for next-optimized-images */
92+
mozjpeg: {
93+
quality: 70,
94+
},
95+
optipng: {
96+
optimizationLevel: 3,
97+
},
98+
optimizeImagesInDev: true,
99+
},
100+
})

docs/package.json

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
"name": "fdocs3",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"author": "Jared Palmer <[email protected]>",
6+
"license": "MIT",
7+
"scripts": {
8+
"dev": "next",
9+
"build": "next build",
10+
"start": "next start",
11+
"index-docs": "node ./.next/serverless/scripts/index-docs.js"
12+
},
13+
"dependencies": {
14+
"@babel/preset-typescript": "^7.10.4",
15+
"@docsearch/react": "1.0.0-alpha.14",
16+
"@mdx-js/loader": "^1.6.18",
17+
"@mdx-js/mdx": "^1.6.18",
18+
"@mdx-js/react": "^1.6.18",
19+
"@mdx-js/tag": "^0.20.3",
20+
"@next/mdx": "^9.5.3",
21+
"@next/plugin-google-analytics": "^9.5.3",
22+
"@reactions/component": "^2.0.2",
23+
"@zeit/fetch": "^6.0.0",
24+
"@zeit/react-jsx-parser": "^2.0.0",
25+
"async-sema": "^3.1.0",
26+
"body-scroll-lock": "^3.1.5",
27+
"classnames": "^2.2.6",
28+
"copy-to-clipboard": "^3.3.1",
29+
"date-fns": "^2.16.1",
30+
"docsearch.js": "^2.6.3",
31+
"framer-motion": "^1.11.1",
32+
"gray-matter": "^4.0.2",
33+
"imagemin-mozjpeg": "^9.0.0",
34+
"imagemin-optipng": "^8.0.0",
35+
"intersection-observer": "^0.10.0",
36+
"isomorphic-unfetch": "^3.0.0",
37+
"next": "^9.5.3",
38+
"next-images": "^1.5.0",
39+
"next-optimized-images": "^2.6.2",
40+
"node-fetch": "^2.6.1",
41+
"prismjs": "^1.21.0",
42+
"react": "^16.13.1",
43+
"react-dom": "^16.13.1",
44+
"react-icons": "^3.11.0",
45+
"react-live": "^2.2.2",
46+
"rehype-format": "^3.0.1",
47+
"rehype-stringify": "^7.0.0",
48+
"remark": "^12.0.1",
49+
"remark-autolink-headings": "^6.0.0",
50+
"remark-emoji": "^2.1.0",
51+
"remark-footnotes": "^1.0.0",
52+
"remark-github": "^9.0.0",
53+
"remark-images": "^2.0.0",
54+
"remark-slug": "^6.0.0",
55+
"remark-toc": "^7.0.0",
56+
"remark-unwrap-images": "^2.0.0",
57+
"scroll-into-view-if-needed": "^2.2.26",
58+
"semver-regex": "^3.1.1",
59+
"unist-util-visit": "^2.0.3"
60+
},
61+
"devDependencies": {
62+
"@babel/cli": "^7.11.6",
63+
"@babel/core": "^7.11.6",
64+
"@babel/plugin-transform-typescript": "^7.11.0",
65+
"@babel/preset-react": "^7.10.4",
66+
"@tailwindcss/ui": "^0.3.0",
67+
"algoliasearch": "3.35.1",
68+
"babel-preset-react-app": "^9.1.2",
69+
"dotenv-load": "^2.0.0",
70+
"github-slugger": "^1.3.0",
71+
"md5": "^2.3.0",
72+
"mdast-util-to-string": "^1.1.0",
73+
"postcss-preset-env": "^6.7.0",
74+
"remark-parse": "^8.0.3",
75+
"tailwindcss": "^1.8.10",
76+
"unified": "^9.2.0",
77+
"webp-loader": "^0.6.0"
78+
},
79+
"engines": {
80+
"node": ">=12.x"
81+
}
82+
}

docs/postcss.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
plugins: ['tailwindcss', 'postcss-preset-env'],
3+
};

docs/public/robots.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
User-agent: *
2+
Disallow:

docs/src/components/ArrowRight.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import * as React from 'react';
2+
export function ArrowRight({
3+
fill = '#718096',
4+
width = 6,
5+
height = 10
6+
}) {
7+
return <svg width={width} height={height} viewBox="0 0 6 10" fill="none" xmlns="http://www.w3.org/2000/svg">
8+
<path d="M1.4 8.56L4.67 5M1.4 1.23L4.66 4.7" stroke={fill} strokeLinecap="square" />
9+
</svg>;
10+
}

docs/src/components/Banner.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export function Banner() {
2+
return null; // return (
3+
// <div className="bg-gray-900">
4+
// <div className="container mx-auto py-2 flex items-center justify-between">
5+
// <img src="/logo.png" alt="formium" width="150px" className="-ml-3" />
6+
// <div className="text-white font-bold flex items-center">
7+
// Hassle-free form storage for static sites →
8+
// </div>
9+
// </div>
10+
// </div>
11+
// );
12+
}

0 commit comments

Comments
 (0)