🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

devbee

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

devbee

> Simplify generated code and automated tasks.

latest
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

:honeybee: DevBee ::honeybee:

Simplify generated code and automated tasks.

What is DevBee?

DevBee is a powerful devtool designed to streamline your development workflow. Imagine having a team of worker bees that handle repetitive tasks for you! With DevBee, you can run custom functions whenever a file changes, automating processes like adding copyright headers, autogenerating types, and more. The possibilities are endless. Plus, DevBee supports plugins, allowing you to share your bees with fellow developers

Getting Started

Installation

Install DevBee using your preferred package manager:

npm install devbee      # npm
yarn add devbee         # yarn
bun add devbee          # bun
pnpm add devbee         # pnpm

Configuration

Create a devbee.config.ts file in your project’s root directory. Add the following content:

import type { DevBeeConfig } from "devbee";

import fs from "fs/promises";

const COPYRIGHT_HEADER = `/**
* Copyright (c) Test
*/`;

const config: DevBeeConfig = {
  plugins: [
    // Add your plugins here
  ],
  bees: [
    // Define your bees (tasks to run on file change)
    {
      paths: "./**/*.ts",
      name: "Add Copyright Header",
      // Function that runs on each file change
      buzz: async ({ contents, path }) => {
        if (contents.startsWith(`/**`)) return;
        await fs.writeFile(path, `${COPYRIGHT_HEADER}\n${contents}`, "utf-8");
      },
    },
  ],
};

export default config;

Thats it!

:tada: You’re all set! DevBee empowers you to automate mundane tasks, leaving you more time to focus on what matters—building great software.

:honey_pot: DevBee API :honey_pot:

type DevBeeConfig = {
  // Explore Plugin Docs for more info
  plugins: DevBeePlugin[];
  // An array of bees (tasks to run on file change)
  bees: Bee[];
};
// Think of a bee as something you create once; it performs the same task repeatedly whenever a file changes.

type Bee = {
  // Paths to watch for changes (can be a glob pattern)
  paths: string | string[];
  // Name of the plugin
  name: string;
  // Async function that runs on each file change
  buzz: (params: { contents: string; path: string }) => Promise<void>;
};
  • paths (string or array of strings). Paths to files, dirs to be watched recursively, or glob patterns.
    • globs must not contain windows separators (\). You'll need to replace them with forward slashes (/).
    • for additional glob documentation, check out picomatch's documentation.

buzz Arguments

contents: The contents of the file that was changed. path: The path of the file that was changed.

Keywords

dev tools

FAQs

Package last updated on 13 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts