{"action":"created","issue":{"url":"https://api.github.com/repos/jhipster/jdl-studio/issues/27","repository_url":"https://api.github.com/repos/jhipster/jdl-studio","labels_url":"https://api.github.com/repos/jhipster/jdl-studio/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/jhipster/jdl-studio/issues/27/comments","events_url":"https://api.github.com/repos/jhipster/jdl-studio/issues/27/events","html_url":"https://github.com/jhipster/jdl-studio/issues/27","id":197435551,"number":27,"title":"gulp build starting from jhipster-core V1.2.3 fails","user":{"login":"kaidohallik","id":23017435,"avatar_url":"https://avatars.githubusercontent.com/u/23017435?v=3","gravatar_id":"","url":"https://api.github.com/users/kaidohallik","html_url":"https://github.com/kaidohallik","followers_url":"https://api.github.com/users/kaidohallik/followers","following_url":"https://api.github.com/users/kaidohallik/following{/other_user}","gists_url":"https://api.github.com/users/kaidohallik/gists{/gist_id}","starred_url":"https://api.github.com/users/kaidohallik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaidohallik/subscriptions","organizations_url":"https://api.github.com/users/kaidohallik/orgs","repos_url":"https://api.github.com/users/kaidohallik/repos","events_url":"https://api.github.com/users/kaidohallik/events{/privacy}","received_events_url":"https://api.github.com/users/kaidohallik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-23T23:05:00Z","updated_at":"2016-12-24T11:10:20Z","closed_at":null,"body":"**Overview of the issue**\r\n\r\nStarting from jhipster-core version v1.2.3 JDL Studio `gulp build` fails with error:\r\n```\r\nevents.js:160\r\n      throw er; // Unhandled 'error' event\r\n      ^\r\nError\r\n    at new JS_Parse_Error (eval at <anonymous> (c:\\projects\\kaido-github\\jdl-studio\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:1526:18)\r\n    at js_error (eval at <anonymous> (c:\\projects\\kaido-github\\jdl-studio\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:1534:11)\r\n    at parse_error (eval at <anonymous> (c:\\projects\\kaido-github\\jdl-studio\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:1647:9)\r\n    at Object.next_token [as input] (eval at <anonymous> (c:\\projects\\kaido-github\\jdl-studio\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:1912:9)\r\n    at next (eval at <anonymous> (c:\\projects\\kaido-github\\jdl-studio\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2012:25)\r\n    at eval (eval at <anonymous> (c:\\projects\\kaido-github\\jdl-studio\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2134:42)\r\n    at eval (eval at <anonymous> (c:\\projects\\kaido-github\\jdl-studio\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2073:24)\r\n    at block_ (eval at <anonymous> (c:\\projects\\kaido-github\\jdl-studio\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2353:20)\r\n    at eval (eval at <anonymous> (c:\\projects\\kaido-github\\jdl-studio\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2326:25)\r\n    at function_ (eval at <anonymous> (c:\\projects\\kaido-github\\jdl-studio\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2331:15)\r\n```\r\n\r\n**Reproduce the error**\r\n\r\n* fork and clone [JDL Studio](https://github.com/jhipster/jdl-studio)\r\n* in `bower.json` change from\r\n```\r\n\"pegjs_parser\": \"https://raw.githubusercontent.com/jhipster/jhipster-core/v1.1.5/lib/dsl/pegjs_parser.js\",\r\n```\r\nto (error occurs with versions 1.2.3 and 1.2.4)\r\n```\r\n\"pegjs_parser\": \"https://raw.githubusercontent.com/jhipster/jhipster-core/v1.2.4/lib/dsl/pegjs_parser.js\",\r\n```\r\nhint: can reference to local version, for example if `jhipster-core` and `jdl-studio` are cloned into same parent folder then reference is:\r\n```\r\n\"pegjs_parser\": \"../jhipster-core/lib/dsl/pegjs_parser.js\",\r\n```\r\n* `bower install`\r\n* `gulp build`\r\n\r\n**Related issues**\r\n\r\nAt first opened that in jhipster-core project jhipster/jhipster-core#98\r\n\r\n**Suggest a Fix**\r\n\r\nAfter debugging `gulpfile.js` with\r\n`.pipe(gulpIf('*.js', uglify().on('error', function(e){console.log(e);})))`\r\nfound that error occurs in line\r\n``peg$c73 = function(head, tail) { return `${head}${tail.join('')}`; },``\r\nerror is:\r\n``Unexpected character \\'`\\'``\r\n\r\nSeems that changes from jhipster-core commit [used more ES2015 features](https://github.com/jhipster/jhipster-core/commit/40c8c8ffd995e1f9b010ebe95c39d937f024e320) is causing this.\r\n\r\nSeems that must add ES2015 support to JDL Studio `gulpfile.js`.\r\nGoogling results that [Babel](https://github.com/babel/gulp-babel) is suitable for that, in `package.json` add `\"gulp-babel\": \"6.1.2\"` and in `gulpfile.js` add `babel = require('gulp-babel')`\r\n1. Babel can be used with babel-preset-es2015, in `package.json` add `\"babel-preset-es2015\": \"6.18.0\"` and in `gulpfile.js` add `.pipe(babel({presets: ['es2015']})).pipe(uglify())`\r\n2. Babel can be used with [babili](https://github.com/babel/babili) like that: `.pipe(babel({presets: ['babili']}))`\r\n\r\nAdditional note: starting from jhipster-core version v1.2.3 JDL internal comments `//.....` are not parsed with pegjs_parser.js any more. These are removed before passing JDL to pegjs_parser.js. It's possible that must adapt that change separately in JDL Studio."},"comment":{"url":"https://api.github.com/repos/jhipster/jdl-studio/issues/comments/269080069","html_url":"https://github.com/jhipster/jdl-studio/issues/27#issuecomment-269080069","issue_url":"https://api.github.com/repos/jhipster/jdl-studio/issues/27","id":269080069,"user":{"login":"deepu105","id":1107223,"avatar_url":"https://avatars.githubusercontent.com/u/1107223?v=3","gravatar_id":"","url":"https://api.github.com/users/deepu105","html_url":"https://github.com/deepu105","followers_url":"https://api.github.com/users/deepu105/followers","following_url":"https://api.github.com/users/deepu105/following{/other_user}","gists_url":"https://api.github.com/users/deepu105/gists{/gist_id}","starred_url":"https://api.github.com/users/deepu105/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deepu105/subscriptions","organizations_url":"https://api.github.com/users/deepu105/orgs","repos_url":"https://api.github.com/users/deepu105/repos","events_url":"https://api.github.com/users/deepu105/events{/privacy}","received_events_url":"https://api.github.com/users/deepu105/received_events","type":"User","site_admin":false},"created_at":"2016-12-24T11:10:19Z","updated_at":"2016-12-24T11:10:19Z","body":"can you do a PR? I dont like the idea of using pre processors but if there is no choice here then I would prefer to use babel with babel-preset-es2015 (your first option)"}}
{"actor":{"display_login":"deepu105"}}