UNPKG

1.1 kBPlain TextView Raw
1#!/usr/bin/env node
2
3var path = require("path");
4var fs = require("fs");
5var resolve = require('resolve').sync;
6
7// path.existsSync was moved to fs.existsSync node 0.6 -> 0.8
8var existsFn = fs.existsSync || path.existsSync;
9
10var thisdir = path.dirname(fs.realpathSync(__filename));
11
12
13
14
15// This setup allows for VERY fast development. I clear the lib directory so
16// that every time coffeelint runs, it uses CoffeeScript to re-compile at
17// runtime.
18//
19// I use this so vim runs the newest code while I work on CoffeeLint. -Asa
20commandline = path.join(thisdir, '..', "lib", "commandline.js");
21if (!existsFn(commandline)) {
22 require('coffee-script/register');
23 require('../src/commandline');
24} else {
25 // This is the code path that everyone else is really going to use.
26 try {
27 // Try to find a project-specific install first. This works the same
28 // way grunt-cli does.
29 filepath = resolve('coffeelint', { basedir: process.cwd() });
30 commandline = path.dirname(filepath) + path.sep + 'commandline.js';
31 } catch (ex) {
32 }
33
34 require(commandline);
35}