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

app-root

v3.0.0

Published

Find the entry-point/root file of a front-end application

Downloads

83

Readme

app-root npm npm

Returns a list of application entry points for front-end applications (JS and Sass).

npm install app-root

An entry point (i.e., root) is a file that no other file requires/imports.

Works with AMD, CommonJS, ES6, and SASS apps.

This library is particularly useful for automatically deducing the entry point for r.js or browserify configurations as done in YA.

A directory may have many roots. This is true if you have multiple apps within a single directory or if your app uses a multi-bundle architecture (where each page on your site has its own JS app).

Usage

var getAppRoot = require('app-root');

// Find the application roots within the js folder
getAppRoot({
  directory: './js',
  success: function (roots) {
    ...
  }
});

With configurable options:

getAppRoot({
  directory: './js',
  success: function (roots) {
    ...
  },

  ignoreDirectories: [/.+_components/, 'vendor', 'node_modules', '.git'],
  ignoreFiles: ['Gruntfile.js'],
  includeNoDependencyModules: true,
  config: 'path/to/my/requirejs/config.js'
});

Options

  • ignoreDirectories: list of directory names (strings or regex) to ignore
  • ignoreFiles: list of file names (strings or regex) to ignore
  • includeNoDependencyModules: (default false) Whether or not to include, as potential roots, modules that have no dependencies
  • config: path to your module loader configuration (for resolving aliased module paths)

Or via a shell command

approot directory

  • Where directory is the directory containing roots you'd like to identify