devops-custom
v1.0.4
Published
Auto-update daemon para proyectos Node con Git + PM2
Maintainers
Readme
devops-custom
Auto-update daemon for Git repositories with optional build and restart steps.
Global Install Readiness
Current package status is compatible with global usage (npm i -g devops-custom):
binis defined inpackage.jsonasdevops-custom -> dist/cjs/cli.js.- Compiled artifacts are present under
dist/and included in package tarball. - CLI entrypoint includes Node shebang (
#!/usr/bin/env node).
Features Available Today
- Scans a root directory for Git repositories.
- Includes
reposRootitself if it has a.gitfolder. - Sequential polling (no parallel repo updates).
- Fetch + incoming commit detection with
HEAD..remote/branch. - Pull, optional build, optional restart.
- Per-repo config via
.devops-custom.json. - Build-only command for one repository.
Usage Modes
1) Use it globally (parameters)
Install globally:
npm i -g devops-customRun daemon using CLI parameters:
devops-custom start \
--poll-interval 60000 \
--repos-root /absolute/path/to/projects \
--log-level info \
--load-bashrc true \
--bashrc-path ~/.bashrcOther global commands:
devops-custom scan --repos-root /absolute/path/to/projects
devops-custom build --repo-path /absolute/path/to/repo
devops-custom status2) Use it cloned (with .env)
Clone and run locally with .env defaults:
git clone <your-repo-url>
cd devops-custom
yarn install
cp .env.example .envExample .env:
POLL_INTERVAL=300000
REPOS_ROOT=~/projects
LOG_LEVEL=info
LOAD_BASHRC=true
BASHRC_PATH=~/.bashrcRun from source:
yarn dev startOptional local commands:
yarn dev scan
yarn dev build --repo-path ~/my-repo
yarn dev status3) Use it as a dependency (parameters)
Install in another project:
npm i devops-customStart polling from your own code using explicit params:
import { Poller } from 'devops-custom';
async function main() {
const poller = new Poller();
await poller.start({
pollInterval: 60_000,
reposRoot: process.cwd(),
logLevel: 'info',
loadBashrc: true,
bashrcPath: '~/.bashrc',
});
}
main().catch((error) => {
console.error(error);
process.exit(1);
});Repository Config (.devops-custom.json)
Create this file inside each repository you want to control:
{
"branch": "master",
"remote": "origin",
"build": "yarn install && yarn build",
"restart": "pm2 restart my-app",
"pm2": true,
"autoUpdate": true,
"enabled": true
}If the project does not use PM2:
{
"branch": "master",
"remote": "origin",
"build": "yarn install && yarn build",
"pm2": false,
"enabled": true,
"autoUpdate": true
}Runtime Rules
- If configured remote does not exist, pull is skipped.
- If no pull happens, restart is skipped.
- If no build runs, restart is skipped.
- Runtime commands (
yarn,npm,pnpm,node,bun,deno, etc.) are skipped for non Node/Deno/Bun repos.
Exports
PollerScannerWorker- Shared types from
src/types.ts
Development
yarn test
yarn build:cjs
yarn build:esm
yarn buildAI Notice
Parts of the documentation and test code in this repository were generated with AI assistance and then reviewed and adjusted during development.
