Skip to content

Commit

Permalink
Add generated parser to NPM package
Browse files Browse the repository at this point in the history
PEG.js is not required to run the parser - move package to dev dependencies
  • Loading branch information
mbaumgartl committed Jul 2, 2018
1 parent 7082df6 commit dfc7891
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
node_modules/
build/

# generated parser
pegjs-parser.js

# Bamboo build output
mocha.json
3 changes: 1 addition & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ module.exports = function (grunt) {
coverage: {
src: 'test',
options: {
excludes: ['pegjs-parser.js'],
coverageFolder: 'build',
reportFormats: ['clover', 'lcov']
}
Expand All @@ -37,7 +36,7 @@ module.exports = function (grunt) {

exec: {
createParser: {
cmd: './node_modules/.bin/pegjs -o pegjs-parser.js sql.pegjs'
cmd: './node_modules/.bin/pegjs -o build/pegjs-parser.js sql.pegjs'
}
},
});
Expand Down
2 changes: 1 addition & 1 deletion lib/parser.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const parseFn = require('./../pegjs-parser').parse;
const parseFn = require('./../build/pegjs-parser').parse;

class Parser {
parse(sql) {
Expand Down
15 changes: 11 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Parse SQL (select) statements into abstract syntax tree (AST) and convert ASTs back to SQL.",
"main": "index.js",
"scripts": {
"install": "./node_modules/.bin/pegjs -o pegjs-parser.js sql.pegjs",
"build": "./node_modules/.bin/pegjs -o build/pegjs-parser.js sql.pegjs",
"test": "./node_modules/.bin/grunt test",
"lint": "grunt lint"
},
Expand All @@ -31,6 +31,13 @@
"email": "mark.plomer@boerse-go.de"
}
],
"files": [
"index.js",
"lib/",
"build/pegjs-parser.js",
"README.md",
"LICENSE"
],
"license": "MIT",
"repository": "godmodelabs/flora-sql-parser",
"homepage": "https://github.com/godmodelabs/flora-sql-parser",
Expand All @@ -39,8 +46,7 @@
},
"dependencies": {
"flora-errors": "^0.8.0",
"has": "^1.0.3",
"pegjs": "^0.10.0"
"has": "^1.0.3"
},
"devDependencies": {
"chai": "^4.1.2",
Expand All @@ -56,6 +62,7 @@
"istanbul": "^0.4.2",
"load-grunt-tasks": "^4.0.0",
"mocha": "^5.2.0",
"mocha-bamboo-reporter": "^1.1.1"
"mocha-bamboo-reporter": "^1.1.1",
"pegjs": "^0.10.0"
}
}

0 comments on commit dfc7891

Please sign in to comment.