Go to file
Benjamin Toby 7e320c87f5 Updates
2025-02-22 18:02:00 +01:00
.vscode Updates 2025-02-04 07:43:18 +01:00
dist Updates 2025-02-22 18:02:00 +01:00
rebuilds/next-js Bugfix 2025-02-21 09:17:55 +01:00
schema Updates 2025-01-16 09:03:11 +01:00
utils Updates 2025-02-22 18:02:00 +01:00
.gitignore Version 1.0.0 Tentative 2023-10-29 11:49:04 +01:00
.npmrc Refactor to typescript 2025-01-16 06:22:33 +01:00
bun.lockb Updates 2025-02-21 09:00:49 +01:00
buncid.ts Updates 2025-02-04 07:43:18 +01:00
index.ts Updates 2025-02-03 13:41:13 +01:00
jsconfig.json Refactor to typescript 2025-01-16 06:22:33 +01:00
package.json Updates 2025-02-22 18:02:00 +01:00
publish.sh Updates 2025-01-16 06:32:50 +01:00
push.sh Updates 2025-01-16 06:31:09 +01:00
README.md Updates 2025-02-21 09:00:49 +01:00
tsconfig.json Refactor to typescript 2025-01-16 06:22:33 +01:00
types.ts Updates 2025-02-03 14:21:32 +01:00

Simple CI/CD package for any application

NOTE: This package is for Bun runtime

Integrate a simple CI/CD process into your application without the hassle.

NOTE: This package needs bun installed to work

Requirements

  • Node JS Runtime and NPM: You need to have NodeJS and bun installed on the target machine for this package to work.
  • buncid.config.json file: This package depends on a configuration file located in the root directory of your application.

Installation

To install this package globally just run:

bun install -g buncid

To run the package directly run:

bunx buncid

This will download the package and run the binaries directly. After the first run it won't download the package again.

Usage

To run the package after installing it globally just run:

buncid

Remember you must have a buncid.config.json file located in your root directory else this will throw an error.

Configuration

Your buncid.config.json file should look like this:

{
    "start": "bun index.ts",
    "preflight": ["bun run test", "bun run build"]
}

or

{
    "start": "bun index.ts",
    "preflight": "./preflight.sh"
}

Your preflight parameter can wither be an array of commands, or path to a shell script. This will run before every start commands.

Optionally you could include a redeploy_path in your config file:

{
    "start": "bun index.ts",
    "preflight": "./preflight.sh",
    "redeploy_path": "./REDEPLOY"
}

This will look for the file named REDEPLOY in your rood directory and watch that file. If the file is changed the application will be restarted, ie it will run the preflight command(s) and start command. If you ommit the redeploy_path a file named REDEPLOY will be created in your root directory.

You can change the name and path of the redeploy_path, just make sure the path is correct and the file name exists in the named path. Example:

{
    "start": "bun index.ts",
    "preflight": "./preflight.sh",
    "redeploy_path": "./deploy/trigger.txt"
}

NOTE: This also works for other languages, example:

{
    "start": "python app.py",
    "preflight": "./preflight.sh"
}

This app just runs whatever command you send it in an isolated child process, the command will be run as if being run in a terminal.

All Available options in buncid.config.json file

  • start: string: The start Command
  • preflight: string | Array: Array of commands or shell script file to run before reloading application
  • postflight: string | Array: Optional: Array of commands or shell script file to run after reloading application
  • redeploy_path: string: Optional: The path to trigger a redeployment. Default ./REDEPLOY
  • port: string | number | (string | number)[]: Optional: A port(or array of ports) to kill if running a server. NOTE: it is important to provide this option if running a server else the process may not terminate properly
  • first_run: boolean: Optional: If the preflight should run on first run. Default false.

Redeployment

For continuos deployment and integration there needs to be a text file located in your project which the application can watch. Any time the content of this file is changed the application will rebuild and rerun your start command.

Rebuilds

buncid provides rebuild scripts for popular frameworks

Next JS

use bunx buncid-builds-next or simply buncid-builds-next if you installed globally, to rebuild a next js app incrementally. This has a few requirements though.

Update your next-config.js file

You need to update the distribution directory in your next-config.ts. Like this:

import type { NextConfig } from "next";
import grabDist from "@moduletrace/buncid/dist/rebuilds/next-js/grabDist";

const distDir = grabDist();

const nextConfig: NextConfig = {
    /* config options here */
    reactStrictMode: true,
    distDir,
};

export default nextConfig;

That's it. This dynamically handles your distribution directory for both dev and start scripts. Your development environment uses the .next directory, while your production environment uses the .buncid-next-dist (or any dist name of your chosing) directory.