
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
broccoli-merge-trees
Advanced tools
Copy multiple trees of files on top of each other, resulting in a single merged tree.
npm install --save-dev broccoli-merge-trees
function callconst broccoliMergeTrees = require('broccoli-merge-trees');
let mergedNode = broccoliMergeTrees(inputNodes, options);
newconst { MergeTrees } = require('broccoli-merge-trees');
let mergedNode = new MergeTrees(inputNodes, options);
inputNodes: An array of nodes, whose contents will be merged
options: A hash of options
overwrite: By default, broccoli-merge-trees throws an error when a file
exists in multiple nodes. If you pass { overwrite: true }, the output
will contain the version of the file as it exists in the last input
node that contains it.
annotation: A note to help tell multiple plugin instances apart.
destDir: A string representing the destination path that merged files will be copied to.
If this is your Brocfile.js:
const mergeTrees = require('broccoli-merge-trees');
module.exports = function() {
return mergeTrees(['public','scripts']);
};
And your project contains these files:
.
├─ public
│ ├─ index.html
│ └─ images
│ └─ logo.png
├─ scripts
│ └─ app.js
├─ Brocfile.js
…
Then running broccoli build the-output will generate this folder:
the-output
├─ app.js
├─ index.html
└─ images
└─ logo.png
The parent folders, public and scripts in this case, are not included in the output. The output tree contains only the files within each folder, all mixed together.
If this is your Brocfile.js:
var BroccoliMergeTrees = require('broccoli-merge-trees');
module.exports = new BroccoliMergeTrees(['public', 'scripts'], {
destDir: 'assets'
});
Then running broccoli build the-output will generate this folder:
the-output
└─ assets
├─ app.js
├─ index.html
└─ images
└─ logo.png
Clone this repo and run the tests like so:
npm install
npm test
Issues and pull requests are welcome. If you change code, be sure to re-run
npm test. Oftentimes it's useful to add or update tests as well.
The broccoli-concat package is used to concatenate multiple files into a single file. While broccoli-merge-trees combines entire trees, broccoli-concat focuses on combining file contents. This can be useful for tasks like combining JavaScript or CSS files.
The broccoli-funnel package allows you to filter and move files within a tree. It provides more granular control over the contents of a tree compared to broccoli-merge-trees, which merges entire trees. This can be useful for tasks like copying specific files or directories.
The broccoli-stew package offers a collection of Broccoli plugins for various tasks, including file manipulation, logging, and debugging. It provides more specialized functionalities compared to the general tree merging capabilities of broccoli-merge-trees.
FAQs
Broccoli plugin to merge multiple trees into one
The npm package broccoli-merge-trees receives a total of 753,560 weekly downloads. As such, broccoli-merge-trees popularity was classified as popular.
We found that broccoli-merge-trees demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.