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

gulp-main-node-files

v1.1.1

Published

Allows to get main js files from installed node modules

Downloads

139

Readme

gulp-main-node-files

Allows to get main js files from installed /node_modules.

var files = gulpMainNodeFiles([options]);

Installation

npm i --save-dev gulp-main-node-files

Usage

  • Connect in gulpfile.js
var mainNodeFiles = require('gulp-main-node-files');

and than

var mainNodeJsFiles = mainNodeFiles();
var src = gulp.src(mainNodeJsFiles, { base: '.' });
  • For example, copying js-files from /node_modules folder to /build.
gulp.src(mainNodeFiles(), { base: '.' })
    .pipe(gulp.dest('./build'));

Options

You can pass in the options object to customize function behavior with the following keys:

  • packageJsonPath (default - './package.json' ) - a path to your package.json file.

  • nodeModulesPath (default - './node_modules') - a path to node_modules folder.

  • overrides (no default value) - this is an object that allows override main: section from package.json file.

    • For example, if package points out to the wrong or not the whole-source file:
      mainNodeFiles({
        overrides: {
          'packery': 'dist/packery.pkgd.js'
        }
      })
    • or if you want to return several main files:
    mainNodeFiles({
      overrides: {
        'codemirror': [
          'lib/codemirror.js',
          'mode/clike/clike.js',
          'addon/edit/closebrackets.js',
        ]
      }
    })
  • order (no default value) - the object that allows to specify returned main files order. For example, if you further inject returned files into html and want to connect jquery before any other libraries.

    mainNodeFiles({
      order: {
        'jquery': 1,
        'angular': 2
      }
    })
  • skip (no default value) - the object which keys represent packages user wants to skip (value for a key should be truthy, if value is falsy, it's the same situation when key is absent at all - package won't be skipped). For example, if you want to build hybrid angular app, you can bundle AngularJS files with gulp-main-node-files and leave Angular ones as is.

  mainNodeFiles({
    skip: {
      'angular': false,
      '@angular/common': true,
      '@angular/compiler': true,
      '@angular/core': true,
      '@angular/forms': true,
      '@angular/http': true,
      '@angular/platform-browser': true,
      '@angular/platform-browser-dynamic': true,
      '@angular/router': true,
      '@angular/upgrade': true,
    }
  })