From 4650541dd4b8fc89401a0dc7ba364dcee5265b2b Mon Sep 17 00:00:00 2001 From: Phil Guinchard Date: Thu, 31 Oct 2024 23:38:46 -0400 Subject: [PATCH] Adding a bin --- .husky/pre-commit | 0 .npmignore | 1 + package-lock.json | 19 +++++++++++-------- package.json | 5 ++++- vmsnap.js | 4 +--- 5 files changed, 17 insertions(+), 12 deletions(-) mode change 100644 => 100755 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit old mode 100644 new mode 100755 diff --git a/.npmignore b/.npmignore index ddf3424..ca337e8 100644 --- a/.npmignore +++ b/.npmignore @@ -1 +1,2 @@ !node_modules/ +sbin/ \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index f0012f9..8db415e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "vmsnap", - "version": "0.2.2-alpha", + "version": "0.2.4-alpha", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "vmsnap", - "version": "0.2.2-alpha", + "version": "0.2.4-alpha", "license": "MIT", "dependencies": { "command-exists": "^1.2.9", @@ -17,6 +17,9 @@ "winston-console-format": "^1.0.8", "yargs": "^17.7.2" }, + "bin": { + "vmsnap": "vmsnap.js" + }, "devDependencies": { "@babel/core": "^7.25.2", "@babel/eslint-parser": "^7.25.1", @@ -25,7 +28,7 @@ "eslint": "^9.9.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.2.1", - "husky": "^9.1.6", + "husky": "^8.0.0", "lint-staged": "^15.2.9", "prettier": "^3.3.3" } @@ -1903,16 +1906,16 @@ } }, "node_modules/husky": { - "version": "9.1.6", - "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.6.tgz", - "integrity": "sha512-sqbjZKK7kf44hfdE94EoX8MZNk0n7HeW37O4YrVGCF4wzgQjp+akPAkfUK5LZ6KuR/6sqeAVuXHji+RzQgOn5A==", + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", "dev": true, "license": "MIT", "bin": { - "husky": "bin.js" + "husky": "lib/bin.js" }, "engines": { - "node": ">=18" + "node": ">=14" }, "funding": { "url": "https://github.com/sponsors/typicode" diff --git a/package.json b/package.json index 06ba321..2fca123 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vmsnap", - "version": "0.2.2-alpha", + "version": "0.2.4-alpha", "description": "A Node based backup and backup rotation tool for KVM domains.", "scripts": { "vmsnap": "node vmsnap.js", @@ -44,5 +44,8 @@ "*.js": "prettier --check --ignore-unknown" }, "exports": "./vmsnap.js", + "bin": { + "vmsnap": "./vmsnap.js" + }, "type": "module" } diff --git a/vmsnap.js b/vmsnap.js index 110e9ca..554ff29 100755 --- a/vmsnap.js +++ b/vmsnap.js @@ -1,4 +1,4 @@ -#!/usr/local/bin/node +#!/usr/bin/env node import { exec } from 'child_process'; import util from 'util'; import { tmpdir } from 'os'; @@ -27,8 +27,6 @@ import { } from './libs/general.js'; import { backup } from './libs/libnbdbackup.js'; -// const { YAML } = pkg; - /** * This script is designed to backup KVM virtual machines using the * virtnbdbackup utility. It relies on the virsh and qemu-img utilities as well