Skip to content

marcuwynu23/jsdaffodil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSDaffodil

Stars Badge Forks Badge Issues Badge License Badge

A lightweight, declarative deployment automation framework for Node.js, inspired by pydaffodil.

Built with:

  • 🧠 SSH automation using node-ssh
  • 🗃️ Step-by-step task execution
  • 🚀 Clean API for local/remote scripts
  • 💡 Dual support for CommonJS and ESM

📦 Installation

npm install @marcuwynu23/jsdaffodil

🚀 Usage

✅ ESM Example (type: module or .mjs)

// test.mjs or test.js (with "type": "module" in package.json)
import { Daffodil } from "@marcuwynu23/jsdaffodil";

const deployer = new Daffodil({
  remoteUser: "deployer", // Cloud server username
  remoteHost: "231.142.34.222", // Replace with your VPS or cloud IP
  remotePath: "/root/test", // Remote target path
});

const steps = [
  { step: "List local directory.", command: () => deployer.runCommand("ls -a") },
  { step: "List remote directory.", command: () => deployer.sshCommand("ls -a") },
];

await deployer.deploy(steps);

✅ CommonJS Example (.js or .cjs)

// test.cjs or test.js (without "type": "module")
const { Daffodil } = require("@marcuwynu23/jsdaffodil");

const deployer = new Daffodil({
  remoteUser: "deployer",
  remoteHost: "231.142.34.222",
  remotePath: "/root/test",
});

const steps = [
  { step: "List local directory.", command: () => deployer.runCommand("ls -a") },
  { step: "List remote directory.", command: () => deployer.sshCommand("ls -a") },
];

deployer.deploy(steps);

🛠 Features

  • 🔐 Multi-key SSH fallback (supports id_rsa, id_ed25519, etc.)
  • 📁 SCP-based file transfer with .scpignore support
  • 🟨 Ora & Chalk for styled terminal output
  • ✅ Progress bars for file transfers
  • ⚙️ CLI-ready architecture for future tooling

📂 Ignore List (.scpignore)

A .scpignore file is automatically created on first run.
Add filenames or patterns to exclude from SCP transfer.

node_modules
.env
*.log

🧪 Tips

  • Ensure your local SSH key is authorized for the remote user.
  • Use the same key that your CI/CD (e.g., GitHub Actions) uses, or add your own key to ~/.ssh/authorized_keys on the server.
  • Enable debug logs in your script by logging keys before connection if needed.

📄 License

MIT License

About

A lightweight, declarative deployment automation framework for Node.js, inspired by pydaffodil.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published