New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

trolly

Package Overview
Dependencies
Maintainers
1
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trolly

A boilerplate for creating isomorphic libraries using Babel, Webpack, Mocha, Chai, Karma, Isparta, and ESLint

  • 0.0.9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
52
decreased by-41.57%
Maintainers
1
Weekly downloads
 
Created
Source

Isomorphic boilerplate written in ES2015 for Node and the browser.

Travis Status Coverage Status Dependency Status

A boilerplate for creating isomorphic libraries using Babel, Webpack, Mocha, Chai, Karma, Isparta, and ESLint

Features

  • Babel for ES6 and ES7
  • Universal unit tests that work in Node and in the browser
  • Support for ES2015 in the unit tests
  • Webpack for bundling
  • Eslint to maintain a consistent code style
  • UMD pattern, which provides compatibility with the most popular script loaders, to the output.
  • Isparta for coverage report
  • Node >= 4.x

Basic guide

Write your code in src. The entry file is what you named the project in kebab case (although the filename can be changed).

Run webpack to build a non-minified version of the library.

Put your unit tests in the __tests__ folder. The npm test command runs the tests using Node.

Workflow

  • npm run build - Build task that generates minified scripts
  • npm run prepublish - Lint the source, run unit tests, and generate a minified script
  • npm run lint - Lint the source and unit tests
  • npm run clean - Remove the coverage report and the dist folder
  • npm run karma:browser - Runs the unit tests with karma and Chrome once
  • npm run karma:chrome - Runs the unit tests with karma and Chrome once
  • npm run karma:firefox - Runs the unit tests with karma and Firefox once
  • npm run karma:ie - Runs the unit tests with karma and Internet Explorer once
  • npm run karma:legacy - Runs the unit tests with karma and Internet Explorer 9.0 once
  • npm run karma:all - Runs the unit tests with karma and Chrome, Firefox and Internet Exploreronce
  • npm run karma:server - Runs the unit tests with karma and PhantomJS once
  • npm run karma:watch - Run Karma tests & watch files for changes
  • npm run mocha:browser - Runs the unit tests together with the spec runner ( open port 8080 in the browser)
  • npm run mocha:server - Runs the unit tests on the server once
  • npm run mocha:watch - Run Mocha tests & watch files for changes
  • npm run coverage - Run Isparta, a code coverage tool;
  • npm run packages - Shows all installed dependencies
  • npm run package:purge - Remove all dependencies
  • npm run package:reinstall - Reinstall all dependencies
  • npm run package:updates - Generate a list overview for newer dependencies
  • npm run package:upgrade - Automaticly upgrade all dependencies and update package.json

Unit tests

This project uses Mocha to run your unit tests, it uses Karma as the test runner, it enables the feature that you are able to render your tests to the browser (e.g: Firefox, Chrome etc.).

To run the tests in the project, just simply run npm karma:browser. If you have Chrome installed, it will be automatically launched as a test service for you. PhantomJs are used to run karma server side. Just simply run npm karma:server

To keep watching your test suites that you are working on, simply do run npm karma:watch for client side. Or run npm mocha:server to keep watching the unit tests on the server.

Browser Tests

The browser spec runner can be opened in a browser to run your tests. For it to work, you must first run npm run mocha:browser, and then open port 8080 in your browser. Example: localhost::8080

Coveralls

This library is set up to integrate with Coveralls, and will automaticly publish your coverage report if you have created an account for your repo at coveralls.io

Linting

This boilerplate uses ESLint to lint your source. To change the rules, edit the .eslintrc file in the root directory, respectively.

Installation

Download the package, and run this from the command line:

npm install 

Customizing

This boilerplate is easily customizable. Add your dependencies to the package.json file, and modify either the webpack config files or the karma files itself.

For the server side unit tests with mocha, you may want to install jsdom etc. This can be done if you modify the bootstrap.js file located inside the __tests__/setup folder

FAQ

###Help! It doesn't work on Windows! What do I do? Just take a cup of coffee and relax. It works!

What's the browser compatibility?

As a rule of thumb, this transpiler works best in IE9+. You can support IE8 by limiting yourself to a subset of ES2015 features. The Babel caveats page does an excellent job at explaining the nitty gritty details of supporting legacy browsers.

License

MIT © Kenny Flashlight

Keywords

FAQs

Package last updated on 05 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc