bun-file-mover-plugin

1.0.5 • Public • Published

File Mover Plugin

File mover plugin for bun.sh

Installation:

bun add bun-file-mover-plugin

Props

from

  • type: String
  • required: false
  • default: './src'

to

  • type: String
  • required: false
  • default: './build'

transform

  • type: Function
  • required: false

reqursive

  • type: Boolean
  • required: false
  • default: true

Usage example:

import Bun from 'bun';
import { FileMoverPlugin } from 'bun-file-mover-plugin';

const APP_LINK = 'https://any-site.com';

Bun.build({
  entrypoints: ['./src/index.ts'],
  outdir: './build',
  plugins: [
    FileMoverPlugin({
      from: './src/images',
      to: './build/images'
    }),
    FileMoverPlugin({
      from: './src/templates/',
      to: './build/templates',
      transform: (content: string) => {
        const regexp = new RegExp('{{APP_LINK}}', 'ig');
        return content.replace(regexp, APP_LINK);
      }
    })    
  ]
});

/bun-file-mover-plugin/

    Package Sidebar

    Install

    npm i bun-file-mover-plugin

    Weekly Downloads

    2

    Version

    1.0.5

    License

    MIT

    Unpacked Size

    22.3 kB

    Total Files

    8

    Last publish

    Collaborators

    • sergey.khalilov