Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #320 from input-output-hk/docs-update
Bump `cardano-graphql` dep to `1.0.0`,
- Loading branch information
Showing
9 changed files
with
63 additions
and
95 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 |
---|---|---|
|
@@ -2,4 +2,4 @@ Changelog | |
========= | ||
|
||
## 1.0.0 | ||
First release | ||
First production-ready release. |
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
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
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,41 +1,42 @@ | ||
const { spawn } = require('child_process'); | ||
const upload = require('./upload'); | ||
const fs = require('fs'); | ||
const AWS = require('aws-sdk'); | ||
const readdir = require('recursive-readdir'); | ||
const mime = require('mime-types'); | ||
|
||
module.exports = async function deploy() { | ||
const requiredEnvs = [ | ||
'CARDANO_ERA', | ||
'CARDANO_NETWORK', | ||
'GRAPHQL_API_PROTOCOL', | ||
'GRAPHQL_API_HOST', | ||
'GRAPHQL_API_PORT' | ||
'AWS_ACCESS_KEY_ID', | ||
'AWS_SECRET_ACCESS_KEY', | ||
'AWS_DEFAULT_REGION', | ||
'BUCKET' | ||
]; | ||
|
||
requiredEnvs.forEach(env => { | ||
const val = process.env[env]; | ||
if (!val) { | ||
throw new Error(`Missing ${env} from the environment`); | ||
} | ||
|
||
console.log(`${env} = ${val}`); | ||
}); | ||
|
||
const builder = spawn(`yarn`, ['static:build'], { | ||
stdio: ['inherit', 'inherit', 'inherit'], | ||
env: { | ||
PATH: process.env.PATH, | ||
...process.env | ||
} | ||
}); | ||
const targetBucket = process.env.BUCKET | ||
|
||
await new Promise((resolve, reject) => { | ||
builder.on('close', (code) => { | ||
if (code !== 0) { | ||
reject(new Error('Compilation failed')); | ||
} | ||
const uploadFolder = './build/static'; | ||
const s3 = new AWS.S3(); | ||
|
||
resolve(); | ||
}) | ||
}); | ||
const filesToUpload = await readdir(uploadFolder); | ||
|
||
console.log(`Uploading to S3 bucket: ${targetBucket}`); | ||
|
||
return filesToUpload.map(async (file) => { | ||
const key = file.replace('build/static/', ''); | ||
const fileBuffer = fs.readFileSync(file); | ||
|
||
await upload(); | ||
return s3.upload({ | ||
Key: key, | ||
Bucket: targetBucket, | ||
Body: fileBuffer, | ||
ContentType: mime.lookup(key) || 'application/octet-stream' | ||
}).promise(); | ||
}) | ||
}; |
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
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
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