Giter VIP home page Giter VIP logo

wrap's Introduction

wrap

Simple package bundle setup handler

This is more of a wrapper around my opinionated setup for developing packages, people build template repo's I built a tool, that's all.

The tool exists for the following things by being a single package to setup code style and bundling In detail, it tries to do the following.

  • Setup rollup with the needed plugins for package development
  • Handle adding a code style to the repo, either with standard or prettier
  • Minify the output and print size of the output
  • Support configuration with the original configuration options of the tools used (so .babelrc for babel, .prettierrc for prettier, etc)

Pros

  • Configured via package.json
  • Optionally add .babelrc to configure babel
  • Can use and configure buble (added in v0.0.6-dev.2, removed in v1.0.0)
  • Passive Dependency installer - does not install dependencies unless needed and if needed, they are added to your devDeps instead, helps keep wrap small and saves disk space for you (added in v0.0.6-dev.2)

Cons

  • Only built for bundling libraries and cli tools , doesn't build for browsers, though you can change .babelrc to kind of make something similar
  • Doesn't support inline addition of node dependencies (as of now) ncc would be a better alternative

Install

$ npm install -g @barelyhuman/wrap # global install
$ npm install @barelyhuman/wrap # local install

Usage

$ wrap # global install
$ npx wrap # local install

Also add the following to your package.json

// ...
"source":"source/index.js", // entry file *mandatory
"main":"dist/index.js", // output file *mandatory
"module":"dist/index.mjs", // esm module file
"scripts":{
  "build":"wrap",
}
// ...

You can also send the input file using the cli

"main":"dist/index.js", // output file *mandatory
"module":"dist/index.mjs", // esm module file
"scripts":{
  "build":"wrap -i source/index.js",
}

ClI

$ wrap -h

Usage
    $ wrap [options]
  Options
    -i, --input
    -f, --fix Run the standard linter and fixer on the current directory
    -w, --watch watch entry file and deps for changes
  Examples
    $ wrap
    ℹ Output written to dist/index.js
    ✔ Done

Configuration

While you can use .babelrc for handling babel and the standard key in the package.json can handle the standard configuration there are certain things you might want to send through to wrap.

package.json

"wrap":{
  // added in v1.0.0
  "inferExternal":true // if you set this as true rollup will try to dynamically understand what your external dependencies are
  // or
  "external":["fs","path"] // if you don't want it to dynamically infer,  then provide an array with them instead
}

FAQ

Why not use microbundle?

I actually didn't know about microbundle, I already built this by then and then felt like an idiot but I still like this. The only thing missing is the modern mode, which I'm fine without for the most part, when needed, I just use microbundle.

How do I contribute?

Same way you'd contribute to any other repo, raise an PR and wait for review

Why no tests!?

I'm still ideating on modifying things here and there and that means tests that keep changing, so it doesn't make sense in this particular case, also, test what? it's literally just running each tool's API internally, I'm just calling them.

Credits

To all creators that the lib depends on, THANKS A TON! I'm trying to sponsor and help back as much as I can, keep doing the good work.

License

MIT © Reaper

wrap's People

Contributors

barelyhuman avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

wrap's Issues

Add flags to specify which code style to setup

currently uses wrap.typescript to decide if it needs to setup prettier or standard , would want to change that to be able to choose which one to setup on demand.

Also,
reconsider if you want prettier to add a fix script or to run prettier internally using exec (open to discussion)

Reduce package size

Yeah it's just 19kb but the overall install goes over 400kb , specifically due to deps so

  • Reduce the use of deps, write simpler smaller sets of each functionality if you can
  • Reduce size of mandatory deps - barelyhuman/sizesnap#2
  • Clean up redundant code into functions where possible

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.