# app-root

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

Latest version **3.0.0** (published 2018-03-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install app-root
pnpm add app-root
yarn add app-root
bun add app-root
```

Provides the command `approot`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2018-03-09 |
| First published | 2014-03-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 15.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Joel Kemp |
| Maintainers | mrjoelkemp |
| Keywords | amd, commonjs, application, root, entry, point |

## Links

- npm: https://www.npmjs.com/package/app-root
- Repository: https://github.com/mrjoelkemp/node-app-root
- Issues: https://github.com/mrjoelkemp/node-app-root/issues
- npm.io page: https://npm.io/package/app-root

## Dependencies (7)

- [q](https://npm.io/package/q.md) ^1.5.1
- [debug](https://npm.io/package/debug.md) ^3.1.0
- [node-dir](https://npm.io/package/node-dir.md) ~0.1.6
- [precinct](https://npm.io/package/precinct.md) ^4.0.0
- [object-assign](https://npm.io/package/object-assign.md) ~4.1.1
- [filing-cabinet](https://npm.io/package/filing-cabinet.md) ^1.14.0
- [module-definition](https://npm.io/package/module-definition.md) ^2.2.4

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 3.0.0 (latest) — 2018-03-09
- 2.0.3 — 2016-06-02
- 2.0.2 — 2015-07-24
- 2.0.1 — 2014-11-28
- 2.0.0 — 2014-11-28
- 1.4.1 — 2014-06-08
- 1.4.0 — 2014-06-08
- 1.3.1 — 2014-06-08
- 1.3.0 — 2014-06-06
- 1.2.7 — 2014-06-06
- 1.2.6 — 2014-03-28
- 1.2.5 — 2014-03-28
- 1.2.4 — 2014-03-28
- 1.2.3 — 2014-03-27
- 1.2.2 — 2014-03-25
- … 7 more at https://npm.io/package/app-root/versions

## README

### app-root [![npm](http://img.shields.io/npm/v/app-root.svg)](https://npmjs.org/package/app-root) [![npm](http://img.shields.io/npm/dm/app-root.svg)](https://npmjs.org/package/app-root)

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](github.com/mrjoelkemp/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

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

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

With configurable options:

```js
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

---
_Source: https://npm.io/package/app-root · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
