{"action":"created","comment":{"url":"https://api.github.com/repos/api-platform/client-generator/pulls/comments/142897277","pull_request_review_id":67325923,"id":142897277,"diff_hunk":"@@ -0,0 +1,98 @@\n+import fs from 'fs';\n+import handlebars from 'handlebars';\n+import mkdirp from 'mkdirp';\n+import { sprintf } from 'sprintf-js';\n+import urlapi from 'url';\n+\n+export default class {\n+  templates = {};\n+\n+  constructor({hydraPrefix, templateDirectory}) {\n+    this.hydraPrefix = hydraPrefix;\n+    this.templateDirectory = templateDirectory;\n+\n+    this.registerTemplates('', ['_entrypoint.js']);\n+  }\n+\n+  registerTemplates(basePath, paths) {\n+    for (let path of paths) {\n+      this.templates[path] = handlebars.compile(fs.readFileSync(`${this.templateDirectory}/${basePath}${path}`).toString());","path":"src/generators/BaseGenerator.js","position":19,"original_position":19,"commit_id":"875e88ac87bf6c2ba8467b967b77e02a4e0a0b2d","original_commit_id":"875e88ac87bf6c2ba8467b967b77e02a4e0a0b2d","user":{"login":"dunglas","id":57224,"avatar_url":"https://avatars2.githubusercontent.com/u/57224?v=4","gravatar_id":"","url":"https://api.github.com/users/dunglas","html_url":"https://github.com/dunglas","followers_url":"https://api.github.com/users/dunglas/followers","following_url":"https://api.github.com/users/dunglas/following{/other_user}","gists_url":"https://api.github.com/users/dunglas/gists{/gist_id}","starred_url":"https://api.github.com/users/dunglas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dunglas/subscriptions","organizations_url":"https://api.github.com/users/dunglas/orgs","repos_url":"https://api.github.com/users/dunglas/repos","events_url":"https://api.github.com/users/dunglas/events{/privacy}","received_events_url":"https://api.github.com/users/dunglas/received_events","type":"User","site_admin":false},"body":"In this case (1-time file generation) synchronous IO is exactly what we want!","created_at":"2017-10-05T10:05:17Z","updated_at":"2017-10-05T10:05:17Z","html_url":"https://github.com/api-platform/client-generator/pull/42#discussion_r142897277","pull_request_url":"https://api.github.com/repos/api-platform/client-generator/pulls/42","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/api-platform/client-generator/pulls/comments/142897277"},"html":{"href":"https://github.com/api-platform/client-generator/pull/42#discussion_r142897277"},"pull_request":{"href":"https://api.github.com/repos/api-platform/client-generator/pulls/42"}},"in_reply_to_id":142891931},"pull_request":{"url":"https://api.github.com/repos/api-platform/client-generator/pulls/42","id":144852949,"html_url":"https://github.com/api-platform/client-generator/pull/42","diff_url":"https://github.com/api-platform/client-generator/pull/42.diff","patch_url":"https://github.com/api-platform/client-generator/pull/42.patch","issue_url":"https://api.github.com/repos/api-platform/client-generator/issues/42","number":42,"state":"open","locked":false,"title":"Factorize code between generators. Don't overwrite existing files.","user":{"login":"dunglas","id":57224,"avatar_url":"https://avatars2.githubusercontent.com/u/57224?v=4","gravatar_id":"","url":"https://api.github.com/users/dunglas","html_url":"https://github.com/dunglas","followers_url":"https://api.github.com/users/dunglas/followers","following_url":"https://api.github.com/users/dunglas/following{/other_user}","gists_url":"https://api.github.com/users/dunglas/gists{/gist_id}","starred_url":"https://api.github.com/users/dunglas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dunglas/subscriptions","organizations_url":"https://api.github.com/users/dunglas/orgs","repos_url":"https://api.github.com/users/dunglas/repos","events_url":"https://api.github.com/users/dunglas/events{/privacy}","received_events_url":"https://api.github.com/users/dunglas/received_events","type":"User","site_admin":false},"body":"| Q             | A\r\n| ------------- | ---\r\n| Bug fix?      | yes\r\n| New feature?  | yes\r\n| BC breaks?    | no\r\n| Deprecations? | no\r\n| Tests pass?   | yes\r\n| Fixed tickets | n/a\r\n| License       | MIT\r\n| Doc PR        | n/a\r\n\r\n* Factorize the code between generators (introduce a new `BaseGenerator` class\r\n* Simplify the code by leveraging the new features of `api-doc-parser` (remove `util` and `entrypoint`)\r\n* Never overwrite an existing file (e.g.: `_entrypoint.js`), but warn in some cases if it already exists\r\n* Remove the term `Crud` from files as it has been removed from the package name\r\n\r\nping @alOneh (this PR changes the VueJS generator tool).","created_at":"2017-10-05T08:16:19Z","updated_at":"2017-10-05T10:05:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7efb4f3c0d8315addf0e15c38986b9521df6e6ad","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/api-platform/client-generator/pulls/42/commits","review_comments_url":"https://api.github.com/repos/api-platform/client-generator/pulls/42/comments","review_comment_url":"https://api.github.com/repos/api-platform/client-generator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/api-platform/client-generator/issues/42/comments","statuses_url":"https://api.github.com/repos/api-platform/client-generator/statuses/875e88ac87bf6c2ba8467b967b77e02a4e0a0b2d","head":{"label":"dunglas:refactoring","ref":"refactoring","sha":"875e88ac87bf6c2ba8467b967b77e02a4e0a0b2d","user":{"login":"dunglas","id":57224,"avatar_url":"https://avatars2.githubusercontent.com/u/57224?v=4","gravatar_id":"","url":"https://api.github.com/users/dunglas","html_url":"https://github.com/dunglas","followers_url":"https://api.github.com/users/dunglas/followers","following_url":"https://api.github.com/users/dunglas/following{/other_user}","gists_url":"https://api.github.com/users/dunglas/gists{/gist_id}","starred_url":"https://api.github.com/users/dunglas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dunglas/subscriptions","organizations_url":"https://api.github.com/users/dunglas/orgs","repos_url":"https://api.github.com/users/dunglas/repos","events_url":"https://api.github.com/users/dunglas/events{/privacy}","received_events_url":"https://api.github.com/users/dunglas/received_events","type":"User","site_admin":false},"repo":{"id":104038822,"name":"client-generator","full_name":"dunglas/client-generator","owner":{"login":"dunglas","id":57224,"avatar_url":"https://avatars2.githubusercontent.com/u/57224?v=4","gravatar_id":"","url":"https://api.github.com/users/dunglas","html_url":"https://github.com/dunglas","followers_url":"https://api.github.com/users/dunglas/followers","following_url":"https://api.github.com/users/dunglas/following{/other_user}","gists_url":"https://api.github.com/users/dunglas/gists{/gist_id}","starred_url":"https://api.github.com/users/dunglas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dunglas/subscriptions","organizations_url":"https://api.github.com/users/dunglas/orgs","repos_url":"https://api.github.com/users/dunglas/repos","events_url":"https://api.github.com/users/dunglas/events{/privacy}","received_events_url":"https://api.github.com/users/dunglas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dunglas/client-generator","description":"Generate a CRUD application built with React, Redux and React Router from an Hydra-enabled API","fork":true,"url":"https://api.github.com/repos/dunglas/client-generator","forks_url":"https://api.github.com/repos/dunglas/client-generator/forks","keys_url":"https://api.github.com/repos/dunglas/client-generator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dunglas/client-generator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dunglas/client-generator/teams","hooks_url":"https://api.github.com/repos/dunglas/client-generator/hooks","issue_events_url":"https://api.github.com/repos/dunglas/client-generator/issues/events{/number}","events_url":"https://api.github.com/repos/dunglas/client-generator/events","assignees_url":"https://api.github.com/repos/dunglas/client-generator/assignees{/user}","branches_url":"https://api.github.com/repos/dunglas/client-generator/branches{/branch}","tags_url":"https://api.github.com/repos/dunglas/client-generator/tags","blobs_url":"https://api.github.com/repos/dunglas/client-generator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dunglas/client-generator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dunglas/client-generator/git/refs{/sha}","trees_url":"https://api.github.com/repos/dunglas/client-generator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dunglas/client-generator/statuses/{sha}","languages_url":"https://api.github.com/repos/dunglas/client-generator/languages","stargazers_url":"https://api.github.com/repos/dunglas/client-generator/stargazers","contributors_url":"https://api.github.com/repos/dunglas/client-generator/contributors","subscribers_url":"https://api.github.com/repos/dunglas/client-generator/subscribers","subscription_url":"https://api.github.com/repos/dunglas/client-generator/subscription","commits_url":"https://api.github.com/repos/dunglas/client-generator/commits{/sha}","git_commits_url":"https://api.github.com/repos/dunglas/client-generator/git/commits{/sha}","comments_url":"https://api.github.com/repos/dunglas/client-generator/comments{/number}","issue_comment_url":"https://api.github.com/repos/dunglas/client-generator/issues/comments{/number}","contents_url":"https://api.github.com/repos/dunglas/client-generator/contents/{+path}","compare_url":"https://api.github.com/repos/dunglas/client-generator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dunglas/client-generator/merges","archive_url":"https://api.github.com/repos/dunglas/client-generator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dunglas/client-generator/downloads","issues_url":"https://api.github.com/repos/dunglas/client-generator/issues{/number}","pulls_url":"https://api.github.com/repos/dunglas/client-generator/pulls{/number}","milestones_url":"https://api.github.com/repos/dunglas/client-generator/milestones{/number}","notifications_url":"https://api.github.com/repos/dunglas/client-generator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dunglas/client-generator/labels{/name}","releases_url":"https://api.github.com/repos/dunglas/client-generator/releases{/id}","deployments_url":"https://api.github.com/repos/dunglas/client-generator/deployments","created_at":"2017-09-19T07:02:18Z","updated_at":"2017-09-19T07:02:19Z","pushed_at":"2017-10-05T08:12:56Z","git_url":"git://github.com/dunglas/client-generator.git","ssh_url":"git@github.com:dunglas/client-generator.git","clone_url":"https://github.com/dunglas/client-generator.git","svn_url":"https://github.com/dunglas/client-generator","homepage":null,"size":174,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"api-platform:master","ref":"master","sha":"00ef34d06fccd59870aca788de958505f1d15db8","user":{"login":"api-platform","id":13420081,"avatar_url":"https://avatars3.githubusercontent.com/u/13420081?v=4","gravatar_id":"","url":"https://api.github.com/users/api-platform","html_url":"https://github.com/api-platform","followers_url":"https://api.github.com/users/api-platform/followers","following_url":"https://api.github.com/users/api-platform/following{/other_user}","gists_url":"https://api.github.com/users/api-platform/gists{/gist_id}","starred_url":"https://api.github.com/users/api-platform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/api-platform/subscriptions","organizations_url":"https://api.github.com/users/api-platform/orgs","repos_url":"https://api.github.com/users/api-platform/repos","events_url":"https://api.github.com/users/api-platform/events{/privacy}","received_events_url":"https://api.github.com/users/api-platform/received_events","type":"Organization","site_admin":false},"repo":{"id":86353315,"name":"client-generator","full_name":"api-platform/client-generator","owner":{"login":"api-platform","id":13420081,"avatar_url":"https://avatars3.githubusercontent.com/u/13420081?v=4","gravatar_id":"","url":"https://api.github.com/users/api-platform","html_url":"https://github.com/api-platform","followers_url":"https://api.github.com/users/api-platform/followers","following_url":"https://api.github.com/users/api-platform/following{/other_user}","gists_url":"https://api.github.com/users/api-platform/gists{/gist_id}","starred_url":"https://api.github.com/users/api-platform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/api-platform/subscriptions","organizations_url":"https://api.github.com/users/api-platform/orgs","repos_url":"https://api.github.com/users/api-platform/repos","events_url":"https://api.github.com/users/api-platform/events{/privacy}","received_events_url":"https://api.github.com/users/api-platform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/api-platform/client-generator","description":"Generate a CRUD application built with React, Redux and React Router from an Hydra-enabled API","fork":false,"url":"https://api.github.com/repos/api-platform/client-generator","forks_url":"https://api.github.com/repos/api-platform/client-generator/forks","keys_url":"https://api.github.com/repos/api-platform/client-generator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/api-platform/client-generator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/api-platform/client-generator/teams","hooks_url":"https://api.github.com/repos/api-platform/client-generator/hooks","issue_events_url":"https://api.github.com/repos/api-platform/client-generator/issues/events{/number}","events_url":"https://api.github.com/repos/api-platform/client-generator/events","assignees_url":"https://api.github.com/repos/api-platform/client-generator/assignees{/user}","branches_url":"https://api.github.com/repos/api-platform/client-generator/branches{/branch}","tags_url":"https://api.github.com/repos/api-platform/client-generator/tags","blobs_url":"https://api.github.com/repos/api-platform/client-generator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/api-platform/client-generator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/api-platform/client-generator/git/refs{/sha}","trees_url":"https://api.github.com/repos/api-platform/client-generator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/api-platform/client-generator/statuses/{sha}","languages_url":"https://api.github.com/repos/api-platform/client-generator/languages","stargazers_url":"https://api.github.com/repos/api-platform/client-generator/stargazers","contributors_url":"https://api.github.com/repos/api-platform/client-generator/contributors","subscribers_url":"https://api.github.com/repos/api-platform/client-generator/subscribers","subscription_url":"https://api.github.com/repos/api-platform/client-generator/subscription","commits_url":"https://api.github.com/repos/api-platform/client-generator/commits{/sha}","git_commits_url":"https://api.github.com/repos/api-platform/client-generator/git/commits{/sha}","comments_url":"https://api.github.com/repos/api-platform/client-generator/comments{/number}","issue_comment_url":"https://api.github.com/repos/api-platform/client-generator/issues/comments{/number}","contents_url":"https://api.github.com/repos/api-platform/client-generator/contents/{+path}","compare_url":"https://api.github.com/repos/api-platform/client-generator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/api-platform/client-generator/merges","archive_url":"https://api.github.com/repos/api-platform/client-generator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/api-platform/client-generator/downloads","issues_url":"https://api.github.com/repos/api-platform/client-generator/issues{/number}","pulls_url":"https://api.github.com/repos/api-platform/client-generator/pulls{/number}","milestones_url":"https://api.github.com/repos/api-platform/client-generator/milestones{/number}","notifications_url":"https://api.github.com/repos/api-platform/client-generator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/api-platform/client-generator/labels{/name}","releases_url":"https://api.github.com/repos/api-platform/client-generator/releases{/id}","deployments_url":"https://api.github.com/repos/api-platform/client-generator/deployments","created_at":"2017-03-27T15:38:03Z","updated_at":"2017-09-25T10:15:42Z","pushed_at":"2017-10-05T08:16:20Z","git_url":"git://github.com/api-platform/client-generator.git","ssh_url":"git@github.com:api-platform/client-generator.git","clone_url":"https://github.com/api-platform/client-generator.git","svn_url":"https://github.com/api-platform/client-generator","homepage":null,"size":168,"stargazers_count":46,"watchers_count":46,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":6,"forks":15,"open_issues":6,"watchers":46,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/api-platform/client-generator/pulls/42"},"html":{"href":"https://github.com/api-platform/client-generator/pull/42"},"issue":{"href":"https://api.github.com/repos/api-platform/client-generator/issues/42"},"comments":{"href":"https://api.github.com/repos/api-platform/client-generator/issues/42/comments"},"review_comments":{"href":"https://api.github.com/repos/api-platform/client-generator/pulls/42/comments"},"review_comment":{"href":"https://api.github.com/repos/api-platform/client-generator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/api-platform/client-generator/pulls/42/commits"},"statuses":{"href":"https://api.github.com/repos/api-platform/client-generator/statuses/875e88ac87bf6c2ba8467b967b77e02a4e0a0b2d"}},"author_association":"OWNER"}}
{"actor":{"display_login":"dunglas"}}