@neilbmclaughlin/github-secrets
Advanced tools
Comparing version 0.0.4 to 0.0.5
#!/usr/bin/env node | ||
const fs = require('fs') | ||
const chalk = require('chalk') | ||
const readline = require('readline') | ||
@@ -34,4 +35,4 @@ const sodium = require('tweetsodium') | ||
putSecrets(argv.a, argv.filename, argv.o, argv.r) | ||
.then(() => console.log('put successful')) | ||
.catch((err) => console.log(`put failed (${err.message})`)) | ||
.then(() => console.log(chalk.green('put successful'))) | ||
.catch((err) => console.log(`${chalk.red('put failed')} (${chalk.grey(err.message)})`)) | ||
} | ||
@@ -44,4 +45,4 @@ ) | ||
deleteSecrets(argv.a, argv.filename, argv.o, argv.r) | ||
.then(() => console.log('delete successful')) | ||
.catch((err) => console.log(`delete failed (${err.message})`)) | ||
.then(() => console.log(chalk.green('delete successful'))) | ||
.catch((err) => console.log(`${chalk.red('delete failed')} (${chalk.grey(err.message)})`)) | ||
} | ||
@@ -93,13 +94,10 @@ ) | ||
if (type === 'User') { | ||
console.log(`${owner} is a user and a repository has not been specified.\nSecrets can only be stored for repositorys and organisations. `) | ||
return false | ||
throw Error(`${owner} is a user and a repository has not been specified. Secrets can only be stored for repositorys and organisations.`) | ||
} | ||
} | ||
return true | ||
} | ||
async function putSecrets (accessToken, filename, owner, repository) { | ||
if (!await checkSecretsSupported(accessToken, owner, repository)) { | ||
return | ||
} | ||
await checkSecretsSupported(accessToken, owner, repository) | ||
const { publicKey, publicKeyId } = await getPublicKey(accessToken, owner, repository) | ||
@@ -130,5 +128,3 @@ const fileStream = fs.createReadStream(filename) | ||
async function deleteSecrets (accessToken, filename, owner, repository) { | ||
if (!await checkSecretsSupported(accessToken, owner, repository)) { | ||
return | ||
} | ||
await checkSecretsSupported(accessToken, owner, repository) | ||
@@ -135,0 +131,0 @@ const fileStream = fs.createReadStream(filename) |
{ | ||
"name": "@neilbmclaughlin/github-secrets", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "manage git repository secrets", | ||
@@ -12,2 +12,3 @@ "scripts": { | ||
"@octokit/core": "^3.2.4", | ||
"chalk": "^4.1.0", | ||
"readline": "^1.3.0", | ||
@@ -14,0 +15,0 @@ "tweetsodium": "0.0.5", |
5516
5
128
+ Addedchalk@^4.1.0
+ Addedchalk@4.1.2(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedsupports-color@7.2.0(transitive)