🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

git-pull-run

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-pull-run - npm Package Compare versions

Comparing version

to
1.4.1-next.1

7

dist/cli.js
#!/usr/bin/env node
import { Command } from 'commander';
import debugLog from 'debug';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { gitPullRun } from './index.js';

@@ -19,2 +19,3 @@ const debug = debugLog('git-pull-run:cli');

.option('-d, --debug', 'print additional debug information', false)
.option('-o, --once', 'run command only once if any files match the pattern', false)
.parse();

@@ -21,0 +22,0 @@ const options = program.opts();

@@ -8,3 +8,3 @@ import { dim, green } from 'colorette';

import { runScript } from './runScript.js';
export async function gitPullRun({ pattern, message, command, script }) {
export async function gitPullRun({ pattern, message, command, script, once }) {
const runner = new Listr([

@@ -33,20 +33,23 @@ {

task: (ctx, task) => {
const subtasks = ctx.changes.map(change => {
const { directory } = getAbsolutePath(ctx.gitDir, change);
return {
title: `${dim(directory)}`,
task: async (ctx, task) => task.newListr([
{
title: `${green(command)}`,
task: () => runCommand(command, directory),
enabled: () => !!command,
},
{
title: `npm run ${green(script)}`,
task: () => runScript(script, directory),
enabled: () => !!script,
},
])
};
const createTasks = (directory) => ({
title: `${dim(directory)}`,
task: async (ctx, task) => task.newListr([
{
title: `${green(command)}`,
task: () => runCommand(command, directory),
enabled: () => !!command,
},
{
title: `npm run ${green(script)}`,
task: () => runScript(script, directory),
enabled: () => !!script,
},
])
});
const subtasks = once
? [createTasks(ctx.gitDir)]
: ctx.changes.map(change => {
const { directory } = getAbsolutePath(ctx.gitDir, change);
return createTasks(directory);
});
return task.newListr([...subtasks], { concurrent: true, rendererOptions: { collapse: false } });

@@ -53,0 +56,0 @@ },

{
"name": "git-pull-run",
"version": "1.4.0",
"version": "1.4.1-next.1",
"description": "Run commands and scripts after git pull",
"bin": "./dist/cli.js",
"exports": "./dist/index.js",
"files": [
"dist"
],
"type": "module",
"scripts": {
"prepublishOnly": "npm run build",
"build": "rimraf dist && tsc --project tsconfig.build.json",

@@ -14,5 +18,7 @@ "build:watch": "tsc --watch",

"release:next": "npm version $(semver $npm_package_version -i prerelease --preid next ) && npm publish --tag next",
"start": "ts-node ./src/cli",
"start": "tsx ./src/cli",
"test": "jest",
"dummy": "echo \"dummy\""
"lint": "biome check . --write",
"dummy": "echo \"dummy\"",
"post-merge": "echo \"dummy\""
},

@@ -39,2 +45,3 @@ "repository": {

"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@gmrchk/cli-testing-library": "^0.1.2",

@@ -47,10 +54,4 @@ "@tsconfig/node16": "^1.0.2",

"@types/node": "^16.11.12",
"@typescript-eslint/eslint-plugin": "^5.8.1",
"@typescript-eslint/parser": "^5.8.1",
"eslint": "^8.5.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"git-pull-run": "^1.3.0",
"git-pull-run": "^1.4.0",
"jest": "^29.2.2",
"prettier": "^2.5.1",
"rimraf": "^3.0.2",

@@ -60,2 +61,3 @@ "semver": "^7.3.8",

"ts-node": "^10.9.1",
"tsup": "^8.3.0",
"typescript": "^4.5.3"

@@ -69,4 +71,5 @@ },

"listr2": "^5.0.5",
"micromatch": "^4.0.4"
"micromatch": "^4.0.4",
"tsx": "^4.19.2"
}
}

@@ -1,3 +0,3 @@

![npm](https://img.shields.io/npm/v/git-pull-run?label=git-pull-run)
![npm](https://img.shields.io/npm/dt/git-pull-run)
[![npm](https://img.shields.io/npm/v/git-pull-run?label=git-pull-run)](https://www.npmjs.com/package/git-pull-run)
[![npm](https://img.shields.io/npm/dt/git-pull-run)](https://www.npmjs.com/package/git-pull-run)

@@ -4,0 +4,0 @@ # Run Commands on Changes after Git Pull

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet