# component-auto-local

> Updating `locals` of `component.json` in `paths`

Latest version **0.1.4** (published 2016-01-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install component-auto-local
pnpm add component-auto-local
yarn add component-auto-local
bun add component-auto-local
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2016-01-05 |
| First published | 2014-05-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Author | js.seth.h@gmail.com |
| Maintainers | js.seth.h |
| Keywords | component, local |

## Links

- npm: https://www.npmjs.com/package/component-auto-local
- Repository: https://github.com/js-seth-h/component-auto-local
- Issues: https://github.com/js-seth-h/component-auto-local/issues
- npm.io page: https://npm.io/package/component-auto-local

## Dependencies (3)

- [glob](https://npm.io/package/glob.md) ^4.0.0
- [debug](https://npm.io/package/debug.md) ^0.8.1
- [ficent](https://npm.io/package/ficent.md) ^1.0

## Alternatives

- [messageformat](https://npm.io/package/messageformat.md) — 329.7K weekly downloads
- [@mintlify/scraping](https://npm.io/package/@mintlify/scraping.md) — 294.8K weekly downloads
- [@mintlify/previewing](https://npm.io/package/@mintlify/previewing.md) — 209.5K weekly downloads
- [@mintlify/prebuild](https://npm.io/package/@mintlify/prebuild.md) — 209.5K weekly downloads
- [@mintlify/link-rot](https://npm.io/package/@mintlify/link-rot.md) — 206.3K weekly downloads

## Recent versions

- 0.1.4 (latest) — 2016-01-05
- 0.1.3 — 2016-01-04
- 0.1.2 — 2015-12-22
- 0.1.0 — 2014-12-02
- 0.0.8 — 2014-06-02
- 0.0.7-3 — 2014-05-29
- 0.0.7-2 — 2014-05-29
- 0.0.7-1 — 2014-05-29
- 0.0.7 — 2014-05-27
- 0.0.6 — 2014-05-27
- 0.0.4 — 2014-05-21
- 0.0.3 — 2014-05-21
- 0.0.2 — 2014-05-21
- 0.0.0 — 2014-05-21

## README

#component-auto-local

> Updating `locals` of `component.json` in `paths`


## Purpose

When I use [component][comp], I need a way to expose my own local module easy.
`locals` and `path` of `component.json` have advantage - look clear, but annoying.

So I made automatic updater for `locals` in `paths`.

[comp]: https://github.com/component


## How to work

1. read all subdir of `paths`
2. if `locals` in `component.json` is not exist, remove it.
4. if subdir name isn`t start with option.ignorePrefix (default `!`), Add subdir to `locals`.
4. overwrite `component.json`


## How to use

I use this in `buider.coffee/js`,  but it is not forced.

```coffee
fs = require("fs")
resolve = require("component-resolver")
build = require("component-builder")
coffee = require("builder-coffee-script")
less = require("component-builder-less")


locals = require './component-auto-local'

locals (err)->
  # resolve the dependency tree
  resolve process.cwd(),
    
    # install the remote components locally
    install: true
  , (err, tree) ->
    throw err  if err
    
    # only include `.js` files from components' `.scripts` field
    console.log tree
    
    build.scripts(tree)
      .use("scripts", build.plugins.js())
      .use("scripts", coffee())
      .end (err, string) ->
        throw err  if err
        fs.writeFileSync "public/build/build.js", build.scripts.require +  string
        return

    
    # only include `.css` files from components' `.styles` field
    build.styles(tree).use("styles", build.plugins.css()).use("styles", less({})).end (err, string) ->
      throw err  if err
      fs.writeFileSync "public/build/build.css", string
      return

```  

## License

(The MIT License)

Copyright (c) 2014 junsik &lt;js@seth.h@google.com&gt;

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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