Skip to content

Commit d933c6f

Browse files
committed
chore(docz): adds docz documentation site
documentation (#374) chore(docz): adds docz documentation site fix(gitignore): ignore .docz folder updates more updates
1 parent 79b7091 commit d933c6f

Some content is hidden

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

57 files changed

+19944
-76
lines changed

README.md

Lines changed: 7 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -18,82 +18,11 @@
1818

1919
## Summary
2020

21-
Warthog is a [Node.js](http://nodejs.org) GraphQL API framework for quickly building consistent GraphQL APIs that have sorting, filtering and pagination out of the box. It is written in [TypeScript](http://www.typescriptlang.org) and makes heavy use of decorators for concise, declarative code.
22-
23-
## Note: Upgrading from 1.0 to 2.0
24-
25-
Warthog is now on version 2.0! There were a few breaking changes that you should consider while upgrading. Also, we tried to keep all new features development on v1, but did end up adding JSON filtering directly to 2.0 as it was much easier given some foundation refactors.
26-
27-
<details>
28-
<summary>Expand for Breaking change details</summary>
29-
<p>
30-
31-
### More specific scalars
32-
33-
A few fields have been updated to use more specific GraphQL scalars:
34-
35-
- ID fields: previously these were represented by type `String`. Dates now use type `ID`
36-
- Date fields: previously these were represented by type `String`. Dates now use type `DateTime`
37-
38-
Since your GraphQL schema has changed and so have the associated TypeScript types in `classes.ts`, there might be changes in your server code and even perhaps some associated client code if you use these generated classes in your client code.
39-
40-
### `mockDBConnection` has been removed
41-
42-
The old codegen pipeline used TypeORM's metadata in order to generate the GraphQL schema since Warthog didn't also capture this metadata. Warthog now captures the necessary metadata, so we no longer need to lean on TypeORM and therefore we don't need the `mockDBConnection` we previously used during codegen. Searching your codebase for `mockDBConnection` and `WARTHOG_MOCK_DATABASE`/`MOCK_DATABASE` should do it. If you've been using the Warthog CLI for codegen, you shouldn't have anything to do here.
43-
44-
### Project Dependencies Updated
45-
46-
Staying on the latest versions of libraries is good for security, performance and new features. We've bumped to the latest stable versions of each of Warthog's dependencies. This might require some changes to your package.json.
47-
48-
### Troubleshooting
49-
50-
#### Cannot get connection "default" from the connection manager
51-
52-
If you get an error like:
53-
54-
```txt
55-
Cannot get connection "default" from the connection manager. Make sure you have created such connection. Also make sure you have called useContainer(Container) in your application before you established a connection and importing any entity.
56-
```
57-
58-
It could be caused by 2 things:
59-
60-
##### Remove explicit `Container` injection
61-
62-
In V1 of Warthog, the README suggested that you should explicitly create your DI containers and pass them into your `App` instance like so:
63-
64-
```typescript
65-
import { Container } from 'typedi'; // REMOVE this
66-
import { useContainer } from 'typeorm'; // REMOVE this
67-
68-
import { App } from 'warthog';
69-
70-
async function run() {
71-
useContainer(Container); // REMOVE this
72-
73-
const app = new App({ container: Container }); // REMOVE the container option here
74-
await app.start();
75-
}
76-
```
77-
78-
In V2, it is recommended that you no longer do this unless you explicitly need access to the Container.
79-
80-
##### Remove references to Warthog's dependencies
81-
82-
It can sometimes cause problems to explicitly require Warthog's depdendencies (ie `type-graphql`, `typedi`, `typeorm` and `typeorm-typedi-extensions`). In future versions, remove these explicit dependencies from `package.json`:
83-
84-
```txt
85-
- "type-graphql": "...",
86-
- "typedi": "...",
87-
- "typeorm": "...",
88-
- "typeorm-typedi-extensions": "...",
89-
```
90-
91-
</p>
92-
</details>
21+
Warthog is a [Node.js](http://nodejs.org) GraphQL API framework for quickly building consistent GraphQL APIs that have sorting, filtering and pagination out of the box. It is written in [TypeScript](http://www.typescriptlang.org) and makes use of decorators for concise, declarative code. With Warthog, you write your models and resolvers and we handle the rest.
9322

9423
## Philosophy
9524

96-
This library is intentionally opinionated and generates as much code as possible. When teams build products quickly, even if they have strong conventions and good linters, the GraphQL can quickly become inconsistent, making it difficult for clients to consume the APIs in a reusable way.
25+
This library brings a lot of opinions and generates as much code as possible. When teams build products quickly, even if they have strong conventions and good linters, the GraphQL can quickly become inconsistent, making it difficult for clients to consume the APIs in a reusable way.
9726

9827
To do this, Warthog automatically generates the following:
9928

@@ -112,7 +41,7 @@ Further, it covers the following concerns by hooking into best-in-class open sou
11241

11342
## Prerequisites
11443

115-
Warthog currently only supports PostgreSQL as a DB engine, so you must have Postgres installed before getting Warthog set up. (Note: Postgres 12 is not currently supported)
44+
Warthog currently only supports PostgreSQL as a DB engine, so you must have Postgres (version 10, 11 or 12) installed before getting Warthog set up.
11645

11746
<details>
11847
<summary>Expand for Postgres installation options</summary>
@@ -254,6 +183,10 @@ Note that the examples in the [examples](./examples/README.md) folder use relati
254183
</p>
255184
</details>
256185

186+
## Documentation
187+
188+
Our documentation is hosted at [warthog.dev](https://warthog.dev) or you can browse the [docs](./docs/src) directory.
189+
257190
## Contributing
258191

259192
PRs accepted, fire away! Or add issues if you have use cases Warthog doesn't cover.

docs/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# gatsby files
2+
.cache/
3+
public
4+
5+
# dependencies
6+
node_modules
7+
8+
.docz

docs/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Docz
2+
3+
Here's how I got this set up:
4+
5+
- `yarn create docz-app docz-app-gatsby --example gatsby`
6+
- Hook up to Netlify via [Docz - Deploying your Docs](https://www.docz.site/docs/deploying-your-docs)
7+
- Change "Production branch" to your feature branch to test : `issue-322-documentation-site`
8+
9+
Base directory ./docz
10+
Build command yarn build
11+
Publish directory ./docz/.docz/public
12+
13+
Site is now published to [gifted-panini-c878aa](https://gifted-panini-c878aa.netlify.com/)
14+
15+
### To Add
16+
17+
- Full listing of decorators
18+
- Full listing of options available in decorator
19+
- Full list of data types per decorator
20+
- Examples of decorator usage (ex. password being writeonly)
21+
22+
Check out customization options here: https://www.docz.site/docs/gatsby-theme

docs/doczrc.js

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
// https://www.docz.site/docs/project-configuration
2+
// Examples: https://github.com/doczjs/docz/tree/master/examples
3+
export default {
4+
base: '/src',
5+
ignore: ['README.md'],
6+
themeConfig: {
7+
// TODO: change this to "dark" once I have an appropriate icon
8+
// initialColorMode: 'light',
9+
mainContainer: {
10+
fullscreen: false,
11+
align: 'center'
12+
},
13+
menu: {
14+
search: false,
15+
headings: {
16+
rightSide: true,
17+
scrollspy: true,
18+
depth: 3
19+
}
20+
}
21+
},
22+
menu: [
23+
{
24+
name: 'Introduction',
25+
menu: ['Introduction to Warthog', 'Installation and Setup']
26+
},
27+
{
28+
name: 'Constructs',
29+
menu: ['Models', 'Resolvers', 'Services', 'Generated Folder', 'Server', 'Config']
30+
},
31+
{
32+
name: 'Techniques',
33+
menu: [
34+
'Authentication',
35+
'Authorization',
36+
'Validations',
37+
'Complex Use Cases',
38+
'Transactions',
39+
'Production'
40+
]
41+
},
42+
{
43+
name: 'Decorators',
44+
menu: [
45+
'Overview',
46+
'BooleanField',
47+
'CustomField',
48+
'DateField',
49+
'EmailField',
50+
'EnumField',
51+
'Field',
52+
'FloatField',
53+
'ForiegnKeyField',
54+
'IdField',
55+
'InterfaceType',
56+
'IntField',
57+
'JSONField',
58+
'StringField',
59+
'ManyToMany',
60+
'ManyToManyJoin',
61+
'ManyToOne',
62+
'OneToMany',
63+
'Model'
64+
]
65+
},
66+
{
67+
name: 'CLI',
68+
menu: [
69+
'CLI Overview',
70+
'codegen',
71+
'db:create',
72+
'db:drop',
73+
'generate',
74+
'db:migrate',
75+
'db:migrate:create'
76+
]
77+
},
78+
{
79+
name: 'Upgrading',
80+
menu: ['Upgrading to 2.0']
81+
}
82+
],
83+
title: 'Warthog',
84+
description: ''
85+
};

docs/gatsby-config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
plugins: [
3+
'gatsby-theme-docz',
4+
`gatsby-transformer-sharp`,
5+
// this (optional) plugin enables Progressive Web App + Offline functionality
6+
// To learn more, visit: https://gatsby.dev/offline
7+
// `gatsby-plugin-offline`,
8+
{
9+
resolve: '@nejcm/docz-theme-extended'
10+
}
11+
]
12+
};

docs/package.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "warthog",
3+
"private": true,
4+
"description": "Code-first Node.js GraphQL Framework with auto-generated schema",
5+
"version": "2.0.0-rc.41",
6+
"keywords": [
7+
"gatsby",
8+
"docz"
9+
],
10+
"license": "MIT",
11+
"bugs": {
12+
"url": "https://github.com/goldcaddy77/warthog/issues"
13+
},
14+
"repository": {
15+
"type": "git",
16+
"url": "https://github.com/goldcaddy77/warthog.git"
17+
},
18+
"scripts": {
19+
"dev": "rm -rf .docz .cache && gatsby develop",
20+
"build": "gatsby build",
21+
"serve": "gatsby serve"
22+
},
23+
"dependencies": {
24+
"@nejcm/docz-theme-extended": "^2.0.2",
25+
"docz": "^2.0.0-rc.76",
26+
"gatsby": "^2.13.73",
27+
"gatsby-plugin-offline": "^2.2.7",
28+
"gatsby-plugin-sharp": "^2.2.18",
29+
"gatsby-theme-docz": "latest",
30+
"gatsby-transformer-sharp": "^2.2.7",
31+
"prop-types": "^15.7.2",
32+
"react": "^16.9.0",
33+
"react-dom": "^16.9.0",
34+
"react-helmet-async": "^1.0.4"
35+
}
36+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
name: BooleanField
3+
menu: Decorators
4+
---
5+
6+
## COMING SOON

docs/src/Decorators/CustomField.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name: CustomField
3+
menu: Decorators
4+
---
5+
6+
7+
8+
9+
# COMING SOON

docs/src/Decorators/DateField.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name: DateField
3+
menu: Decorators
4+
---
5+
6+
7+
8+
9+
# COMING SOON

docs/src/Decorators/EmailField.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name: EmailField
3+
menu: Decorators
4+
---
5+
6+
7+
8+
9+
# COMING SOON

0 commit comments

Comments
 (0)