
Research
/Security News
Shai Hulud Strikes Again (v2)
Another wave of Shai-Hulud campaign has hit npm with more than 500 packages and 700+ versions affected.
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 673,183 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.

Research
/Security News
Another wave of Shai-Hulud campaign has hit npm with more than 500 packages and 700+ versions affected.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.