Giter VIP home page Giter VIP logo

ti-stealth's Introduction

Ti Stealth Appcelerator Titanium Appcelerator Alloy

CLI and CommonJS module to replace console log calls with NOOPs which can later be restored.

Install npm

As global CLI:

[sudo] npm install -g ti-stealth

As a dependency in your projects package.json:

{
  "name": "your-project",
  "dependencies": {
    "ti-stealth": "*"
  }
}

Quick Start

Stealth can be used both as CLI and CommonJS module.

Alloy.JMK

The number one usage for this package is to remove all other then error logging from production builds. The included example alloy.jmk can be dropped in your Alloy project's app folder or merged with whatever you have there. It will automatically stealth all the logs calls when you build for production (includes Ad Hoc), without changing anything in your app folder.

CLI

Hit ti-stealth -h for full usage, but these examples should do:

  • Processes all JS under the CWD to stealth all log calls:

     ~/myproject $ ti-stealth enable
    
  • Processes the given directory to stealth only debug and info level calls:

     $ ti-stealth enable ~/myproject -l debug,info
    
  • Processes the given file to stealth all but error level caals:

     $ ti-stealth enable ~/myproject/app/alloy.js -n error
    
  • Processes the given file to restore all stealthed info level log calls:

     $ ti-stealth restore ~/myproject/app/alloy.js -l info
    
  • Process the given code:

     $ ti-stealth enable "Ti.API.info('hello world')"
    

    Pretty useless in CLI, but nice via the module ;)

Module

If you use Stealth as a CommonJS module pass the input as the first argument and the options as the second. You will be returned an array of files changed:

var stealth = require('ti-stealth');

stealth.enable('/usr/admin/myproject', {
	notLevels: ['error']
});

Some notes:

  • You can also pass the options as the first argument and have a input property.
  • Levels can be given as CSV as well.
  • You can use both short and long option names.

Tests Travis

  1. Install node.js.
  2. Install grunt: [sudo] npm install -g grunt-cli
  3. Clone the repo: git clone https://github.com/fokkezb/ti-stealth.git && cd ti-stealth && npm install
  4. Run tests: grunt test

Issues

Please report issues and features requests in the repo's issue tracker.

License

Distributed under MIT License.

ti-stealth's People

Contributors

fokkezb avatar

Watchers

James Cloos avatar Winson avatar

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.