Giter Site home page Giter Site logo

jaebradley / fruit Goto Github PK

View Code? Open in Web Editor NEW
58.0 4.0 5.0 2.77 MB

๐Ÿฅ๐Ÿ‹๐Ÿ๐Ÿ“๐ŸŠ๐Ÿ Automatically generate your rollup.js boilerplate ๐Ÿ’๐Ÿˆ๐Ÿ‡๐Ÿ‰๐Ÿ๐ŸŽ

License: MIT License

JavaScript 99.57% CSS 0.43%
rollup rollup-js library-boilerplate react boilerplate cli nodejs node

fruit's Introduction

fruit

Build your rollup.js boilerplate in seconds.1

build-status npm-version npm-total-downloads

๐Ÿฅ ๐Ÿ‹ ๐Ÿ ๐Ÿ“ ๐ŸŠ ๐Ÿ ๐Ÿฐ ๐Ÿ’ ๐Ÿˆ ๐Ÿ‡ ๐Ÿ‰ ๐Ÿ ๐ŸŽ ๐ŸŒ

Introduction

Two of the most-popular libraries used to bundle JavaScript are rollup and webpack.

The general consensus is that rollup should be used for building libraries and webpack should be used for building applications.

This is because webpack comes with features like hot module reloading (which has obvious benefits for applications) while rollup "scope hoists", which guarantees smaller bundles than webpack.

However, there is a decent amount of boilerplate associated with configuring a baseline rollup library (.eslintrc, travis.yml, .babelrc, jest, etc.).

fruit aims to generate rollup library boilerplate (using some preferred configuration options) so that you can start building your library right away.

Installation

npm install @jaebradley/fruit --global

Usage

Execute fruit via the command line and then follow the configuration options

configuration-options

which will install dependencies and generate a basic bundle, with "logic" for placeholder library exports.

bundle-generation

Configuration Options

Right now, there are two different types of libraries you can generate boilerplate for - Node and React.

Both come with

Node

Node Library Directory Structure (with commitlinting)

/some/project/path
โ”œโ”€โ”€ .babelrc
โ”œโ”€โ”€ .eslintignore
โ”œโ”€โ”€ .eslintrc
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ .npmignore
โ”œโ”€โ”€ .travis.yml
โ”œโ”€โ”€ build
|  โ”œโ”€โ”€ index.cjs.js
|  โ”œโ”€โ”€ index.esm.js
|  โ””โ”€โ”€ index.js
โ”œโ”€โ”€ commitlint.config.js
โ”œโ”€โ”€ package-lock.json
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ rollup.config.js
โ””โ”€โ”€ src
   โ”œโ”€โ”€ index.js
   โ””โ”€โ”€ index.test.js

React

This option also comes with the following additional dependencies

Production Dependencies

  • react
  • react-dom
  • prop-types

Development Dependencies

It also comes with Storybook which makes it easy to display different component use-cases.

You can run Storybook locally, on port 6006 by executing the storybook npm script (npm run storybook).

React Library Directory Structure (with commitlinting)

/some/project/path
โ”œโ”€โ”€ .babelrc
โ”œโ”€โ”€ .eslintignore
โ”œโ”€โ”€ .eslintrc
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ .npmignore
โ”œโ”€โ”€ .storybook
|  โ”œโ”€โ”€ addons.js
|  โ”œโ”€โ”€ config.js
|  โ””โ”€โ”€ webpack.config.js
โ”œโ”€โ”€ .travis.yml
โ”œโ”€โ”€ build
|  โ”œโ”€โ”€ index.cjs.css
|  โ”œโ”€โ”€ index.cjs.js
|  โ”œโ”€โ”€ index.css
|  โ”œโ”€โ”€ index.esm.css
|  โ”œโ”€โ”€ index.esm.js
|  โ””โ”€โ”€ index.js
โ”œโ”€โ”€ commitlint.config.js
โ”œโ”€โ”€ package-lock.json
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ rollup.config.js
โ””โ”€โ”€ src
   โ”œโ”€โ”€ AnExample
   |  โ”œโ”€โ”€ AnExample.scss
   |  โ”œโ”€โ”€ AnExample.stories.jsx
   |  โ”œโ”€โ”€ AnExample.test.jsx
   |  โ””โ”€โ”€ index.jsx
   โ”œโ”€โ”€ AnotherExample
   |  โ”œโ”€โ”€ AnotherExample.scss
   |  โ”œโ”€โ”€ AnotherExample.stories.jsx
   |  โ”œโ”€โ”€ AnotherExample.test.jsx
   |  โ””โ”€โ”€ index.jsx
   โ”œโ”€โ”€ index.js
   โ””โ”€โ”€ setupTest.js

commitlint

I like commitlinting.

If you select the commitlint feature, it'll add the following development dependencies

and the following npm scripts

  • commitmsg
    • A commit message .git hook that will trigger commitlint
  • gc

semantic-release

I like to automate package deployment using semantic-release.

If you select the semantic-release feature, the following dependencies will be added

along with the following npm scripts

  • deploy
    • which will trigger the semantic-release deploy process
  • semantic-release (for use in npm run deploy)
  • travis-deploy-once (for use in npm run deploy)

Footnotes

1 Ok, maybe more like "many seconds" (โ˜• time?)

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.