Skip to content

Commit 7b475a6

Browse files
committed
fix: prepare for prisma 1.7
1 parent 58cae24 commit 7b475a6

File tree

6 files changed

+52
-30
lines changed

6 files changed

+52
-30
lines changed

advanced/.install/index.js

Lines changed: 13 additions & 18 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(
13-
['src/index.js', 'package.json', 'database/prisma.yml'],
17+
['src/index.ts', '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/.install/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"name": "install",
33
"version": "0.0.0",
44
"devDependencies": {
5-
"graphql-boilerplate-install": "0.1.8"
5+
"graphql-boilerplate-install": "0.1.9"
66
}
77
}

advanced/.install/yarn.lock

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ cross-spawn@5.1.0, cross-spawn@^5.1.0:
1414
shebang-command "^1.2.0"
1515
which "^1.2.9"
1616

17-
graphql-boilerplate-install@0.1.8:
18-
version "0.1.8"
19-
resolved "https://registry.yarnpkg.com/graphql-boilerplate-install/-/graphql-boilerplate-install-0.1.8.tgz#7d71b3f5908d968aaa77c524765cc1b4d7bec348"
17+
graphql-boilerplate-install@0.1.9:
18+
version "0.1.9"
19+
resolved "https://registry.yarnpkg.com/graphql-boilerplate-install/-/graphql-boilerplate-install-0.1.9.tgz#bcd7e8dbb2b685820e78a76a5dbb6f24fcadf2c8"
2020
dependencies:
2121
cross-spawn "5.1.0"
22+
node-fetch "^2.1.2"
2223
npm-run "4.1.2"
24+
sillyname "^0.1.0"
2325

2426
isexe@^2.0.0:
2527
version "2.0.0"
@@ -36,6 +38,10 @@ minimist@^1.2.0:
3638
version "1.2.0"
3739
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
3840

41+
node-fetch@^2.1.2:
42+
version "2.1.2"
43+
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.1.2.tgz#ab884e8e7e57e38a944753cec706f788d1768bb5"
44+
3945
npm-path@^2.0.2, npm-path@^2.0.3:
4046
version "2.0.4"
4147
resolved "https://registry.yarnpkg.com/npm-path/-/npm-path-2.0.4.tgz#c641347a5ff9d6a09e4d9bce5580c4f505278e64"
@@ -85,6 +91,10 @@ shebang-regex@^1.0.0:
8591
version "1.0.0"
8692
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
8793

94+
sillyname@^0.1.0:
95+
version "0.1.0"
96+
resolved "https://registry.yarnpkg.com/sillyname/-/sillyname-0.1.0.tgz#cfd98858e2498671347775efe3bb5141f46c87d6"
97+
8898
sync-exec@^0.6.2:
8999
version "0.6.2"
90100
resolved "https://registry.yarnpkg.com/sync-exec/-/sync-exec-0.6.2.tgz#717d22cc53f0ce1def5594362f3a89a2ebb91105"

basic/.install/index.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,29 @@ const {
99
module.exports = async ({ project, projectDir }) => {
1010
const templateName = 'graphql-boilerplate'
1111

12+
const endpoint = await makeSandboxEndpoint(project)
13+
14+
process.chdir('server/')
1215
replaceInFiles(
13-
['server/src/index.js', 'server/package.json', 'server/database/prisma.yml'],
16+
['src/index.ts', 'package.json', 'database/prisma.yml'],
1417
templateName,
1518
project,
1619
)
20+
replaceInFiles(['src/index.ts'], '__PRISMA_ENDPOINT__', endpoint)
21+
replaceInFiles(['database/prisma.yml'], '__PRISMA_ENDPOINT__', endpoint)
1722

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

20-
process.chdir('server/')
21-
2225
await deploy(false)
2326
const info = await getInfo()
2427

2528
process.chdir('../')
2629

27-
replaceInFiles(['server/src/index.js'], '__PRISMA_ENDPOINT__', info.httpEndpoint)
30+
replaceInFiles(
31+
['server/src/index.js'],
32+
'__PRISMA_ENDPOINT__',
33+
info.httpEndpoint,
34+
)
2835

2936
console.log(`\
3037
Next steps:

basic/.install/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"name": "install",
33
"version": "0.0.0",
44
"devDependencies": {
5-
"graphql-boilerplate-install": "0.1.8"
5+
"graphql-boilerplate-install": "0.1.9"
66
}
77
}

basic/.install/yarn.lock

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ cross-spawn@5.1.0, cross-spawn@^5.1.0:
1414
shebang-command "^1.2.0"
1515
which "^1.2.9"
1616

17-
graphql-boilerplate-install@0.1.8:
18-
version "0.1.8"
19-
resolved "https://registry.yarnpkg.com/graphql-boilerplate-install/-/graphql-boilerplate-install-0.1.8.tgz#7d71b3f5908d968aaa77c524765cc1b4d7bec348"
17+
graphql-boilerplate-install@0.1.9:
18+
version "0.1.9"
19+
resolved "https://registry.yarnpkg.com/graphql-boilerplate-install/-/graphql-boilerplate-install-0.1.9.tgz#bcd7e8dbb2b685820e78a76a5dbb6f24fcadf2c8"
2020
dependencies:
2121
cross-spawn "5.1.0"
22+
node-fetch "^2.1.2"
2223
npm-run "4.1.2"
24+
sillyname "^0.1.0"
2325

2426
isexe@^2.0.0:
2527
version "2.0.0"
@@ -36,6 +38,10 @@ minimist@^1.2.0:
3638
version "1.2.0"
3739
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
3840

41+
node-fetch@^2.1.2:
42+
version "2.1.2"
43+
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.1.2.tgz#ab884e8e7e57e38a944753cec706f788d1768bb5"
44+
3945
npm-path@^2.0.2, npm-path@^2.0.3:
4046
version "2.0.4"
4147
resolved "https://registry.yarnpkg.com/npm-path/-/npm-path-2.0.4.tgz#c641347a5ff9d6a09e4d9bce5580c4f505278e64"
@@ -85,6 +91,10 @@ shebang-regex@^1.0.0:
8591
version "1.0.0"
8692
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
8793

94+
sillyname@^0.1.0:
95+
version "0.1.0"
96+
resolved "https://registry.yarnpkg.com/sillyname/-/sillyname-0.1.0.tgz#cfd98858e2498671347775efe3bb5141f46c87d6"
97+
8898
sync-exec@^0.6.2:
8999
version "0.6.2"
90100
resolved "https://registry.yarnpkg.com/sync-exec/-/sync-exec-0.6.2.tgz#717d22cc53f0ce1def5594362f3a89a2ebb91105"

0 commit comments

Comments
 (0)