npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sp-packages/copyrc

v2.3.5

Published

A lightweight CLI tool to automate copying template files during project setup or runtime.

Readme

CopyRC

✨ Features

  • 📂 Copies template files to designated locations
  • 🔄 Skips existing files to prevent overwrites
  • ⚡ Works with any project type (WordPress, Node.js, PHP, etc.)
  • 🔧 Fully configurable via copyrc.json
  • 🛠️ Can be integrated into CI/CD, Lando, and other automation workflows
  • 📜 Supports programmatic usage in Node.js projects

📦 Installation

Global Installation (For system-wide use)

npm install -g @sp-packages/copyrc

This allows you to use copyrc globally in your terminal.

Local Installation (For project-specific use)

npm install @sp-packages/copyrc --save-dev

Then, run it via:

npx copyrc

⚙️ Configuration (copyrc.json)

Running the copyrc command will allow you to automatically create the copyrc.json file. Alternatively, you can manually create a copyrc.json or .copyrc.json in your project root or a custom configuration file and pass it using the -c or --config parameter:

{
  "files": [
    { "source": "./templates/.env.template", "destination": "./public/.env" },
    {
      "source": "./templates/wp-config.php.template",
      "destination": "./public/wp-config.php"
    },
    {
      "source": "./templates/.htaccess.template",
      "destination": "./public/.htaccess"
    }
  ]
}

If no --config option is provided, copyrc will look for copyrc.json or .copyrc.json in the project root by default.

🚀 CLI Usage

Basic Usage

copyrc

This will use copyrc.json or .copyrc.json from the project root.

Custom Config File Path

copyrc -c ./custom-config.json

Configuration Options:

  • files[] – Array of file mappings
    • source – Path to the template file
    • destination – Target path where the file should be copied

📜 Programmatic Usage (Inside Node.js)

You can also use copyrc inside your JavaScript/TypeScript projects.

Import and Run Directly

import { copyrc } from '@sp-packages/copyrc';

const config = {
  files: [
    { source: './templates/.env.template', destination: './public/.env' },
    {
      source: './templates/wp-config.php.template',
      destination: './public/wp-config.php'
    }
  ]
};

copyrc(config, true); // The second argument enables verbose logging

Example Use Case in a Node.js Script

Create a script setup.js:

import { copyrc } from '@sp-packages/copyrc';
import fs from 'fs';

const configPath = './copyrc.json';

if (fs.existsSync(configPath)) {
  const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
  copyrc(config, false);
} else {
  console.error('❌ Config file not found!');
}

Then run:

node setup.js

🎯 Example Outputs

⚠ [WARNING] Destination file already exists at ./public/.env. Skipping.
✔ [SUCCESS] wp-config.php.template copied successfully to ./public/wp-config.php
✔ [SUCCESS] All required files are copied or already exist.

💡 Use Cases

  • WordPress Setup – Automate wp-config.php and .htaccess
  • Environment Files – Ensure .env files are always present
  • Project Bootstrapping – Copy necessary config files on composer install
  • CI/CD Automation – Automate file setups during deployments

1️⃣ Automating Lando Post-Start Hook

If you're using Lando, you can automatically run copyrc after lando start:

services:
  appserver:
    run_as_root:
      - copyrc

2️⃣ CI/CD Integration

Run it in GitHub Actions, GitLab CI/CD, or other automation scripts:

jobs:
  setup:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v3

      - name: Install Dependencies
        run: npm ci

      - name: Install Copyrc
        run: npm install -g @sp-packages/copyrc

      - name: Run Copyrc
        run: copyrc

🤝 Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

📜 License

This project is licensed under the MIT License. See the LICENSE file for details.