npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

transpilr

v1.0.1

Published

transpile, watch, bundle and minify new javascript versions (es6 and newer) to older version es5

Downloads

11

Readme

Transpilr

Live transpile latest versions of Javascript (es2015 and newer) to older version (es5) for older browser support. Transpilr allows you to watch source files/directory, transpile, bundle and minify the output to your specified directory/file.

Getting Started

These instructions will guide you through installing and including transpilr in your project.

Prerequisites

You need node and npm installed on your machine

Installation

transpilr is available on npm and is installed by running the following command in your terminal

npm install transpilr --save-dev

note that transpilr can also be installed globally

npm install transpilr -g

Usage

transpilr is simple to use and doesn't required any configuration. You will only ever need to call one function.

Code:

const transpilr = require('transpilr');

//transpiler configurations
let options = {
    sourcesPaths: ['inputFile.js'],
    outputPath: 'outputFile.js',
    minify: false,
    watch: false,
    all: true
}

//callback function invoked everytime a file has been transpiled successfully
const callback = (options) => {
    console.log(`${options.sourceFiles} -> ${options.outputFile}`);
}

//call this to transpile
transpilr.transpile(options, callback);

Parameter descriptions

  • Options: ~ required
    • sourcePaths: ~ required ~ provide source directory/file path(s). Accpets multiple values in array of string
    • outputPath: ~ required ~ string value to provide output directory/file path
    • Minify: ~ optional ~ boolean value to indicate that the output should be minify
    • Watch: ~ optional ~ boolean value to indicate that the output should be updated on every single change and save of the source files
    • all: ~ optional ~ boolean value to indicate that all javascript files including spec/test files should be transpiled
  • Callback: ~ optional ~ is called on completion of the process.

Command Line:

the command keyword is transpilr and requires at mininum a source file/directory path and an output file/directory path

transpilr <sources..> -o <output> [-w] [-m] [-a] [-l]

Command Parameters:

  • sources : ~ required ~ should be listed right after the command keyword transpilr . It takes single or multiple file/direcotry path(s) separated with a space
  • output : ~ required ~ takes the output file/directory path. note that this value has to always be preceded by the flag -o
  • -w : ~ optional ~ flag to watch source and update output on change.
  • -m : ~ optional ~ flag to minify output. note that .min.js will be added to the output file name.
  • -a : ~ optional ~ flag to transpile all javascript file in source file/directory. by default spec/test files are ignored
  • -l : ~ optional ~ flag to turn on loud process that outputs results on the terminal.

examples:

transpilr inputFile.js -o outputfile.js

the above example transpile inputFile.js to outputfile.js. and for multiple sources, you can do the following

transpilr inputFile1.js inputFile2.js inputDirectory1 -o outputdirectory

note that when you provide multiple sources and provide a file path as output, the result is bundled as shown below

transpilr inputFile1.js inputFile2.js inputDirectory1 -o bundledOutput.js

you can add any or combinaison of optional flags to affect the command behavior.

transpilr inputFile1.js -o outputFile.js -m -w -l -a

Other Useful Paramaters:

  • -h : shows help
transpilr -h
  • --version: shows version number
transpilr --version

Authors

See also the list of contributors who participated in this project.