Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

merge-trees

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

merge-trees

Incrementally merge directories.

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created

What is merge-trees?

The merge-trees npm package is used to merge multiple directories into one. It is particularly useful in build systems and asset pipelines where you need to combine the contents of several directories into a single output directory.

What are merge-trees's main functionalities?

Basic Directory Merge

This feature allows you to merge multiple directories into a single output directory. In this example, the contents of 'src' and 'lib' directories are merged into the 'output' directory.

const MergeTrees = require('merge-trees');
const tree = new MergeTrees(['src', 'lib'], { overwrite: true });
tree.merge('output');

Custom Merge Function

This feature allows you to define a custom merge function to handle conflicts or special merging logic. The customMerge function is called for each file that needs to be merged.

const MergeTrees = require('merge-trees');
const tree = new MergeTrees(['src', 'lib'], {
  overwrite: true,
  customMerge: (srcDir, destDir, relativePath) => {
    // Custom merge logic here
  }
});
tree.merge('output');

Excluding Files

This feature allows you to exclude certain files from being merged. In this example, all files with a .test.js extension are excluded from the merge.

const MergeTrees = require('merge-trees');
const tree = new MergeTrees(['src', 'lib'], {
  overwrite: true,
  exclude: ['**/*.test.js']
});
tree.merge('output');

Other packages similar to merge-trees

Keywords

FAQs

Package last updated on 20 Feb 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc