New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hexo-git-backup

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hexo-git-backup - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

51

index.js
var util = require('util');
var run = require('execSync').run;
process.env.DEBUG = '';//"hexo-backup"
var log = require('debug')("hexo-backup");
var backupOptions = {
alias: 'b', // hexo backup/b
alias: 'b', // hexo backup or hexo b, either is fun.
options: [{
name: '-i,--init',
desc: 'git init git remote branch'
desc: 'git init and git remote branch'
}]

@@ -15,3 +13,3 @@ }

// hexo is a global variable
hexo.extend.console.register("backup", "backup your hexo blog into github, your themes not included", backupOptions, backup);
hexo.extend.console.register("backup", "backup your hexo bdebug into github, your themes not included", backupOptions, backup);

@@ -25,9 +23,6 @@

function backup(args, cb) {
function backup(args, callback) {
if (!hexo.config.backup) {
throw new Error("please add backup info into _config.yml, branch & repo ...");
throw new Error("please add backup info into _config.yml");
}
log(hexo.base_dir)
process.chdir(hexo.base_dir)

@@ -42,44 +37,18 @@

if (args.init || args.i) {
log("git init");
run("git init .")
run("git init.")
run(util.format("git checkout %s",branch));
run(util.format("git remote add backup %s",repository));
run("git add --all")
return;
}
// backup
log("backup");
run("git add --all")
// start backup
run(util.format('git commit -a -m "backup at %s"', getnow()))
run(util.format("git push backup %s",branch))
cb();
callback();
}
function getnow() {
var ret = "%s-%s-%s %s:%s:%s"
var d = new Date()
var year = pad(d.getFullYear(), 4),
mon = pad(d.getMonth() + 1, 2),
day = pad(d.getDate(), 2),
hour = pad(d.getHours(), 2),
min = pad(d.getMinutes(), 2),
sec = pad(d.getSeconds(), 2);
return util.format(ret, year, mon, day, hour, min, sec);
return d.toLocaleString();
}
function pad(original, len, char) {
if (arguments.length < 2)
throw new Error("must specify original_string & expect_length")
char = char || '0';
var ret = original.toString()
while (ret.length < len) {
ret = char + ret
}
return ret;
}

3

package.json
{
"name": "hexo-git-backup",
"version": "0.0.2",
"version": "0.0.3",
"description": "hexo backup plugin for Hexo,backup to github",

@@ -26,5 +26,4 @@ "main": "index",

"dependencies": {
"debug": "^2.0.0",
"execSync": "^1.0.2"
}
}
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