metalsmith-tracer
v2.1.3
Published
A Metalsmith plugin to find related files within collections.
Downloads
165
Maintainers
Readme
metalsmith-tracer
A tool to automatically trace and measure Metalsmith build time.
The Metalsmith build process has no progress output to indicate how many plugins have been processed and how many more are left. Build pipelines with a lot of plugins can take a long time to finish, and it's very difficult to know which plugins take the most time. This package is a wrapper around Metalsmith that outputs meaningful build progress.
Here is an example console output when wrapped around the metalsmith/startbootstrap-clean-blog example:
------- Build process started -------
4.7ms (unnamed)
32.5ms (unnamed)
2.3ms @metalsmith/collections
0.4ms metalsmith.js
511.9ms @metalsmith/layouts
1.8s @metalsmith/sass
0.3ms metalsmith.js
2.4s Total build time
Build finishedInstallation
npm install --save metalsmith-tracerJavaScript Usage
metalsmith-tracer wraps the root metalsmith call:
import Metalsmith from 'metalsmith';
import tracer from 'metalsmith-tracer';
tracer(Metalsmith(__dirname), {
// options here
})
// .use() every build plugin
.build((err) => {
if (err) {
throw err;
}
});Options
log (optional)
Type: (...data: unknown[]) => void Default: console.log
The logger function.
Limitations
setImmediate()Plugins that use
setImmediate()to call theirdonecallback will not print their real name due to howmetalsmith-traceruses the call stack.metalsmith-ifUsing
metalsmith-ifwill mask the name of the plugin actually being used.
