From 80a0796de39f1b5604265ec2e0c1d52dfd540d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20My=C5=9Bliwiec?= Date: Sun, 13 May 2018 13:18:05 +0200 Subject: [PATCH] refactor: adjust 3rd party modules convention --- .eslintrc.js | 20 --- .npmignore | 7 + .prettierrc | 4 +- README.md | 1 - dist/README.md | 54 -------- dist/decorators/resolvers.decorators.d.ts | 16 --- dist/decorators/resolvers.decorators.js | 53 -------- dist/enums/resolvers.enum.d.ts | 5 - dist/enums/resolvers.enum.js | 8 -- dist/graphql.constants.d.ts | 4 - dist/graphql.constants.js | 6 - dist/graphql.factory.d.ts | 13 -- dist/graphql.factory.js | 71 ---------- dist/graphql.module.d.ts | 1 - dist/graphql.module.js | 43 ------ dist/index.d.ts | 10 -- dist/index.js | 14 -- dist/package.json | 19 --- dist/resolvers-explorer.service.d.ts | 36 ----- dist/resolvers-explorer.service.js | 158 ---------------------- index.d.ts | 1 + index.js | 6 + index.ts | 1 + package.json | 37 ++--- 24 files changed, 38 insertions(+), 550 deletions(-) delete mode 100644 .eslintrc.js create mode 100644 .npmignore delete mode 100644 dist/README.md delete mode 100644 dist/decorators/resolvers.decorators.d.ts delete mode 100644 dist/decorators/resolvers.decorators.js delete mode 100644 dist/enums/resolvers.enum.d.ts delete mode 100644 dist/enums/resolvers.enum.js delete mode 100644 dist/graphql.constants.d.ts delete mode 100644 dist/graphql.constants.js delete mode 100644 dist/graphql.factory.d.ts delete mode 100644 dist/graphql.factory.js delete mode 100644 dist/graphql.module.d.ts delete mode 100644 dist/graphql.module.js delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/package.json delete mode 100644 dist/resolvers-explorer.service.d.ts delete mode 100644 dist/resolvers-explorer.service.js create mode 100644 index.d.ts create mode 100644 index.js create mode 100644 index.ts diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 69df702b6..000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = { - "extends": "airbnb-base", - "plugins": [ - "import", - ], - "rules": { - "no-console": 0, - "prefer-spread": 0, - "no-underscore-dangle": 0, - "max-len": ["error", 120], - "linebreak-style": 0 - }, - "globals": { - "describe": false, - "it": false, - "before": false, - "beforeEach": false, - "Promise": true, - }, -}; diff --git a/.npmignore b/.npmignore new file mode 100644 index 000000000..7ded85921 --- /dev/null +++ b/.npmignore @@ -0,0 +1,7 @@ +# source +lib +index.ts +package-lock.json +tslint.json +tsconfig.json +.prettierrc \ No newline at end of file diff --git a/.prettierrc b/.prettierrc index dcb72794f..ffa374c07 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,4 +1,4 @@ { - "singleQuote": true, - "trailingComma": "all" + "trailingComma": "all", + "singleQuote": true } \ No newline at end of file diff --git a/README.md b/README.md index 3405bccc8..cc067f2a1 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,6 @@ Backers on Open Collective Sponsors on Open Collective -

- -## Description - -This is a [GraphQL (Apollo)](https://www.apollographql.com/) module for [Nest](https://github.com/nestjs/nest). - -## Installation - -```bash -$ npm i --save @nestjs/graphql graphql-tools graphql -``` - -## Quick Start - -[Overview & Tutorial](https://docs.nestjs.com/graphql/quick-start) - -## Support - -Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). - -## Stay in touch - -* Author - [Kamil Myśliwiec](https://kamilmysliwiec.com) -* Website - [https://nestjs.com](https://nestjs.com/) -* Twitter - [@nestframework](https://twitter.com/nestframework) - -## License - -Nest is [MIT licensed](LICENSE). diff --git a/dist/decorators/resolvers.decorators.d.ts b/dist/decorators/resolvers.decorators.d.ts deleted file mode 100644 index ff866706a..000000000 --- a/dist/decorators/resolvers.decorators.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Resolvers } from '../enums/resolvers.enum'; -export declare function createResolverDecorator( - resolver?: Resolvers | string, -): (name?: string) => any; -export declare function createPropertyDecorator( - propertyName?: string, -): MethodDecorator; -export declare function createDelegateDecorator( - propertyName?: string, -): MethodDecorator; -export declare const Query: (name?: string) => any; -export declare const Mutation: (name?: string) => any; -export declare const Subscription: (name?: string) => any; -export declare const Resolver: (name?: string) => any; -export declare const ResolveProperty: typeof createPropertyDecorator; -export declare const DelegateProperty: typeof createDelegateDecorator; diff --git a/dist/decorators/resolvers.decorators.js b/dist/decorators/resolvers.decorators.js deleted file mode 100644 index 0b4a90e25..000000000 --- a/dist/decorators/resolvers.decorators.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const common_1 = require('@nestjs/common'); -const graphql_constants_1 = require('../graphql.constants'); -const resolvers_enum_1 = require('../enums/resolvers.enum'); -function createResolverDecorator(resolver) { - return name => (target, key, descriptor) => { - common_1.ReflectMetadata( - graphql_constants_1.RESOLVER_TYPE_METADATA, - resolver || name, - )(target, key, descriptor); - common_1.ReflectMetadata(graphql_constants_1.RESOLVER_NAME_METADATA, name)( - target, - key, - descriptor, - ); - }; -} -exports.createResolverDecorator = createResolverDecorator; -function createPropertyDecorator(propertyName) { - return (target, key, descriptor) => { - common_1.ReflectMetadata( - graphql_constants_1.RESOLVER_NAME_METADATA, - propertyName, - )(target, key, descriptor); - common_1.ReflectMetadata( - graphql_constants_1.RESOLVER_PROPERTY_METADATA, - propertyName, - )(target, key, descriptor); - }; -} -exports.createPropertyDecorator = createPropertyDecorator; -function createDelegateDecorator(propertyName) { - return (target, key, descriptor) => { - common_1.ReflectMetadata( - graphql_constants_1.RESOLVER_NAME_METADATA, - propertyName, - )(target, key, descriptor); - common_1.ReflectMetadata( - graphql_constants_1.RESOLVER_DELEGATE_METADATA, - propertyName, - )(target, key, descriptor); - }; -} -exports.createDelegateDecorator = createDelegateDecorator; -exports.Query = createResolverDecorator(resolvers_enum_1.Resolvers.QUERY); -exports.Mutation = createResolverDecorator(resolvers_enum_1.Resolvers.MUTATION); -exports.Subscription = createResolverDecorator( - resolvers_enum_1.Resolvers.SUBSCRIPTION, -); -exports.Resolver = createResolverDecorator(); -exports.ResolveProperty = createPropertyDecorator; -exports.DelegateProperty = createDelegateDecorator; diff --git a/dist/enums/resolvers.enum.d.ts b/dist/enums/resolvers.enum.d.ts deleted file mode 100644 index 51764e5c0..000000000 --- a/dist/enums/resolvers.enum.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export declare enum Resolvers { - QUERY = 'Query', - MUTATION = 'Mutation', - SUBSCRIPTION = 'Subscription', -} diff --git a/dist/enums/resolvers.enum.js b/dist/enums/resolvers.enum.js deleted file mode 100644 index 73c06ca47..000000000 --- a/dist/enums/resolvers.enum.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -var Resolvers; -(function(Resolvers) { - Resolvers['QUERY'] = 'Query'; - Resolvers['MUTATION'] = 'Mutation'; - Resolvers['SUBSCRIPTION'] = 'Subscription'; -})((Resolvers = exports.Resolvers || (exports.Resolvers = {}))); diff --git a/dist/graphql.constants.d.ts b/dist/graphql.constants.d.ts deleted file mode 100644 index 6c2cae750..000000000 --- a/dist/graphql.constants.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export declare const RESOLVER_TYPE_METADATA = "graphql:resolver_type"; -export declare const RESOLVER_NAME_METADATA = "graphql:resolver_name"; -export declare const RESOLVER_PROPERTY_METADATA = "graphql:resolve_property"; -export declare const RESOLVER_DELEGATE_METADATA = "graphql:delegate_property"; diff --git a/dist/graphql.constants.js b/dist/graphql.constants.js deleted file mode 100644 index a2534c35e..000000000 --- a/dist/graphql.constants.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.RESOLVER_TYPE_METADATA = 'graphql:resolver_type'; -exports.RESOLVER_NAME_METADATA = 'graphql:resolver_name'; -exports.RESOLVER_PROPERTY_METADATA = 'graphql:resolve_property'; -exports.RESOLVER_DELEGATE_METADATA = 'graphql:delegate_property'; diff --git a/dist/graphql.factory.d.ts b/dist/graphql.factory.d.ts deleted file mode 100644 index 486badfbf..000000000 --- a/dist/graphql.factory.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ResolversExplorerService } from './resolvers-explorer.service'; -import { - IExecutableSchemaDefinition, - MergeInfo, -} from 'graphql-tools/dist/Interfaces'; -export declare class GraphQLFactory { - private readonly resolversExplorerService; - constructor(resolversExplorerService: ResolversExplorerService); - createSchema(schemaDefintion?: IExecutableSchemaDefinition): any; - createDelegates(): (mergeInfo: MergeInfo) => any; - mergeTypesByPaths(...pathsToTypes: string[]): string; - private loadFiles(pattern); -} diff --git a/dist/graphql.factory.js b/dist/graphql.factory.js deleted file mode 100644 index 3e40463f4..000000000 --- a/dist/graphql.factory.js +++ /dev/null @@ -1,71 +0,0 @@ -'use strict'; -var __decorate = - (this && this.__decorate) || - function(decorators, target, key, desc) { - var c = arguments.length, - r = - c < 3 - ? target - : desc === null - ? (desc = Object.getOwnPropertyDescriptor(target, key)) - : desc, - d; - if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function') - r = Reflect.decorate(decorators, target, key, desc); - else - for (var i = decorators.length - 1; i >= 0; i--) - if ((d = decorators[i])) - r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; -var __metadata = - (this && this.__metadata) || - function(k, v) { - if (typeof Reflect === 'object' && typeof Reflect.metadata === 'function') - return Reflect.metadata(k, v); - }; -Object.defineProperty(exports, '__esModule', { value: true }); -const glob = require('glob'); -const fs = require('fs'); -const common_1 = require('@nestjs/common'); -const graphql_tools_1 = require('graphql-tools'); -const merge_graphql_schemas_1 = require('merge-graphql-schemas'); -const resolvers_explorer_service_1 = require('./resolvers-explorer.service'); -let GraphQLFactory = class GraphQLFactory { - constructor(resolversExplorerService) { - this.resolversExplorerService = resolversExplorerService; - } - createSchema(schemaDefintion = { typeDefs: [] }) { - return graphql_tools_1.makeExecutableSchema( - Object.assign({}, schemaDefintion, { - resolvers: Object.assign( - {}, - this.resolversExplorerService.explore(), - schemaDefintion.resolvers || {}, - ), - }), - ); - } - createDelegates() { - return this.resolversExplorerService.exploreDelegates(); - } - mergeTypesByPaths(...pathsToTypes) { - return merge_graphql_schemas_1.mergeTypes( - ...pathsToTypes.map(pattern => this.loadFiles(pattern)), - ); - } - loadFiles(pattern) { - const paths = glob.sync(pattern); - return paths.map(path => fs.readFileSync(path, 'utf8')); - } -}; -GraphQLFactory = __decorate( - [ - common_1.Injectable(), - __metadata('design:paramtypes', [ - resolvers_explorer_service_1.ResolversExplorerService, - ]), - ], - GraphQLFactory, -); -exports.GraphQLFactory = GraphQLFactory; diff --git a/dist/graphql.module.d.ts b/dist/graphql.module.d.ts deleted file mode 100644 index 8660db1e3..000000000 --- a/dist/graphql.module.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare class GraphQLModule {} diff --git a/dist/graphql.module.js b/dist/graphql.module.js deleted file mode 100644 index d43296940..000000000 --- a/dist/graphql.module.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; -var __decorate = - (this && this.__decorate) || - function(decorators, target, key, desc) { - var c = arguments.length, - r = - c < 3 - ? target - : desc === null - ? (desc = Object.getOwnPropertyDescriptor(target, key)) - : desc, - d; - if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function') - r = Reflect.decorate(decorators, target, key, desc); - else - for (var i = decorators.length - 1; i >= 0; i--) - if ((d = decorators[i])) - r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -const common_1 = require('@nestjs/common'); -const metadata_scanner_1 = require('@nestjs/core/metadata-scanner'); -const graphql_factory_1 = require('./graphql.factory'); -const resolvers_explorer_service_1 = require('./resolvers-explorer.service'); -let GraphQLModule = class GraphQLModule {}; -GraphQLModule = __decorate( - [ - common_1.Module({ - providers: [ - graphql_factory_1.GraphQLFactory, - metadata_scanner_1.MetadataScanner, - resolvers_explorer_service_1.ResolversExplorerService, - ], - exports: [ - graphql_factory_1.GraphQLFactory, - resolvers_explorer_service_1.ResolversExplorerService, - ], - }), - ], - GraphQLModule, -); -exports.GraphQLModule = GraphQLModule; diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 2c314a4dd..000000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export * from './graphql.module'; -export * from './graphql.factory'; -export { - ResolveProperty, - DelegateProperty, - Resolver, - Query, - Mutation, - Subscription, -} from './decorators/resolvers.decorators'; diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 844f90596..000000000 --- a/dist/index.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, '__esModule', { value: true }); -__export(require('./graphql.module')); -__export(require('./graphql.factory')); -var resolvers_decorators_1 = require('./decorators/resolvers.decorators'); -exports.ResolveProperty = resolvers_decorators_1.ResolveProperty; -exports.DelegateProperty = resolvers_decorators_1.DelegateProperty; -exports.Resolver = resolvers_decorators_1.Resolver; -exports.Query = resolvers_decorators_1.Query; -exports.Mutation = resolvers_decorators_1.Mutation; -exports.Subscription = resolvers_decorators_1.Subscription; diff --git a/dist/package.json b/dist/package.json deleted file mode 100644 index 939f50fd4..000000000 --- a/dist/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "@nestjs/graphql", - "version": "2.0.0", - "description": - "Nest - modern, fast, powerful node.js web framework (@graphql)", - "author": "Kamil Mysliwiec", - "license": "MIT", - "dependencies": { - "glob": "^7.1.2", - "lodash": "^4.17.4", - "merge-graphql-schemas": "^1.3.0" - }, - "peerDependencies": { - "@nestjs/common": "^5.*", - "@nestjs/core": "^5.*", - "graphql": "^0.11.7", - "graphql-tools": "^2.11.0" - } -} diff --git a/dist/resolvers-explorer.service.d.ts b/dist/resolvers-explorer.service.d.ts deleted file mode 100644 index abc82e3e1..000000000 --- a/dist/resolvers-explorer.service.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { MetadataScanner } from '@nestjs/core/metadata-scanner'; -import { ExternalContextCreator } from '@nestjs/core/helpers/external-context-creator'; -import { ModulesContainer } from '@nestjs/core/injector/modules-container'; -import { MergeInfo } from 'graphql-tools/dist/Interfaces'; -export interface ResolverMetadata { - name: string; - type: string; - methodName: string; - callback?: Function; -} -export declare class ResolversExplorerService { - private readonly modulesContainer; - private readonly metadataScanner; - private readonly externalContextCreator; - constructor( - modulesContainer: ModulesContainer, - metadataScanner: MetadataScanner, - externalContextCreator: ExternalContextCreator, - ); - explore(): any; - flatMap( - modules: Map[], - callback: (instance: any) => ResolverMetadata[], - ): any; - filterResolvers(instance: Object): ResolverMetadata[]; - exploreDelegates(): (mergeInfo: MergeInfo) => any; - filterDelegates(instance: Object): ResolverMetadata[]; - extractMetadata( - instance: any, - prototype: any, - methodName: string, - filterPredicate: (resolverType: string, isDelegated: boolean) => boolean, - ): ResolverMetadata; - groupMetadata(resolvers: ResolverMetadata[]): any; - curryDelegates(delegates: any): (mergeInfo: MergeInfo) => any; -} diff --git a/dist/resolvers-explorer.service.js b/dist/resolvers-explorer.service.js deleted file mode 100644 index 38b555198..000000000 --- a/dist/resolvers-explorer.service.js +++ /dev/null @@ -1,158 +0,0 @@ -'use strict'; -var __decorate = - (this && this.__decorate) || - function(decorators, target, key, desc) { - var c = arguments.length, - r = - c < 3 - ? target - : desc === null - ? (desc = Object.getOwnPropertyDescriptor(target, key)) - : desc, - d; - if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function') - r = Reflect.decorate(decorators, target, key, desc); - else - for (var i = decorators.length - 1; i >= 0; i--) - if ((d = decorators[i])) - r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; -var __metadata = - (this && this.__metadata) || - function(k, v) { - if (typeof Reflect === 'object' && typeof Reflect.metadata === 'function') - return Reflect.metadata(k, v); - }; -Object.defineProperty(exports, '__esModule', { value: true }); -const common_1 = require('@nestjs/common'); -const metadata_scanner_1 = require('@nestjs/core/metadata-scanner'); -const external_context_creator_1 = require('@nestjs/core/helpers/external-context-creator'); -const modules_container_1 = require('@nestjs/core/injector/modules-container'); -const shared_utils_1 = require('@nestjs/common/utils/shared.utils'); -const lodash_1 = require('lodash'); -const graphql_constants_1 = require('./graphql.constants'); -let ResolversExplorerService = class ResolversExplorerService { - constructor(modulesContainer, metadataScanner, externalContextCreator) { - this.modulesContainer = modulesContainer; - this.metadataScanner = metadataScanner; - this.externalContextCreator = externalContextCreator; - } - explore() { - const modules = [...this.modulesContainer.values()].map( - module => module.components, - ); - const resolvers = this.flatMap(modules, instance => - this.filterResolvers(instance), - ); - return this.groupMetadata(resolvers); - } - flatMap(modules, callback) { - return lodash_1.flattenDeep( - modules.map(module => - [...module.values()].map(({ instance }) => callback(instance)), - ), - ); - } - filterResolvers(instance) { - const prototype = Object.getPrototypeOf(instance); - const predicate = (resolverType, isDelegated) => - shared_utils_1.isUndefined(resolverType) || isDelegated; - const resolvers = this.metadataScanner.scanFromPrototype( - instance, - prototype, - name => this.extractMetadata(instance, prototype, name, predicate), - ); - return resolvers.filter(resolver => !!resolver).map(resolver => { - if (resolver.type === 'Subscription') { - return Object.assign({}, resolver, { - callback: instance[resolver.methodName](), - }); - } - const resolverCallback = this.externalContextCreator.create( - instance, - prototype[resolver.methodName], - resolver.methodName, - ); - return Object.assign({}, resolver, { callback: resolverCallback }); - }); - } - exploreDelegates() { - const modules = [...this.modulesContainer.values()].map( - module => module.components, - ); - const delegates = this.flatMap(modules, instance => - this.filterDelegates(instance), - ); - return this.curryDelegates(this.groupMetadata(delegates)); - } - filterDelegates(instance) { - const prototype = Object.getPrototypeOf(instance); - const predicate = (resolverType, isDelegated) => !isDelegated; - const resolvers = this.metadataScanner.scanFromPrototype( - instance, - prototype, - name => this.extractMetadata(instance, prototype, name, predicate), - ); - return resolvers.filter(resolver => !!resolver).map(resolver => { - const callback = instance[resolver.methodName].bind(instance); - return Object.assign({}, resolver, { callback }); - }); - } - extractMetadata(instance, prototype, methodName, filterPredicate) { - const callback = prototype[methodName]; - const resolverType = - Reflect.getMetadata( - graphql_constants_1.RESOLVER_TYPE_METADATA, - callback, - ) || - Reflect.getMetadata( - graphql_constants_1.RESOLVER_TYPE_METADATA, - instance.constructor, - ); - const resolverName = Reflect.getMetadata( - graphql_constants_1.RESOLVER_NAME_METADATA, - callback, - ); - const isDelegated = !!Reflect.getMetadata( - graphql_constants_1.RESOLVER_DELEGATE_METADATA, - callback, - ); - if (filterPredicate(resolverType, isDelegated)) { - return null; - } - return { - name: resolverName || methodName, - type: resolverType, - methodName, - }; - } - groupMetadata(resolvers) { - const groupByType = lodash_1.groupBy(resolvers, metadata => metadata.type); - return lodash_1.mapValues(groupByType, resolversArr => - resolversArr.reduce((prev, curr) => { - return Object.assign({}, prev, { [curr.name]: curr.callback }); - }, {}), - ); - } - curryDelegates(delegates) { - return mergeInfo => - lodash_1.mapValues(delegates, parent => - lodash_1.mapValues(parent, (propertyFn, key) => - propertyFn()(mergeInfo), - ), - ); - } -}; -ResolversExplorerService = __decorate( - [ - common_1.Injectable(), - __metadata('design:paramtypes', [ - modules_container_1.ModulesContainer, - metadata_scanner_1.MetadataScanner, - external_context_creator_1.ExternalContextCreator, - ]), - ], - ResolversExplorerService, -); -exports.ResolversExplorerService = ResolversExplorerService; diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 000000000..5703fb5fd --- /dev/null +++ b/index.d.ts @@ -0,0 +1 @@ +export * from './dist'; diff --git a/index.js b/index.js new file mode 100644 index 000000000..9368dd397 --- /dev/null +++ b/index.js @@ -0,0 +1,6 @@ +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./dist")); diff --git a/index.ts b/index.ts new file mode 100644 index 000000000..5703fb5fd --- /dev/null +++ b/index.ts @@ -0,0 +1 @@ +export * from './dist'; diff --git a/package.json b/package.json index f068e88e7..f343eef47 100644 --- a/package.json +++ b/package.json @@ -1,34 +1,39 @@ { "name": "@nestjs/graphql", - "version": "2.0.0", + "version": "3.0.0", "description": "Nest - modern, fast, powerful node.js web framework (@graphql)", "author": "Kamil Mysliwiec", "license": "MIT", "scripts": { "build": "tsc -p tsconfig.json", - "precommit": "lint-staged" - }, - "dependencies": { - "@nestjs/common": "^4.3.0", - "@nestjs/core": "^4.3.0", - "glob": "^7.1.2", - "graphql": "^0.11.7", - "graphql-tools": "^2.11.0", - "lodash": "^4.17.4", - "merge-graphql-schemas": "^1.3.0", - "reflect-metadata": "^0.1.10", - "rxjs": "^5.5.5", - "typescript": "^2.4.2" + "precommit": "lint-staged", + "prepublish:npm": "npm run build", + "publish:npm": "npm publish --access public" }, "devDependencies": { "@types/node": "^7.0.41", "husky": "^0.14.3", "lint-staged": "^7.0.0", "prettier": "^1.11.1", - "ts-node": "^3.3.0" + "ts-node": "^3.3.0", + "typescript": "^2.8.0" + }, + "dependencies": { + "glob": "^7.1.2", + "lodash": "^4.17.4", + "merge-graphql-schemas": "^1.3.0" + }, + "peerDependencies": { + "@nestjs/common": "^5.0.0", + "@nestjs/core": "^5.0.0", + "graphql": "^0.11.7", + "graphql-tools": "^2.11.0" }, "lint-staged": { - "*.{js,ts,json,css,md}": ["prettier --write", "git add"] + "*.ts": [ + "prettier --write", + "git add" + ] } }