npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wulechuan/javascript-gulp-plugin-error-printer

v1.2.3

Published

[PROJECT DEPRECATED] Please refer to "@wulechuan/printer-for-errors-of-gulp-plugins".

Downloads

22

Readme

Printer of Errors of Glup Plugins [PROJECT DEPRECATED]

NPM Page

@wulechuan/javascript-gulp-plugin-error-printer

DEPRECATION

This package has been deprecated. The reason is simply I renamed this project, as the old name "javascript-gulp-plugin-error-printer" is not so good. It should not contains the word "javascript".

The renamed(new) package is @wulechuan/printer-for-errors-of-gulp-plugins. At beginning it's alomst identical to this old one. But it will get supported longer, and will hopefully be very different from this one in the future.


Introduction

This is a message logging plugin for gulp. It parses gulp's PluginError instance, and is expected to print a more beautiful log for the error instance, as long as a parser is provided for that specific type of PluginError.

Almost all colors in the logs are configurable.

Supported Plugins So Far

Even for those errors that are not supported, a beautified property list is logged.

Usage

An Example

See the examples/gulpfile.js included by this repository as an example.

Below are the key snippet from the said gulpfile.js.

const printGulpPluginErrorBeautifully = require('..');

const exampleSourceFileBasePath = '.';

const errorOfGlupPluginsPrintingConfigurations = {

    // This simply helps the logger print shorter paths
    // so that file paths looks better in narrow console windows.
    basePathToShortenPrintedFilePaths: exampleSourceFileBasePath,

    colorTheme: {
        heading: {
            lineColor: 'magenta',
        },
    },
};


function buildCSSStylus (cb) {
    return gulpRead(sourceGlobsOfCSSStylus)
        .pipe(compileStylus())
        .on('error', theError => {
            printGulpPluginErrorBeautifully(theError, errorOfGlupPluginsPrintingConfigurations);
            cb();
        });
}

Try It out, See It in Action

There is a dummy project included within this repository, so that people can try this logger without difficulty.

The said dummy project locates here:

<this repository root folder>/examples

Before You Try

Before you can start trying, you first need to install all dependencies for this npm project.

This is a one time action, you don't need to do it every time before you run the tryout script.

Open a console/terminal and run:

npm install

or even simpler:

npm i

Run the Tryout Script

Open a console/terminal and run:

npm start

or even simpler:

gulp

That's it.

Some Snapshots of Mine

Below are some snapshots of my console, hosted within Microsoft Visual Studio Code.

By the way, the used color theme of my Visual Studio Code, shown in the illustrates below, is the "Panda Theme".

A Stylus compilation error. A Stylus compilation error

A LESSCSS compilation error. A LESSCSS compilation error

A Sass compilation error. A Sass compilation error

An UglifyJS parsing error. An UglifyJS parsing error

Configurations

Currently only colors are configurable. So you may call if "color theme configurations" if you prefer.

See configurations.md.

Known Issues

When utilizing the on('error') method of a gulp's pipeline, the error will propagate outside the event handler, and will finally get printed the traditional way. Since this logger also prints the error, the error is printed twice.

I'll learn how to swallow the error inside this logger in the future.

API

Sorry. I don't have too much spare time at present. I have my boy to take care of.

Consult my ugly source codes if you'd like to. :p