Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
fix: build and execution in node-graphql-ts template
Browse files Browse the repository at this point in the history
  • Loading branch information
juanlatorre committed May 18, 2022
1 parent dee9618 commit 31b64e9
Show file tree
Hide file tree
Showing 10 changed files with 164 additions and 55 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-fast-app",
"version": "0.3.0",
"version": "0.3.1",
"description": "A cli app to create a new project with a lot of templates",
"type": "module",
"main": "./lib/src/bin.js",
Expand Down
176 changes: 142 additions & 34 deletions templates/node-graphql-ts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 12 additions & 11 deletions templates/node-graphql-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@
"description": "Node.js (Fastify) + GraphQL Yoga + Prisma + Typescript application",
"license": "MIT",
"type": "module",
"main": "src/server.ts",
"types": "src/server.ts",
"main": "dist/server.js",
"scripts": {
"check:format": "prettier --check \"**/*.{ts,gql,json,yml,yaml}\"",
"clean:install": "npx rimraf \"**/{node_modules}\" package-lock.json && npm i && npm run generate",
"dev:script": "cross-env NODE_ENV=development bob-watch -w src -c \"bob-tsm src/server.ts\"",
"dev": "concurrently -r npm:dev:script npm:tsc:watch",
"build:watch": "bob-ts-watch -i src -c \"npm run dev:script\"",
"build": "bob-ts -i src",
"check:format": "prettier --check \"**/*.{ts,graphql,json,yml,yaml}\"",
"clean:install": "npx rimraf \"**/{node_modules,dist}\" package-lock.json && npm i && npm run generate",
"dev:script": "cross-env NODE_ENV=development node dist/server.js",
"dev": "cross-env NODE_ENV=development concurrently -r npm:generate npm:tsc:watch npm:build:watch",
"codegen": "graphql-codegen --watch",
"generate": "prisma generate",
"husky:install": "husky install",
"lint": "eslint . --ext .ts",
"predev": "npm run generate",
"prepare": "husky install",
"prepare": "is-ci || concurrently npm:husky:install npm:build npm:generate",
"pretty:all": "prettier --write \"**/*.{ts,gql,json,yml,yaml}\"",
"start": "cross-env NODE_ENV=production bob-tsm src/server.ts",
"start": "cross-env NODE_ENV=production node dist/server.js",
"tsc:watch": "tsc --watch",
"tsc": "tsc"
},
Expand All @@ -44,14 +45,14 @@
"@types/node": "^17.0.33",
"@typescript-eslint/eslint-plugin": "^5.23.0",
"@typescript-eslint/parser": "^5.23.0",
"bob-tsm": "^0.4.8",
"bob-watch": "^0.1.1",
"bob-ts": "^4.0.0",
"concurrently": "^7.2.0",
"cross-env": "^7.0.3",
"esbuild": "0.14.39",
"eslint": "^8.15.0",
"eslint-config-prettier": "^8.5.0",
"husky": "^8.0.1",
"is-ci": "^3.0.1",
"prettier": "^2.6.2",
"typescript": "^4.6.4"
},
Expand Down
2 changes: 1 addition & 1 deletion templates/node-graphql-ts/src/modules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { makeExecutableSchema } from "@graphql-tools/schema";

export const schema = makeExecutableSchema({
typeDefs: await loadFiles("./**/schema.graphql"),
resolvers: await loadFiles("./**/{mutation,query,definition}/index.ts"),
resolvers: await loadFiles("./**/{mutation,query,resolvers}/index.js"),
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MutationResolvers } from "../../../types.generated";

export const createUser: MutationResolvers["createUser"] = async (
const createUser: MutationResolvers["createUser"] = async (
_parent,
{ input },
ctx,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MutationResolvers } from "../../../types.generated";

export const deleteUser: MutationResolvers["deleteUser"] = async (
const deleteUser: MutationResolvers["deleteUser"] = async (
_parent,
{ id },
ctx,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MutationResolvers } from "../../../types.generated";

export const updateUser: MutationResolvers["updateUser"] = async (
const updateUser: MutationResolvers["updateUser"] = async (
_parent,
{ input },
ctx,
Expand Down
2 changes: 1 addition & 1 deletion templates/node-graphql-ts/src/modules/users/query/user.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { QueryResolvers } from "../../../types.generated";

export const user: QueryResolvers["user"] = async (_parent, { id }, ctx) => {
const user: QueryResolvers["user"] = async (_parent, { id }, ctx) => {
return await ctx.prisma.user.findUnique({
where: {
id,
Expand Down
2 changes: 1 addition & 1 deletion templates/node-graphql-ts/src/modules/users/query/users.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { QueryResolvers } from "../../../types.generated";

export const users: QueryResolvers["users"] = async (_parent, _args, ctx) => {
const users: QueryResolvers["users"] = async (_parent, _args, ctx) => {
return await ctx.prisma.user.findMany({
orderBy: {
id: "asc",
Expand Down
Loading

0 comments on commit 31b64e9

Please sign in to comment.