-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6da8fc3
commit a130d7c
Showing
5 changed files
with
153 additions
and
2,700 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,19 +3,18 @@ | |
"version": "0.0.0", | ||
"main": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
"repository": "[email protected]:graphql-boilerplates/graphql-boilerplate-install.git", | ||
"repository": | ||
"[email protected]:graphql-boilerplates/graphql-boilerplate-install.git", | ||
"author": "Johannes Schickling <[email protected]>", | ||
"contributors": [ | ||
"Kim Brandwijk <[email protected]>" | ||
], | ||
"contributors": ["Kim Brandwijk <[email protected]>"], | ||
"license": "MIT", | ||
"scripts": { | ||
"prepublishOnly": "npm run build", | ||
"build": "rimraf dist && tsc -d", | ||
"test": "echo No tests..." | ||
}, | ||
"peerDependencies": { | ||
"graphcool": "1.0.0-beta4.1.1" | ||
"prisma-cli": "beta" | ||
}, | ||
"dependencies": { | ||
"cross-spawn": "5.1.0", | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { replaceInFile, replaceInFiles } from './utils' | ||
export { deploy, writeEnv, getInfo } from './graphcool' | ||
export { deploy, writeEnv, getInfo } from './prisma' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import * as fs from 'fs' | ||
import { spawn } from './utils' | ||
|
||
export async function deploy(silent: boolean) { | ||
const options = { stdio: silent ? 'pipe' : 'inherit' } | ||
|
||
return spawn('prisma', ['deploy'], options) | ||
.then(res => { | ||
if (!silent) { | ||
console.log(res) | ||
} | ||
}) | ||
.catch(err => console.error(err)) | ||
} | ||
|
||
export async function getInfo(): Promise<any> { | ||
return spawn('prisma', ['info', '--current', '--json'], { stdio: 'pipe' }) | ||
.then(res => JSON.parse(res)) | ||
.catch(err => console.error(err)) | ||
} | ||
|
||
export async function writeEnv() { | ||
return spawn('prisma', ['info', '--current', '--json'], { stdio: 'pipe' }) | ||
.then(res => { | ||
const endpointInfo = JSON.parse(res) | ||
fs.writeFileSync( | ||
'.env', | ||
`\ | ||
PRISMA_SECRET=${endpointInfo.secret} | ||
PRISMA_STAGE=${endpointInfo.stage} | ||
PRISMA_CLUSTER=${endpointInfo.cluster} | ||
PRISMA_ENDPOINT=${endpointInfo.httpEndpoint}`, | ||
) | ||
}) | ||
.catch(err => console.error(err)) | ||
} |
Oops, something went wrong.