Skip to content
This repository has been archived by the owner on Aug 7, 2020. It is now read-only.

Commit

Permalink
* npm publishing bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Polo committed Nov 29, 2010
1 parent 5e9f855 commit 296f2d6
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 99 deletions.
196 changes: 98 additions & 98 deletions bin/node-lint
Original file line number Diff line number Diff line change
Expand Up @@ -15,115 +15,115 @@ var Launcher = lint.Launcher;



if (__filename === process.ARGV[1]) {
var usage, args, positionals, launcher, options, configFile;

//called as main executable

usage = "Usage: " + process.ARGV[0] + " file.js [dir1 file2 dir2 ...] [options]\n" +
"Options:\n\n" +
" --config=FILE the path to a JSON file with JSLINT options\n" +
" --formatter=FILE optional path to a /dir/dir/file.hs file to customize the output\n" +
" -h, --help display this help and exit\n" +
" -v, --version output version information and exit";

args = process.ARGV.splice(2);
positionals = [];
options = {
formatter: {
},
parser: {
}
};
configFile = process.env.NODELINT_CONFIG_FILE;

launcher = new Launcher();
while (args.length !== 0) {
arg = args.shift();
switch (arg) {
case '-v':
case '--version':
var content, pkg;
content = fs.readFileSync(path.join(__filename, '..', '..', '..', 'package.json'), 'utf8');
pkg = JSON.parse(content);
util.puts(pkg.version);
process.exit(0);
break;
case '-h':
case '--help':
util.puts(usage);
process.exit(0);
break;
case '--silent':
options.silent = true;
break;
case '--pretty':
options.formatter.pretty = true;
break;
case '--no-color':
case '--no-colors':
options.formatter.colors = false;
break;
default:
if (arg.indexOf('--formatter') >= 0) {
options.formatter.type = 'callback';
options.formatter.callback = fs.readFileSync(arg.split('=')[1], 'utf8');
} else if (arg.indexOf('--format') >= 0) {
options.formatter.type = arg.split('=')[1];
} else if (arg.indexOf('--mode') >= 0) {
options.formatter.mode = arg.split('=')[1];
} else if (arg.indexOf('--config') >= 0) {
var file, source;

configFile = arg.split('=')[1];

} else {
positionals.push(arg);
}

var usage, args, positionals, launcher, options, configFile;

//called as main executable

usage = "Usage: " + process.ARGV[0] + " file.js [dir1 file2 dir2 ...] [options]\n" +
"Options:\n\n" +
" --config=FILE the path to a JSON file with JSLINT options\n" +
" --formatter=FILE optional path to a /dir/dir/file.hs file to customize the output\n" +
" -h, --help display this help and exit\n" +
" -v, --version output version information and exit";

args = process.ARGV.splice(2);
positionals = [];
options = {
formatter: {
},
parser: {
}
};
configFile = process.env.NODELINT_CONFIG_FILE;

launcher = new Launcher();
while (args.length !== 0) {
arg = args.shift();
switch (arg) {
case '-v':
case '--version':
var content, pkg;
content = fs.readFileSync(path.join(__filename, '..', '..', '..', 'package.json'), 'utf8');
pkg = JSON.parse(content);
util.puts(pkg.version);
process.exit(0);
break;
case '-h':
case '--help':
util.puts(usage);
process.exit(0);
break;
case '--silent':
options.silent = true;
break;
case '--pretty':
options.formatter.pretty = true;
break;
case '--no-color':
case '--no-colors':
options.formatter.colors = false;
break;
default:
if (arg.indexOf('--formatter') >= 0) {
options.formatter.type = 'callback';
options.formatter.callback = fs.readFileSync(arg.split('=')[1], 'utf8');
} else if (arg.indexOf('--format') >= 0) {
options.formatter.type = arg.split('=')[1];
} else if (arg.indexOf('--mode') >= 0) {
options.formatter.mode = arg.split('=')[1];
} else if (arg.indexOf('--config') >= 0) {
var file, source;

configFile = arg.split('=')[1];

} else {
positionals.push(arg);
}
}
}

//Load default config file from environment
if (configFile) {
var source;

//Load default config file from environment
if (configFile) {
var source;

//read config file
try {
source = fs.readFileSync(configFile, 'utf8');
} catch (e) {
launcher.printError('Read error when accessing "' + configFile + '".');
}

//Remove comments
source = source.replace(/\/\*.+?\*\/|\/\/.*(?=[\n\r])/g, '');

//Parse config
try {
source = JSON.parse(source);
} catch (e) {
console.log(e.toString());
launcher.printError('Parse Error in "' + configFile + '"');
}


try {
launcher.configure(source);
} catch (e) {
console.log(e.toString());
launcher.printError('Parse Error in "' + configFile + '"');
}
//read config file
try {
source = fs.readFileSync(configFile, 'utf8');

This comment has been minimized.

Copy link
@fd

fd Dec 8, 2010

fs is missing...

This comment has been minimized.

Copy link
@jpolo

jpolo Dec 8, 2010

Owner

Corrected & published on npm. Thanks

This comment has been minimized.

Copy link
@fd

fd Dec 8, 2010

thanks!

} catch (e) {
launcher.printError('Read error when accessing "' + configFile + '".');
}

//Remove comments
source = source.replace(/\/\*.+?\*\/|\/\/.*(?=[\n\r])/g, '');

//Parse config
try {
launcher.configure(options);
source = JSON.parse(source);
} catch (e) {
launcher.printError('Configuration : ' + e.toString());
console.log(e.toString());
launcher.printError('Parse Error in "' + configFile + '"');
}


try {
launcher.run(positionals);
launcher.configure(source);
} catch (e) {
launcher.printError('Execution : ' + e.toString());
console.log(e.toString());
launcher.printError('Parse Error in "' + configFile + '"');
}
}

try {
launcher.configure(options);
} catch (e) {
launcher.printError('Configuration : ' + e.toString());
}

try {
launcher.run(positionals);
} catch (e) {
launcher.printError('Execution : ' + e.toString());
}


2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lint",
"description": "This package provide lint validation library + node-lint command line tool allows you to check for problems using JSLint. You can specify your own --config file to use alternate JSLint options and your own --formatter file if you want to customize the generated output.",
"version": "0.1.1",
"version": "0.1.2",
"homepage": "https://github.com/as-jpolo/node-lint",
"author": "tav <tav@espians.com> (http://tav.espians.com)",
"contributors": [
Expand Down

0 comments on commit 296f2d6

Please sign in to comment.