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

feat(monorepo): converts repo to monorepo #378

Open
wants to merge 2 commits into
base: beta
Choose a base branch
from
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 5 additions & 4 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**/node_modules/**/*
/examples/**/coverage/**/*
/examples/**/node_modules/**/*
/**/generated/**/*
**/node_modules/**/*
**/coverage/**/*
**/generated/**/*
**/dist/**/*
**/tmp/**/*
!.eslintrc.js
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
*.tsbuildinfo

# Coverage directory used by tools like istanbul
coverage
Expand Down
19 changes: 19 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"linters": {
"*.ts": [
"eslint --fix",
"prettier --write",
"git add"
],
"*.{js,json}": [
"prettier --write",
"git add"
],
"*.md": [
"markdownlint"
]
},
"ignore": [
"**/generated/*"
]
}
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
**/generated/**/*
**/node_modules/**/*
**/dist/**/*
**/tmp/**/*
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"printWidth": 100,
"singleQuote": true
}
8 changes: 1 addition & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@
"[html]": {
"editor.formatOnSave": false
},
"eslint.validate": [
"javascript",
{
"language": "typescript",
"autoFix": true
}
],
"eslint.validate": ["javascript", "typescript"],
"search.exclude": {
"dist/": true,
"node_modules/": true
Expand Down
8 changes: 8 additions & 0 deletions examples/01-simple-model/generated/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,14 @@ export interface BaseModelUUID extends BaseGraphQLObject {
version: Int
}

export interface PageInfo {
limit: Float
offset: Float
totalCount: Float
hasNextPage: Boolean
hasPreviousPage: Boolean
}

export interface StandardDeleteResponse {
id: ID_Output
}
Expand Down
2 changes: 1 addition & 1 deletion examples/01-simple-model/generated/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { registerEnumType } from "type-graphql";
const { GraphQLJSONObject } = require("graphql-type-json");

// @ts-ignore
import { BaseWhereInput, JsonObject, PaginationArgs } from "../../../src";
import { BaseWhereInput, JsonObject, PaginationArgs } from "@warthog/core";
import { StringEnum } from "../src/user.model";
// @ts-ignore
import { User } from "../src/user.model";
Expand Down
2 changes: 1 addition & 1 deletion examples/01-simple-model/generated/ormconfig.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { getBaseConfig } from '../../../src';
import { getBaseConfig } from '@warthog/core';

module.exports = getBaseConfig();
8 changes: 8 additions & 0 deletions examples/01-simple-model/generated/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ type Mutation {
deleteUser(where: UserWhereUniqueInput!): StandardDeleteResponse!
}

type PageInfo {
limit: Float!
offset: Float!
totalCount: Float!
hasNextPage: Boolean!
hasPreviousPage: Boolean!
}

type Query {
users(offset: Int, limit: Int = 50, where: UserWhereInput, orderBy: UserOrderByInput): [User!]!
user(where: UserWhereUniqueInput!): User!
Expand Down
2 changes: 1 addition & 1 deletion examples/01-simple-model/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"start:ts": "DEBUG=warthog* ts-node-dev --type-check src/index.ts",
"start:prod": "ts-node src/index.ts",
"//": "Allows us to use the local warthog CLI in commands above",
"warthog": "../../bin/warthog"
"warthog": "../../packages/cli/bin/warthog"
},
"dependencies": {},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/01-simple-model/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'reflect-metadata';

import { logger } from '../../../src';
import { logger } from '@warthog/core';

import { getServer } from './server';

Expand Down
2 changes: 1 addition & 1 deletion examples/01-simple-model/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'reflect-metadata';

import { Server } from '../../../src';
import { Server } from '@warthog/core';

export function getServer(AppOptions = {}, dbOptions = {}) {
return new Server(
Expand Down
2 changes: 1 addition & 1 deletion examples/01-simple-model/src/user.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
IntField,
Model,
StringField
} from '../../../src';
} from '@warthog/core';

// Note: this must be exported and in the same file where it's attached with @EnumField
// Also - must use string enums
Expand Down
4 changes: 3 additions & 1 deletion examples/01-simple-model/src/user.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { Arg, Args, Ctx, Mutation, Query, Resolver } from 'type-graphql';
import { Repository } from 'typeorm';
import { InjectRepository } from 'typeorm-typedi-extensions';

import { BaseContext, BaseResolver, StandardDeleteResponse } from '../../../src';
import { BaseResolver, StandardDeleteResponse } from '@warthog/core';
import { BaseContext } from '@warthog/server-express';

import {
UserCreateInput,
UserUpdateArgs,
Expand Down
2 changes: 1 addition & 1 deletion examples/01-simple-model/tools/seed.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Faker from 'faker';

import { getBindingError, logger } from '../../../src';
import { getBindingError, logger } from '@warthog/core';

import { getServer } from '../src/server';

Expand Down
3 changes: 0 additions & 3 deletions examples/01-simple-model/warthog.config.js

This file was deleted.

4 changes: 2 additions & 2 deletions examples/02-complex-example/generated/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export interface UserCreateInput {
bigIntField?: Float | null
jsonField?: JSONObject | null
jsonFieldNoFilter?: JSONObject | null
stringField?: String | null
stringField: String
noFilterField?: String | null
noSortField?: String | null
noFilterOrSortField?: String | null
Expand Down Expand Up @@ -466,7 +466,7 @@ export interface User extends BaseGraphQLObject {
bigIntField?: Int | null
jsonField?: JSONObject | null
jsonFieldNoFilter?: JSONObject | null
stringField?: String | null
stringField: String
noFilterField?: String | null
noSortField?: String | null
noFilterOrSortField?: String | null
Expand Down
6 changes: 3 additions & 3 deletions examples/02-complex-example/generated/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { registerEnumType } from "type-graphql";
const { GraphQLJSONObject } = require("graphql-type-json");

// @ts-ignore
import { BaseWhereInput, JsonObject, PaginationArgs } from "../../../src";
import { BaseWhereInput, JsonObject, PaginationArgs } from "@warthog/core";
import { StringEnum } from "../src/modules/user/user.model";
// @ts-ignore
import { User } from "../src/modules/user/user.model";
Expand Down Expand Up @@ -711,8 +711,8 @@ export class UserCreateInput {
@TypeGraphQLField(() => GraphQLJSONObject, { nullable: true })
jsonFieldNoFilter?: JsonObject;

@TypeGraphQLField({ nullable: true })
stringField?: string;
@TypeGraphQLField()
stringField!: string;

@TypeGraphQLField({ nullable: true })
noFilterField?: string;
Expand Down
2 changes: 1 addition & 1 deletion examples/02-complex-example/generated/ormconfig.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { getBaseConfig } from '../../../src';
import { getBaseConfig } from '@warthog/core';

module.exports = getBaseConfig();
4 changes: 2 additions & 2 deletions examples/02-complex-example/generated/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ type User implements BaseGraphQLObject {
jsonFieldNoFilter: JSONObject

"""This is a string field"""
stringField: String
stringField: String!
noFilterField: String
noSortField: String
noFilterOrSortField: String
Expand Down Expand Up @@ -157,7 +157,7 @@ input UserCreateInput {
bigIntField: Float
jsonField: JSONObject
jsonFieldNoFilter: JSONObject
stringField: String
stringField: String!
noFilterField: String
noSortField: String
noFilterOrSortField: String
Expand Down
2 changes: 1 addition & 1 deletion examples/02-complex-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"test": "jest --detectOpenHandles --verbose --coverage",
"test:watch": "jest --watch",
"//": "Allows us to use the local warthog CLI in commands above",
"warthog": "../../bin/warthog"
"warthog": "../../packages/cli/bin/warthog"
},
"dependencies": {
"debug": "^4.1.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/02-complex-example/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'reflect-metadata';

import { logger } from '../../../src';
import { logger } from '@warthog/core';

import { getServer } from './server';

Expand Down
2 changes: 1 addition & 1 deletion examples/02-complex-example/src/modules/user/user.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
NumericField,
StringField,
FloatField
} from '../../../../../src';
} from '@warthog/core';

// Note: this must be exported and in the same file where it's attached with @EnumField
// Also - must use string enums
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { Arg, Args, Authorized, Ctx, Mutation, Query, Resolver } from 'type-grap
import { Repository } from 'typeorm';
import { InjectRepository } from 'typeorm-typedi-extensions';

import { BaseContext, BaseResolver, StandardDeleteResponse } from '../../../../../src';
import { BaseResolver, StandardDeleteResponse } from '@warthog/core';
import { BaseContext } from '@warthog/server-express';

import {
UserCreateInput,
UserUpdateArgs,
Expand Down
5 changes: 3 additions & 2 deletions examples/02-complex-example/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import 'reflect-metadata';

import { authChecker, BaseContext, Server } from '../../../src/';
import { authChecker } from '@warthog/core';
import { BaseContext, Server } from '@warthog/server-express';

import { customLogger } from './logger';

interface Context extends BaseContext {
user: {
email: string;
id: string;
permissions: string;
permissions: string[];
};
}

Expand Down
2 changes: 1 addition & 1 deletion examples/02-complex-example/tools/seed.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Faker from 'faker';

import { getBindingError, logger } from '../../../src';
import { getBindingError, logger } from '@warthog/core';

import { getServer } from '../src/server';
import { Binding } from '../generated/binding';
Expand Down
3 changes: 0 additions & 3 deletions examples/02-complex-example/warthog.config.js

This file was deleted.

13 changes: 13 additions & 0 deletions examples/03-one-to-many-relationship/generated/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,14 @@ export interface BaseModelUUID extends BaseGraphQLObject {
version: Int
}

export interface PageInfo {
limit: Float
offset: Float
totalCount: Float
hasNextPage: Boolean
hasPreviousPage: Boolean
}

export interface Post extends BaseGraphQLObject {
id: ID_Output
createdAt: DateTime
Expand Down Expand Up @@ -261,6 +269,11 @@ The javascript `Date` as string. Type represents date and time as the ISO Date s
*/
export type DateTime = Date | string

/*
The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).
*/
export type Float = number

/*
The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.
*/
Expand Down
2 changes: 1 addition & 1 deletion examples/03-one-to-many-relationship/generated/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { registerEnumType } from "type-graphql";
const { GraphQLJSONObject } = require("graphql-type-json");

// @ts-ignore
import { BaseWhereInput, JsonObject, PaginationArgs } from "../../../src";
import { BaseWhereInput, JsonObject, PaginationArgs } from "@warthog/core";
// @ts-ignore
import { User } from "../src/user.model";
// @ts-ignore
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { getBaseConfig } from '../../../src';
import { getBaseConfig } from '@warthog/core';

module.exports = getBaseConfig();
8 changes: 8 additions & 0 deletions examples/03-one-to-many-relationship/generated/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ type Mutation {
deleteUser(where: UserWhereUniqueInput!): StandardDeleteResponse!
}

type PageInfo {
limit: Float!
offset: Float!
totalCount: Float!
hasNextPage: Boolean!
hasPreviousPage: Boolean!
}

type Post implements BaseGraphQLObject {
id: ID!
createdAt: DateTime!
Expand Down
2 changes: 1 addition & 1 deletion examples/03-one-to-many-relationship/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"start": "yarn start:ts",
"start:ts": "ts-node --type-check src/index.ts",
"//": "Allows us to use the local warthog CLI in commands above",
"warthog": "../../bin/warthog"
"warthog": "../../packages/cli/bin/warthog"
},
"dependencies": {
"handlebars": "^4.5.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/03-one-to-many-relationship/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'reflect-metadata';

import { logger } from '../../../src';
import { logger } from '@warthog/core';

import { getServer } from './server';

Expand Down
2 changes: 1 addition & 1 deletion examples/03-one-to-many-relationship/src/post.model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseModel, ManyToOne, Model, StringField } from '../../../src';
import { BaseModel, ManyToOne, Model, StringField } from '@warthog/core';

import { User } from './user.model';

Expand Down
3 changes: 2 additions & 1 deletion examples/03-one-to-many-relationship/src/post.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { Arg, Args, Ctx, FieldResolver, Mutation, Query, Resolver, Root } from '
import { Repository } from 'typeorm';
import { InjectRepository } from 'typeorm-typedi-extensions';

import { BaseContext, BaseResolver, StandardDeleteResponse } from '../../../src';
import { BaseResolver, StandardDeleteResponse } from '@warthog/core';
import { BaseContext } from '@warthog/server-express';
import {
PostCreateInput,
PostUpdateArgs,
Expand Down
4 changes: 2 additions & 2 deletions examples/03-one-to-many-relationship/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'reflect-metadata';

import { BaseContext, Server } from '../../../src';
import { BaseContext, Server } from '@warthog/server-express';

interface Context extends BaseContext {
user: {
email: string;
id: string;
permissions: string;
permissions: string[];
};
}

Expand Down
Loading