Skip to content

Commit

Permalink
Merge pull request #5 from paulvollmer/develop
Browse files Browse the repository at this point in the history
v0.1.0
  • Loading branch information
paulvollmer authored Jan 29, 2018
2 parents 14d0e29 + e474ab0 commit 8abf7b3
Show file tree
Hide file tree
Showing 23 changed files with 11,818 additions and 648 deletions.
61 changes: 60 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,60 @@
/node_modules
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

build
20 changes: 16 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
BIN = ./node_modules/.bin
LINT_SRC = webpack.config.js cmd/jsonfix src test

all: lint test

lint:
@$(BIN)/eslint .
@$(BIN)/eslint ${LINT_SRC}

lint-fix:
@$(BIN)/eslint --fix .
@$(BIN)/eslint --fix ${LINT_SRC}

test:
@$(BIN)/mocha
@$(BIN)/mocha test/*.test.js

build:
@$(BIN)/webpack --progress -p

clean:
rm -rf web/build

serve:
@$(BIN)/serve

.PHONY: lint lint-fix test
.PHONY: lint lint-fix test build clean serve
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ cd into the directory

fix some broken json data

./cli test/fixture/broken.json
./cmd/jsonfix test/fixture/broken.json

## At the Browser
You can find a demo at http://paulvollmer.github.io/jsonfix/web
You can find a demo at https://paulvollmernet/jsonfix/web


## Author
Expand Down
28 changes: 0 additions & 28 deletions cli

This file was deleted.

32 changes: 32 additions & 0 deletions cmd/jsonfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env node

'use strict';

let fs = require('fs');
let JSONFix = require('../src/jsonfix');

if (process.argv.length === 2) {
process.stderr.write('missing input file\n');
process.exit(1);
} else if (process.argv.length === 3) {
let filepath = process.argv[2];
fs.readFile(filepath, {encoding: 'utf8'}, function(err, data) {
if (err !== null) {
process.stderr.write('cannot read file "'+process.argv[2]+'"\n');
process.exit(1);
} else {
let result = JSONFix.process(data);

// debug stuff
// console.log('============');
// console.log('isValid = '+JSONFix.isValid);
// console.log('wasFixed = '+JSONFix.wasFixed);
// console.log('message = '+JSONFix.message);
// console.log('totalTries = '+JSONFix.stats.totalTries);
// console.log(JSON.stringify(JSONFix, null, 2));
// console.log('============');

process.stdout.write(JSON.stringify(result, null, 2)+'\n');
}
});
}
Loading

0 comments on commit 8abf7b3

Please sign in to comment.