Skip to content

Add a script for pushing previously-built docs #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"start": "node index.js",
"test:mocha": "mocha -r esm test",
"lint": "eslint lib/**/*.js index.js test/**.js",
"test": "yarn lint && yarn test:mocha"
"test": "yarn lint && yarn test:mocha",
"upload-to-aws": "node -r esm upload-tmp-to-aws.js"
},
"dependencies": {
"cheerio": "^1.0.0-rc.2",
Expand Down
35 changes: 35 additions & 0 deletions upload-tmp-to-aws.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { uploadDocsToS3 } from './lib/s3-sync'
import readline from 'readline'

// Only run this script if you have confirmed that the tmp directory's
// contents render correctly in the ember-api-docs app, using
// `npm run start:local` for the front end.
// There are no safety checks here!
async function uploadPreviouslyBuiltDocsToS3() {
const prompt = readline.createInterface({
input: process.stdin,
output: process.stdout,
})

prompt.question(
'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',
async response => {
if (response === 'yes') {
console.log('Beginning S3 upload of the contents of tmp directory')

await uploadDocsToS3()
.then(() => {
console.log('\n\n\n')
console.log('Done!')
})
.catch(err => {
console.log(err)
process.exit(1)
})
}
prompt.close()
}
)
}

uploadPreviouslyBuiltDocsToS3()