Code Monkey home page Code Monkey logo

entrify's Introduction

entrify – Library to convert package.json to index.js.

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.

Installation

npm install entrify --save

or

yarn add entrify

Usage

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.
  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 ❀️ by Rubens Mariuzzo.

MIT license

entrify's People

Contributors

rmariuzzo avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

isabella232

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.