Socket
Socket
Sign inDemoInstall

simple-pre-commit

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-pre-commit - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

.github/workflows/lint.yml

14

cli.js
#!/usr/bin/env node
const os = require('os')
/** A CLI tool to change the pre-commit command from package.json

@@ -7,5 +9,11 @@ * It really has only one function — to set new pre commit hook.

*/
const simplePreCommit = require('./simple-pre-commit')
const {getCommandFromPackageJson, setPreCommitHook} = require('./simple-pre-commit')
const command = simplePreCommit.getCommandFromPackageJson()
simplePreCommit.setPreCommitHook(command)
const command = getCommandFromPackageJson()
if (!command) {
console.log(`Couldn't parse command! Please add command to package.json or .simpleprecommit.json. See README.md for details`)
os.exit(1)
}
setPreCommitHook(command)
{
"name": "simple-pre-commit",
"version": "1.0.0",
"version": "1.0.1",
"description": "A simple, zero dependency tool for setting up git pre-commit hook for small projects",

@@ -5,0 +5,0 @@ "author": "Mikhail Gorbunov <toplenboren@gmail.com> (toplenboren.gituhb.io)",

@@ -29,2 +29,3 @@ #!/usr/bin/env node

setPreCommitHook(command)
console.log('[INFO] Set pre-commit hook: ' + command)
}

@@ -31,0 +32,0 @@ } catch (err) {

@@ -7,2 +7,3 @@ # simple-pre-commit

- Zero dependency
- Lightweight

@@ -12,5 +13,7 @@ - Easy to install

## Usage:
## Add pre-commit hook to the project:
1. Install the simple-pre-commit as dev dependency `npm install simple-pre-commit --save-dev`
1. Install the simple-pre-commit as dev dependency
`npm install simple-pre-commit --save-dev`

@@ -28,2 +31,6 @@ 2. Add the `simple-pre-commit` to your `package.json`. Feed it with any command you would like to run as a pre-commit hook.

You should run `npx simple-pre-commit` manually on every change of the command
## Updating a pre-commit hook command
Run `npx simple-pre-commit`
Note that you should manually run `npx simple-pre-commit` every time you change the command

@@ -133,5 +133,3 @@ const fs = require('fs')

fs.writeFile(preCommitHookPath, preCommitHook, function (err) {
if (err) throw err;
});
fs.writeFileSync(preCommitHookPath, preCommitHook)
fs.chmodSync(preCommitHookPath, 0o0755)

@@ -138,0 +136,0 @@ }

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