Skip to content
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

chore: make nugget quiet by default #16147

Merged
merged 2 commits into from Dec 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 18 additions & 14 deletions script/release.js
Expand Up @@ -2,7 +2,15 @@

if (!process.env.CI) require('dotenv-safe').load()
require('colors')
const args = require('minimist')(process.argv.slice(2))
const args = require('minimist')(process.argv.slice(2), {
boolean: [
'validateRelease',
'skipVersionCheck',
'automaticRelease',
'verboseNugget'
],
default: { 'verboseNugget': false }
})
const fs = require('fs')
const { execSync } = require('child_process')
const GitHub = require('github')
Expand Down Expand Up @@ -307,7 +315,7 @@ async function verifyAssets (release) {
let filesToCheck = await Promise.all(release.assets.map(async (asset) => {
githubOpts.id = asset.id
const assetDetails = await github.repos.getAsset(githubOpts)
await downloadFiles(assetDetails.meta.location, downloadDir, false, asset.name)
await downloadFiles(assetDetails.meta.location, downloadDir, asset.name)
return asset.name
})).catch(err => {
console.log(`${fail} Error downloading files from GitHub`, err)
Expand All @@ -325,21 +333,17 @@ async function verifyAssets (release) {
})
}

function downloadFiles (urls, directory, quiet, targetName) {
function downloadFiles (urls, directory, targetName) {
return new Promise((resolve, reject) => {
const nuggetOpts = {
dir: directory
}
if (quiet) {
nuggetOpts.quiet = quiet
}
if (targetName) {
nuggetOpts.target = targetName
}
const nuggetOpts = { dir: directory }
nuggetOpts.quiet = !args.verboseNugget
if (targetName) nuggetOpts.target = targetName

nugget(urls, nuggetOpts, (err) => {
if (err) {
reject(err)
} else {
console.log(`${pass} all files downloaded successfully!`)
resolve()
}
})
Expand Down Expand Up @@ -369,7 +373,7 @@ async function verifyShasums (urls, isS3) {
if (s3VersionPathIdx !== -1 && filename.indexof('SHASUMS') === -1) {
filesToCheck.push(filename)
}
await downloadFiles(url, downloadDir, true)
await downloadFiles(url, downloadDir)
} else {
const subDirectory = dirname.substr(s3VersionPathIdx + s3VersionPath.length)
const fileDirectory = path.join(downloadDir, subDirectory)
Expand All @@ -379,7 +383,7 @@ async function verifyShasums (urls, isS3) {
fs.mkdirSync(fileDirectory)
}
filesToCheck.push(path.join(subDirectory, filename))
await downloadFiles(url, fileDirectory, true)
await downloadFiles(url, fileDirectory)
}
}))
}
Expand Down