Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grizzly

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grizzly - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

25

bin/release.js

@@ -8,10 +8,4 @@ #!/usr/bin/env node

HOME_WIN = process.env.HOMEPATH,
HOME_UNIX = process.env.HOME,
HOME = (HOME_UNIX || HOME_WIN) + '/',
check = require('checkup'),
exec = require('execon'),
tryRequire = require('tryrequire'),

@@ -33,7 +27,3 @@ argv = process.argv,

argsEmpty = Object.keys(args).length === 1,
config = tryRequire(HOME + '.github-release') || {
token: args.token
};
argsEmpty = Object.keys(args).length === 1;

@@ -44,14 +34,8 @@ if (args.version)

help();
else if (!config.token)
console.error([
'File ~/.github-release.json with token not found!',
'Please set --token parameter'
].join('\n'));
else
grizzly(config.token);
grizzly();
function grizzly(token) {
function grizzly() {
var error = exec.try(function() {
check([
token,
args.repo,

@@ -62,3 +46,2 @@ args.owner,

args.body], [
'token',
'repo',

@@ -73,3 +56,3 @@ 'owner',

if (!error)
release(token, {
release(args.token, {
repo : args.repo,

@@ -76,0 +59,0 @@ owner : args.owner,

63

lib/release.js
(function() {
'use strict';
var GitHubApi = require('github'),
var fs = require('fs'),
exec = require('execon'),
GitHubApi = require('github'),
ERROR_TOKEN = 'File ~/.grizzly.json with token not found!',
github = new GitHubApi({

@@ -11,16 +15,51 @@ version: '3.0.0'

module.exports = function(token, options, callback) {
github.authenticate({
type: 'oauth',
token: token
exec.if(token, function() {
release(token, options, callback);
}, function(fn) {
readConfig(function(error, json) {
if (!error)
token = json.token;
fn();
});
});
github.releases.createRelease({
owner : options.owner,
repo : options.repo,
tag_name : options.tag_name,
name : options.name,
body : options.body
}, callback);
};
function release(token, options, callback) {
if (!token)
callback(Error(ERROR_TOKEN));
else {
github.authenticate({
type: 'oauth',
token: token
});
github.releases.createRelease({
owner : options.owner,
repo : options.repo,
tag_name : options.tag_name,
name : options.name,
body : options.body
}, callback);
}
}
function readConfig(callback) {
var HOME_WIN = process.env.HOMEPATH,
HOME_UNIX = process.env.HOME,
HOME = (HOME_UNIX || HOME_WIN) + '/';
fs.readFile(HOME + '.grizzly.json', 'utf8', function(error, data) {
var json;
if (!error)
error = exec.try(function() {
json = JSON.parse(data);
});
callback(error, json);
});
}
})();
{
"name": "grizzly",
"version": "1.0.6",
"version": "1.0.7",
"description": "create release on github",

@@ -29,5 +29,4 @@ "main": "lib/release.js",

"github": "~0.2.3",
"minimist": "~1.1.0",
"tryrequire": "~1.1.3"
"minimist": "~1.1.0"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc