Skip to content

Commit af4f494

Browse files
authored
Merge pull request #120 from ember-learn/jw-jg-publish-aws-docs-script
Add a script for pushing previously-built docs
2 parents 56ea9a5 + aee5cc8 commit af4f494

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"start": "node index.js",
2828
"test:mocha": "mocha -r esm test",
2929
"lint": "eslint lib/**/*.js index.js test/**.js",
30-
"test": "yarn lint && yarn test:mocha"
30+
"test": "yarn lint && yarn test:mocha",
31+
"upload-to-aws": "node -r esm upload-tmp-to-aws.js"
3132
},
3233
"dependencies": {
3334
"cheerio": "^1.0.0-rc.2",

upload-tmp-to-aws.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { uploadDocsToS3 } from './lib/s3-sync'
2+
import readline from 'readline'
3+
4+
// Only run this script if you have confirmed that the tmp directory's
5+
// contents render correctly in the ember-api-docs app, using
6+
// `npm run start:local` for the front end.
7+
// There are no safety checks here!
8+
async function uploadPreviouslyBuiltDocsToS3() {
9+
const prompt = readline.createInterface({
10+
input: process.stdin,
11+
output: process.stdout,
12+
})
13+
14+
prompt.question(
15+
'This command uploads the current contents of the tmp folder to AWS, without building the docs first. Are you sure you want to do this? yes/no \n',
16+
async response => {
17+
if (response === 'yes') {
18+
console.log('Beginning S3 upload of the contents of tmp directory')
19+
20+
await uploadDocsToS3()
21+
.then(() => {
22+
console.log('\n\n\n')
23+
console.log('Done!')
24+
})
25+
.catch(err => {
26+
console.log(err)
27+
process.exit(1)
28+
})
29+
}
30+
prompt.close()
31+
}
32+
)
33+
}
34+
35+
uploadPreviouslyBuiltDocsToS3()

0 commit comments

Comments
 (0)