Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rmariuzzo/entrify
π¦ Library to convert package.json to index.js.
https://github.com/rmariuzzo/entrify
main monorepo package-json
Last synced: 3 months ago
JSON representation
π¦ Library to convert package.json to index.js.
- Host: GitHub
- URL: https://github.com/rmariuzzo/entrify
- Owner: rmariuzzo
- License: mit
- Created: 2017-11-16T22:28:46.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-20T23:03:04.000Z (about 7 years ago)
- Last Synced: 2024-10-11T07:10:35.048Z (3 months ago)
- Topics: main, monorepo, package-json
- Language: JavaScript
- Homepage:
- Size: 36.1 KB
- Stars: 3
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![entrify β Library to convert package.json to index.js.](banner.svg)
Some project has a `package.json` for each of component directories. This is with the benefit to be able to indicate the a main file per directory, which is nice. However, some tools like prettier and eslint, and features as webpack resolve/alias will not work properly.
To remediate this situation we have to create an `index.js` file for each of those `package.json`. That's where **entrify** shines β¨.
> π **Hey!** For the command line tool head to: [entrify-cli](https://github.com/rmariuzzo/entrify-cli).
## Installation
```shell
npm install entrify --save
```or
```shell
yarn add entrify
```## Usage
```js
const path = require('path')
const entrify = require('entrify')entrify(path.join(__dirname, './src/components'))
```**Before:**
```
src/components/
| -- button
| -- package.json (the main field points to `Button.js`)
| -- Button.js
```**After:**
```
src/components/
| -- button
| -- index.js (created in place of the package.json, it exports `Button.js`)
| -- Button.js
```## Documentation
### `entrify(directory)`
- **`directory`** β `String`.Β The directory to traverse.
- **`options`** β `Object`. Hash of options.
- **`format`** β `String`. Format of the `index.js` to create. Valid options are: `cjs` and `esm`.## Development
1. Clone and fork this repo.
2. Install dependencies: yarn or npm install.
3. [Run tests](#test).
4. Prepare a pull request.### Test
- `yarn test` β to run all tests.
- `yarn test -- --watch` β to run all tests in watch mode.### Publish
1. Bump package version: `yarn version --new-version x.x.x -m 'Version %s.'`.
2. Publish to NPM registry: `npm publish`.
3. Push new tag: `git push origin --tags`.Made with :heart: by [Rubens Mariuzzo](https://github.com/rmariuzzo).
[MIT license](LICENSE)