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

urbanjs-tools

v2.1.0

Published

Common dev tools for NPM packages

Downloads

61

Readme

urbanjs-tools

Development stack for node packages

API documentation

.setupInMemoryTranspile()

Installs in memory transpile and sourcemap support

const tools = require('urbanjs-tools');

// optional
tools.setGlobalConfiguration({
  babel: //...
  typescript: //...
});

tools.setupInMemoryTranspile();

.setGlobalConfiguration(config)

Sets global configuration object

const tools = require('urbanjs-tools');
tools.setGlobalConfiguration(currentValues => Object.assign({}, currentValues, {
  typescript: <typescript compiler options>,
  babel: <babel configuration>,
  sourceFiles: <array of source file glob patterns>
});

.getGlobalConfiguration()

Returns the global configuration object

const tools = require('urbanjs-tools');
const globals = tools.getGlobalConfiguration();

.getTool(toolName)

Returns a registrable gulp tool: (gulp, taskName, parameters) => void

Please check Tool configuration section for more information about parameters.

const gulp = require('gulp');
const tools = require('urbanjs-tools');
tools.getTool('mocha').register(gulp, 'test-unit', {
  files: ['src/**']
});

.initializeTask(gulp, taskName, parameters)

Uses taskName to find the tool and registers it

Use .getTool() to register a task with different name than the name of the tool

Please check Tool configuration section for more information about parameters.

const gulp = require('gulp');
const tools = require('urbanjs-tools');
tools.initializeTask(gulp, 'mocha', {
  files: ['src/**']
});

.initializeTasks(gulp, parametersByToolName)

Registers all tasks with their parameters

Please check Tool configuration section for more information about parameters.

const gulp = require('gulp');
const tools = require('urbanjs-tools');
tools.initializeTasks(gulp, {
  mocha: {
    files: ['src/**']
  },
  // ...
});

.initializePreset(gulp, presetName, parameters)

Registers a preset with its subtasks

Please check Preset configuration section for more information about parameters.

const gulp = require('gulp');
const tools = require('urbanjs-tools');
tools.initializePreset(gulp, 'security', ['nsp', 'retire']);
tools.initializePreset(gulp, 'analyse', true);

.initializePresets(gulp, parametersByPresetName)

Registers all presets with their subtasks

Please check Preset configuration section for more information about parameters.

const gulp = require('gulp');
const tools = require('urbanjs-tools');
tools.initializePresets(gulp, {
  security: ['nsp', 'retire'],
  analyze: true
});

.initialize(gulp, parametersByTaskNameOrPresetName)

Registers all tasks and presets with their parameters

const gulp = require('gulp');
const tools = require('urbanjs-tools');
tools.initialize(gulp, {
  mocha: {
    files: ['src/**']
  },
  security: ['nsp', 'retire'],
  analyze: true
});

Tool configuration

parameters argument can be

  • true to use defaults
  • object to merge it with defaults on root level
  • function to get the defaults and return the final configuration (output won't be merged with defaults)

Defaults of tools can be found in packages/<tool>/src/defaults.ts files e.g. mocha.

Preset Configuration

parameters argument can be

  • true to use default tasks
  • array of task names to use it as is
  • function to get the defaults and return the final list of task names

Default preset configuration can be found here.