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 🙏

© 2026 – Pkg Stats / Ryan Hefner

gulp-sonar-next

v1.0.0

Published

Run SonarQube/SonarCloud analysis from a gulp task, powered by the modern @sonar/scan Node scanner (no bundled Java required).

Readme

gulp-sonar-next

Run SonarQube / SonarCloud analysis from a gulp task, powered by the modern, officially maintained @sonar/scan Node scanner.

This is the next-generation successor to gulp-sonar2. Instead of bundling a Java scanner, it delegates to @sonar/scan, which downloads the correct SonarScanner automatically and works with current SonarQube servers and SonarCloud.

Why this over gulp-sonar2?

  • No Java, no bundled jar. @sonar/scan fetches the right scanner for you, so the package is a few KB instead of ~600 KB.
  • Works with modern SonarQube. The legacy 3.x scanner no longer plays well with current servers.
  • Token auth. Uses the modern token flow (the old jdbc database config was removed from SonarQube years ago).

Requirements

  • Node.js >= 22.12.0 (required by @sonar/scan 5.x)
  • This package is ESM only (import, not require)
  • Access to a SonarQube server or SonarCloud, plus an analysis token

Install

npm install --save-dev gulp-sonar-next

Usage

import gulp from 'gulp';
import sonar from 'gulp-sonar-next';
import log from 'fancy-log';

export function scan() {
    const options = {
        serverUrl: 'https://sonarqube.mycompany.com',
        token: process.env.SONAR_TOKEN,
        options: {
            'sonar.projectKey': 'my-project',
            'sonar.projectName': 'My Project',
            'sonar.projectVersion': '1.0.0',
            'sonar.sources': 'src',
            'sonar.tests': 'test',
            'sonar.javascript.lcov.reportPaths': 'coverage/lcov.info'
        }
    };

    // The gulp source is ignored; analysis scope comes from the options above
    // (e.g. sonar.sources). This mirrors the original gulp-sonar2 contract.
    return gulp.src('.', { read: false })
        .pipe(sonar(options))
        .on('error', log.error);
}

You can also skip gulp's file glob entirely and just return the stream from a task; the scanner reads the filesystem based on sonar.sources.

Options

The plugin accepts an object with three top-level fields, matching @sonar/scan:

| Field | Type | Description | |---|---|---| | serverUrl | string | SonarQube/SonarCloud URL. Falls back to SONAR_HOST_URL. | | token | string | Analysis token. Falls back to SONAR_TOKEN. | | options | object | Scanner properties as sonar.* keys (e.g. sonar.sources). |

Full list of scanner properties: SonarScanner parameters.

Migrating from gulp-sonar2

For a smoother move, the plugin also accepts a legacy sonar block similar to gulp-sonar2 and folds it into scanner properties:

sonar({
    sonar: {
        host: { url: 'https://sonarqube.mycompany.com' },
        login: process.env.SONAR_TOKEN, // legacy field name, mapped to token
        projectKey: 'my-project',
        sources: 'src'
    }
});

Note the important differences from gulp-sonar2:

  • The bundled Java scanner is gone; nothing to configure for Java.
  • The jdbc database block is not supported (removed from SonarQube long ago).
  • Authenticate with a token (or the legacy login field), not a DB user.

Error handling

The plugin emits errors on the stream rather than throwing, so attach an error handler as shown above. The task fails if @sonar/scan reports an analysis error (for example, the server is unreachable or the token is invalid).

License

Apache-2.0