Makage Build Helper

0.3.0 · active · verified Sun Apr 19

Makage is a lightweight, cross-platform build helper specifically designed for managing common tasks within monorepo environments. Currently at version 0.3.0, it provides essential utilities for file operations such as copying files, cleaning directories, and general asset management. Its primary focus is on simplifying build processes across different operating systems, offering a more streamlined alternative to platform-specific scripts or heavier build tools. Given its pre-1.0 version, the release cadence is likely irregular, with features and API potentially evolving rapidly. Key differentiators include its 'tiny' footprint and explicit support for monorepo structures, aiming to minimize configuration overhead for common build-related file manipulations. It ships with TypeScript types, facilitating its integration into modern TypeScript-based projects.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates programmatic usage of Makage to clean a 'dist' directory and copy 'assets' from 'src' to 'dist', simulating a basic build pipeline. It highlights how to import and use the `clean` and `copy` utilities.

import { copy, clean } from 'makage';
import * as path from 'path';

const projectRoot = process.cwd();
const distDir = path.join(projectRoot, 'dist');
const assetsSrc = path.join(projectRoot, 'src', 'assets');
const assetsDest = path.join(distDir, 'assets');

async function buildPackage() {
  console.log('Starting build...');
  try {
    // Clean the distribution directory
    console.log(`Cleaning ${distDir}...`);
    await clean(distDir);
    console.log('Clean complete.');

    // Copy assets
    console.log(`Copying assets from ${assetsSrc} to ${assetsDest}...`);
    await copy(assetsSrc, assetsDest, { overwrite: true, recursive: true });
    console.log('Asset copy complete.');

    // Simulate other build steps (e.g., transpilation)
    console.log('Running other build steps (e.g., TypeScript compilation)...');
    await new Promise(resolve => setTimeout(resolve, 500)); // Placeholder for actual build logic

    console.log('Build successful!');
  } catch (error) {
    console.error('Build failed:', error);
    process.exit(1);
  }
}

buildPackage();

view raw JSON →