Skip to content

Commit 0d4a1b0

Browse files
authored
Merge pull request #316 from graphql-boilerplates/prisma-1.7
Prisma 1.7
2 parents cf9ee68 + 8b19ae3 commit 0d4a1b0

File tree

10 files changed

+352
-103
lines changed

10 files changed

+352
-103
lines changed

advanced/.install/index.js

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,34 @@ const {
44
deploy,
55
writeEnv,
66
getInfo,
7+
makeSandboxEndpoint,
78
} = require('graphql-boilerplate-install')
89

910
module.exports = async ({ project, projectDir }) => {
1011
const templateName = 'graphql-boilerplate'
1112

13+
const endpoint = await makeSandboxEndpoint(project)
14+
15+
process.chdir('server/')
1216
replaceInFiles(
1317
['src/index.js', 'package.json', 'database/prisma.yml'],
1418
templateName,
1519
project,
1620
)
21+
replaceInFiles(['.env'], '__PRISMA_ENDPOINT__', endpoint)
1722

1823
console.log('Running $ prisma deploy...')
1924
await deploy(false)
25+
process.chdir('../')
2026

21-
const info = await getInfo()
22-
const cluster = info.workspace
23-
? `${info.workspace}/${info.cluster}`
24-
: info.cluster
25-
26-
replaceInFiles(['.env'], '__PRISMA_ENDPOINT__', info.httpEndpoint)
27-
28-
replaceInFiles(['.env'], `__PRISMA_CLUSTER__`, cluster)
29-
replaceInFiles(
30-
['database/prisma.yml'],
31-
`cluster: ${cluster}`,
32-
'cluster: ${env:PRISMA_CLUSTER}',
33-
)
34-
35-
fs.appendFileSync('.gitignore', '.env*\n')
27+
fs.appendFileSync('server/.gitignore', '.env*\n')
3628

3729
console.log(`\
3830
Next steps:
39-
1. Change directory: \`cd ${projectDir}\`
40-
2. Start local server and open Playground: \`yarn dev\`
31+
1. Change directory: \`cd ${projectDir}/server\`
32+
2. Start local server: \`yarn start\` (you can now open a Playground at http://localhost:4000)
33+
3. Change directory: \`cd ..\`
34+
4. Start React app: \`yarn start\`
35+
5. Open browser: http://localhost:3000
4136
`)
4237
}

advanced/server/.env

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
PRISMA_STAGE="dev"
21
PRISMA_ENDPOINT="__PRISMA_ENDPOINT__"
3-
PRISMA_CLUSTER="__PRISMA_CLUSTER__"
42
PRISMA_SECRET="mysecret123"
53
APP_SECRET="jwtsecret123"

advanced/server/database/prisma.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
# the name for the service (will be part of the service's HTTP endpoint)
2-
service: graphql-boilerplate
3-
4-
# the cluster and stage the service is deployed to
5-
stage: ${env:PRISMA_STAGE}
1+
# the endpoint of your service (this also defines the cluster the service will be deployed to)
2+
endpoint: ${env:PRISMA_ENDPOINT}
63

74
# to disable authentication:
85
# disableAuth: true

advanced/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
"graphql-cli": "2.15.9",
1818
"nodemon": "1.17.3",
1919
"npm-run-all": "4.1.2",
20-
"prisma": "1.4.0"
20+
"prisma": "1.7.0"
2121
}
2222
}

0 commit comments

Comments
 (0)