opsos
v1.0.3
Published
Zero-config git-branch deploy CLI for MERN / Next.js / Vite projects
Maintainers
Readme
opsos
Zero-config git-branch deploy CLI for MERN / Next.js / Vite projects
What it does
opsos builds your project and deploys the output to a dedicated git branch on your remote repository. The VPS/server then just pulls that branch — no Docker, no CI pipeline complexity needed.
opsos deploy prodThat's it. ✅
Install
# Use directly without installing
npx opsos deploy prod
# Or install globally
npm install -g opsos
# Or as a dev dependency
npm install -D opsosUsage
opsos deploy [branch] # Deploy to branch (default: stage)
opsos init # Auto-detect project and create deploy-config.json
opsos help # Show helpRecommended package.json scripts
{
"scripts": {
"deploy:stage": "opsos deploy stage",
"deploy:prod": "opsos deploy prod",
"deploy:dev": "opsos deploy dev",
"deploy:uat": "opsos deploy uat"
}
}Configuration
Place a deploy-config.json file in your project root to customize the build and copy steps.
If no config is found, opsos will auto-detect your project type and generate one automatically.
Auto-detection supports
| Project type | Detection | Output dir |
|---|---|---|
| Next.js standalone | output: 'standalone' in next.config | .next/standalone |
| Next.js static export | output: 'export' in next.config | out/ |
| Vite | vite.config.* present | dist/ |
| Create React App | react-scripts in package.json | build/ |
| Generic | fallback | dist/ |
Example deploy-config.json
Next.js standalone (default):
{
"buildCommand": "npm run build",
"copySteps": [
{
"src": ".next/standalone",
"dest": ".deploy",
"excludes": ["public", ".next/static", ".git"]
},
{ "src": ".next/static", "dest": ".deploy/.next/static" },
{ "src": "public", "dest": ".deploy/public" }
]
}Vite / Static export:
{
"buildCommand": "npm run build",
"copySteps": [
{ "src": "dist", "dest": ".deploy" }
]
}How it works
- Checks if the target branch exists on
origin - Bumps the patch version in
package.json - Runs your
buildCommand - Clones the deploy branch (shallow,
--depth 1) into.deploy/ - Syncs files from your build output to
.deploy/using smart incremental copy - Commits and pushes the result to the target branch
- Retains
.deploy/for faster subsequent deploys (acts as a git cache)
.deployis safe to add to.gitignore— it is a separate git repo cloned inside your project folder.
Add .deploy to .gitignore
/.deployRequirements
- Node.js >= 16
gitinstalled and accessible in PATH- Remote
originconfigured in the project (git remote add origin ...)
License
MIT © mytecsys
