Skip to content

Commit

Permalink
migrate react-fullstack-basic to prisma-client
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolasburk committed Dec 6, 2018
1 parent e383c21 commit f9ab2eb
Show file tree
Hide file tree
Showing 23 changed files with 7,920 additions and 6,579 deletions.
6 changes: 3 additions & 3 deletions basic/.install/index.js
Expand Up @@ -14,12 +14,12 @@ module.exports = async ({ project, projectDir }) => {

process.chdir('server/')
replaceInFiles(
['src/index.js', 'package.json', 'database/prisma.yml'],
['src/index.js', 'package.json', 'prisma/prisma.yml'],
templateName,
project,
)
replaceInFiles(['src/index.js'], '__PRISMA_ENDPOINT__', endpoint)
replaceInFiles(['database/prisma.yml'], '__PRISMA_ENDPOINT__', endpoint)
replaceInFiles(['prisma/prisma.yml'], '__PRISMA_ENDPOINT__', endpoint)

console.log('Running $ prisma deploy...')

Expand All @@ -29,7 +29,7 @@ module.exports = async ({ project, projectDir }) => {
process.chdir('../')

replaceInFiles(
['server/src/index.js'],
['server/src/generated/prisma-client/index.js'],
'__PRISMA_ENDPOINT__',
info.httpEndpoint,
)
Expand Down
12 changes: 9 additions & 3 deletions basic/package.json
Expand Up @@ -2,11 +2,11 @@
"name": "react-fullstack-basic",
"version": "1.0.0",
"devDependencies": {
"react-scripts": "1.1.5"
"react-scripts": "2.1.1"
},
"dependencies": {
"apollo-boost": "0.1.22",
"graphql": "0.13.2",
"graphql": "14.0.2",
"react": "16.6.3",
"react-apollo": "2.3.2",
"react-dom": "16.6.3",
Expand All @@ -19,5 +19,11 @@
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
3 changes: 2 additions & 1 deletion basic/server/.gitignore
Expand Up @@ -4,4 +4,5 @@ package-lock.json
node_modules
.idea
.vscode
*.log
*.log
yarn.lock
10 changes: 0 additions & 10 deletions basic/server/.graphqlconfig.yml

This file was deleted.

6 changes: 0 additions & 6 deletions basic/server/database/datamodel.graphql

This file was deleted.

20 changes: 0 additions & 20 deletions basic/server/database/prisma.yml

This file was deleted.

25 changes: 0 additions & 25 deletions basic/server/database/seed.graphql

This file was deleted.

8 changes: 2 additions & 6 deletions basic/server/package.json
Expand Up @@ -2,17 +2,13 @@
"name": "graphql-boilerplate",
"scripts": {
"start": "node src/index.js",
"dev": "npm-run-all --parallel start playground",
"playground": "graphql playground",
"prisma": "prisma"
},
"dependencies": {
"graphql-yoga": "1.16.7",
"prisma-binding": "1.5.19"
"prisma-client-lib": "1.22.1"
},
"devDependencies": {
"graphql-cli": "2.17.0",
"npm-run-all": "4.1.5",
"prisma": "1.7.1"
"prisma": "1.22.1"
}
}
6 changes: 6 additions & 0 deletions basic/server/prisma/datamodel.prisma
@@ -0,0 +1,6 @@
type Post {
id: ID! @unique
published: Boolean! @default(value: "false")
title: String!
content: String!
}
23 changes: 23 additions & 0 deletions basic/server/prisma/prisma.yml
@@ -0,0 +1,23 @@
# Specifies the HTTP endpoint of your Prisma API (deployed to a Prisma Demo server).
endpoint: __PRISMA_ENDPOINT__

# Defines your models, each model is mapped to the database as a table.
datamodel: datamodel.prisma

# Specifies the language and directory for the generated Prisma client.
generate:
- generator: javascript-client
output: ../src/generated/prisma-client

seed:
import: seed.graphql

# Ensures Prisma client is re-generated after a datamodel change.
hooks:
post-deploy:
- prisma generate

# If specified, the `secret` must be used to generate a JWT which is attached
# to the `Authorization` header of HTTP requests made against the Prisma API.
# Info: https://www.prisma.io/docs/prisma-graphql-api/reference/authentication-ghd4/
# secret: mysecret123
30 changes: 30 additions & 0 deletions basic/server/prisma/seed.graphql
@@ -0,0 +1,30 @@
mutation {
post1: createPost(
data: {
title: "Join us for GraphQL Conf 2019 in Berlin"
content: "https://www.graphqlconf.org/"
published: true
}
) {
id
}

post2: createPost(
data: {
title: "Subscribe to GraphQL Weekly for community news"
content: "https://graphqlweekly.com/"
published: true
}
) {
id
}

post3: createPost(
data: {
title: "Follow Prisma on Twitter"
content: "https://twitter.com/prisma"
}
) {
id
}
}

0 comments on commit f9ab2eb

Please sign in to comment.