{"action":"created","comment":{"url":"https://api.github.com/repos/contiamo/operational-scripts/pulls/comments/226291561","pull_request_review_id":166075830,"id":226291561,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNjI5MTU2MQ==","diff_hunk":"@@ -70,6 +70,27 @@ const installStaticFiles = (packageRoot, task) => {\n   }\n };\n \n+/**\n+ * Replace a script inside `package.json` if it doesn't contain the expected default script.\n+ * This ensures that users can add script snippets representing custom needs inside these scripts\n+ * without having their changes overridden on installation. If the default script is not contained, however,\n+ * it is inserted with everything else removed.\n+ * This method mutates the `packageJson` argument passed in.\n+ */\n+const replaceScripts = (scripts, packageJson) => {\n+  Object.keys(scripts).forEach(scriptName => {","path":"install.js","position":12,"original_position":12,"commit_id":"55548c88c5698aa9e98c0417d050b08221bee909","original_commit_id":"55548c88c5698aa9e98c0417d050b08221bee909","user":{"login":"peterszerzo","id":6738398,"node_id":"MDQ6VXNlcjY3MzgzOTg=","avatar_url":"https://avatars1.githubusercontent.com/u/6738398?v=4","gravatar_id":"","url":"https://api.github.com/users/peterszerzo","html_url":"https://github.com/peterszerzo","followers_url":"https://api.github.com/users/peterszerzo/followers","following_url":"https://api.github.com/users/peterszerzo/following{/other_user}","gists_url":"https://api.github.com/users/peterszerzo/gists{/gist_id}","starred_url":"https://api.github.com/users/peterszerzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterszerzo/subscriptions","organizations_url":"https://api.github.com/users/peterszerzo/orgs","repos_url":"https://api.github.com/users/peterszerzo/repos","events_url":"https://api.github.com/users/peterszerzo/events{/privacy}","received_events_url":"https://api.github.com/users/peterszerzo/received_events","type":"User","site_admin":false},"body":"The only reason I can think of is habit - I'll replace with `Object.entries`","created_at":"2018-10-18T12:52:32Z","updated_at":"2018-10-18T12:52:32Z","html_url":"https://github.com/contiamo/operational-scripts/pull/24#discussion_r226291561","pull_request_url":"https://api.github.com/repos/contiamo/operational-scripts/pulls/24","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/contiamo/operational-scripts/pulls/comments/226291561"},"html":{"href":"https://github.com/contiamo/operational-scripts/pull/24#discussion_r226291561"},"pull_request":{"href":"https://api.github.com/repos/contiamo/operational-scripts/pulls/24"}},"in_reply_to_id":226289806},"pull_request":{"url":"https://api.github.com/repos/contiamo/operational-scripts/pulls/24","id":223220431,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIzMjIwNDMx","html_url":"https://github.com/contiamo/operational-scripts/pull/24","diff_url":"https://github.com/contiamo/operational-scripts/pull/24.diff","patch_url":"https://github.com/contiamo/operational-scripts/pull/24.patch","issue_url":"https://api.github.com/repos/contiamo/operational-scripts/issues/24","number":24,"state":"open","locked":false,"title":"Only override npm scripts if they do not contain defaults","user":{"login":"peterszerzo","id":6738398,"node_id":"MDQ6VXNlcjY3MzgzOTg=","avatar_url":"https://avatars1.githubusercontent.com/u/6738398?v=4","gravatar_id":"","url":"https://api.github.com/users/peterszerzo","html_url":"https://github.com/peterszerzo","followers_url":"https://api.github.com/users/peterszerzo/followers","following_url":"https://api.github.com/users/peterszerzo/following{/other_user}","gists_url":"https://api.github.com/users/peterszerzo/gists{/gist_id}","starred_url":"https://api.github.com/users/peterszerzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterszerzo/subscriptions","organizations_url":"https://api.github.com/users/peterszerzo/orgs","repos_url":"https://api.github.com/users/peterszerzo/repos","events_url":"https://api.github.com/users/peterszerzo/events{/privacy}","received_events_url":"https://api.github.com/users/peterszerzo/received_events","type":"User","site_admin":false},"body":"# Why\r\n\r\nThis PR makes it so that scripts are only overridden if they do not contain the defaults mandated by `operational-scripts`. Users can then add additional commands without them being overridden on install. Fixes #18.\r\n\r\n# In this PR\r\n\r\nThis unobtrusive script override is implemented for `start`, `build`, `prepublishOnly` and `test`.\r\n\r\n# How to Test / Please try to break\r\n\r\nUnit test coming soon\r\n","created_at":"2018-10-16T11:54:18Z","updated_at":"2018-10-18T12:52:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"815b51995622e4cc6c3f22c221c3df244303c997","assignee":null,"assignees":[],"requested_reviewers":[{"login":"fabien0102","id":1761469,"node_id":"MDQ6VXNlcjE3NjE0Njk=","avatar_url":"https://avatars1.githubusercontent.com/u/1761469?v=4","gravatar_id":"","url":"https://api.github.com/users/fabien0102","html_url":"https://github.com/fabien0102","followers_url":"https://api.github.com/users/fabien0102/followers","following_url":"https://api.github.com/users/fabien0102/following{/other_user}","gists_url":"https://api.github.com/users/fabien0102/gists{/gist_id}","starred_url":"https://api.github.com/users/fabien0102/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabien0102/subscriptions","organizations_url":"https://api.github.com/users/fabien0102/orgs","repos_url":"https://api.github.com/users/fabien0102/repos","events_url":"https://api.github.com/users/fabien0102/events{/privacy}","received_events_url":"https://api.github.com/users/fabien0102/received_events","type":"User","site_admin":false},{"login":"ImogenF","id":14272822,"node_id":"MDQ6VXNlcjE0MjcyODIy","avatar_url":"https://avatars0.githubusercontent.com/u/14272822?v=4","gravatar_id":"","url":"https://api.github.com/users/ImogenF","html_url":"https://github.com/ImogenF","followers_url":"https://api.github.com/users/ImogenF/followers","following_url":"https://api.github.com/users/ImogenF/following{/other_user}","gists_url":"https://api.github.com/users/ImogenF/gists{/gist_id}","starred_url":"https://api.github.com/users/ImogenF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ImogenF/subscriptions","organizations_url":"https://api.github.com/users/ImogenF/orgs","repos_url":"https://api.github.com/users/ImogenF/repos","events_url":"https://api.github.com/users/ImogenF/events{/privacy}","received_events_url":"https://api.github.com/users/ImogenF/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/contiamo/operational-scripts/pulls/24/commits","review_comments_url":"https://api.github.com/repos/contiamo/operational-scripts/pulls/24/comments","review_comment_url":"https://api.github.com/repos/contiamo/operational-scripts/pulls/comments{/number}","comments_url":"https://api.github.com/repos/contiamo/operational-scripts/issues/24/comments","statuses_url":"https://api.github.com/repos/contiamo/operational-scripts/statuses/55548c88c5698aa9e98c0417d050b08221bee909","head":{"label":"contiamo:fix/unobtrusive-script-rewrite","ref":"fix/unobtrusive-script-rewrite","sha":"55548c88c5698aa9e98c0417d050b08221bee909","user":{"login":"contiamo","id":862286,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg2MjI4Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/862286?v=4","gravatar_id":"","url":"https://api.github.com/users/contiamo","html_url":"https://github.com/contiamo","followers_url":"https://api.github.com/users/contiamo/followers","following_url":"https://api.github.com/users/contiamo/following{/other_user}","gists_url":"https://api.github.com/users/contiamo/gists{/gist_id}","starred_url":"https://api.github.com/users/contiamo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/contiamo/subscriptions","organizations_url":"https://api.github.com/users/contiamo/orgs","repos_url":"https://api.github.com/users/contiamo/repos","events_url":"https://api.github.com/users/contiamo/events{/privacy}","received_events_url":"https://api.github.com/users/contiamo/received_events","type":"Organization","site_admin":false},"repo":{"id":145847645,"node_id":"MDEwOlJlcG9zaXRvcnkxNDU4NDc2NDU=","name":"operational-scripts","full_name":"contiamo/operational-scripts","private":false,"owner":{"login":"contiamo","id":862286,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg2MjI4Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/862286?v=4","gravatar_id":"","url":"https://api.github.com/users/contiamo","html_url":"https://github.com/contiamo","followers_url":"https://api.github.com/users/contiamo/followers","following_url":"https://api.github.com/users/contiamo/following{/other_user}","gists_url":"https://api.github.com/users/contiamo/gists{/gist_id}","starred_url":"https://api.github.com/users/contiamo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/contiamo/subscriptions","organizations_url":"https://api.github.com/users/contiamo/orgs","repos_url":"https://api.github.com/users/contiamo/repos","events_url":"https://api.github.com/users/contiamo/events{/privacy}","received_events_url":"https://api.github.com/users/contiamo/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/contiamo/operational-scripts","description":"A TypeScript-first toolchain for developing front-end applications.","fork":false,"url":"https://api.github.com/repos/contiamo/operational-scripts","forks_url":"https://api.github.com/repos/contiamo/operational-scripts/forks","keys_url":"https://api.github.com/repos/contiamo/operational-scripts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/contiamo/operational-scripts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/contiamo/operational-scripts/teams","hooks_url":"https://api.github.com/repos/contiamo/operational-scripts/hooks","issue_events_url":"https://api.github.com/repos/contiamo/operational-scripts/issues/events{/number}","events_url":"https://api.github.com/repos/contiamo/operational-scripts/events","assignees_url":"https://api.github.com/repos/contiamo/operational-scripts/assignees{/user}","branches_url":"https://api.github.com/repos/contiamo/operational-scripts/branches{/branch}","tags_url":"https://api.github.com/repos/contiamo/operational-scripts/tags","blobs_url":"https://api.github.com/repos/contiamo/operational-scripts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/contiamo/operational-scripts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/contiamo/operational-scripts/git/refs{/sha}","trees_url":"https://api.github.com/repos/contiamo/operational-scripts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/contiamo/operational-scripts/statuses/{sha}","languages_url":"https://api.github.com/repos/contiamo/operational-scripts/languages","stargazers_url":"https://api.github.com/repos/contiamo/operational-scripts/stargazers","contributors_url":"https://api.github.com/repos/contiamo/operational-scripts/contributors","subscribers_url":"https://api.github.com/repos/contiamo/operational-scripts/subscribers","subscription_url":"https://api.github.com/repos/contiamo/operational-scripts/subscription","commits_url":"https://api.github.com/repos/contiamo/operational-scripts/commits{/sha}","git_commits_url":"https://api.github.com/repos/contiamo/operational-scripts/git/commits{/sha}","comments_url":"https://api.github.com/repos/contiamo/operational-scripts/comments{/number}","issue_comment_url":"https://api.github.com/repos/contiamo/operational-scripts/issues/comments{/number}","contents_url":"https://api.github.com/repos/contiamo/operational-scripts/contents/{+path}","compare_url":"https://api.github.com/repos/contiamo/operational-scripts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/contiamo/operational-scripts/merges","archive_url":"https://api.github.com/repos/contiamo/operational-scripts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/contiamo/operational-scripts/downloads","issues_url":"https://api.github.com/repos/contiamo/operational-scripts/issues{/number}","pulls_url":"https://api.github.com/repos/contiamo/operational-scripts/pulls{/number}","milestones_url":"https://api.github.com/repos/contiamo/operational-scripts/milestones{/number}","notifications_url":"https://api.github.com/repos/contiamo/operational-scripts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/contiamo/operational-scripts/labels{/name}","releases_url":"https://api.github.com/repos/contiamo/operational-scripts/releases{/id}","deployments_url":"https://api.github.com/repos/contiamo/operational-scripts/deployments","created_at":"2018-08-23T12:02:21Z","updated_at":"2018-09-19T07:49:33Z","pushed_at":"2018-10-16T12:47:51Z","git_url":"git://github.com/contiamo/operational-scripts.git","ssh_url":"git@github.com:contiamo/operational-scripts.git","clone_url":"https://github.com/contiamo/operational-scripts.git","svn_url":"https://github.com/contiamo/operational-scripts","homepage":"","size":139,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":11,"watchers":4,"default_branch":"master"}},"base":{"label":"contiamo:master","ref":"master","sha":"9f45ef358ed37ad8b7ced7640909284d13e285e5","user":{"login":"contiamo","id":862286,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg2MjI4Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/862286?v=4","gravatar_id":"","url":"https://api.github.com/users/contiamo","html_url":"https://github.com/contiamo","followers_url":"https://api.github.com/users/contiamo/followers","following_url":"https://api.github.com/users/contiamo/following{/other_user}","gists_url":"https://api.github.com/users/contiamo/gists{/gist_id}","starred_url":"https://api.github.com/users/contiamo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/contiamo/subscriptions","organizations_url":"https://api.github.com/users/contiamo/orgs","repos_url":"https://api.github.com/users/contiamo/repos","events_url":"https://api.github.com/users/contiamo/events{/privacy}","received_events_url":"https://api.github.com/users/contiamo/received_events","type":"Organization","site_admin":false},"repo":{"id":145847645,"node_id":"MDEwOlJlcG9zaXRvcnkxNDU4NDc2NDU=","name":"operational-scripts","full_name":"contiamo/operational-scripts","private":false,"owner":{"login":"contiamo","id":862286,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg2MjI4Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/862286?v=4","gravatar_id":"","url":"https://api.github.com/users/contiamo","html_url":"https://github.com/contiamo","followers_url":"https://api.github.com/users/contiamo/followers","following_url":"https://api.github.com/users/contiamo/following{/other_user}","gists_url":"https://api.github.com/users/contiamo/gists{/gist_id}","starred_url":"https://api.github.com/users/contiamo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/contiamo/subscriptions","organizations_url":"https://api.github.com/users/contiamo/orgs","repos_url":"https://api.github.com/users/contiamo/repos","events_url":"https://api.github.com/users/contiamo/events{/privacy}","received_events_url":"https://api.github.com/users/contiamo/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/contiamo/operational-scripts","description":"A TypeScript-first toolchain for developing front-end applications.","fork":false,"url":"https://api.github.com/repos/contiamo/operational-scripts","forks_url":"https://api.github.com/repos/contiamo/operational-scripts/forks","keys_url":"https://api.github.com/repos/contiamo/operational-scripts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/contiamo/operational-scripts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/contiamo/operational-scripts/teams","hooks_url":"https://api.github.com/repos/contiamo/operational-scripts/hooks","issue_events_url":"https://api.github.com/repos/contiamo/operational-scripts/issues/events{/number}","events_url":"https://api.github.com/repos/contiamo/operational-scripts/events","assignees_url":"https://api.github.com/repos/contiamo/operational-scripts/assignees{/user}","branches_url":"https://api.github.com/repos/contiamo/operational-scripts/branches{/branch}","tags_url":"https://api.github.com/repos/contiamo/operational-scripts/tags","blobs_url":"https://api.github.com/repos/contiamo/operational-scripts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/contiamo/operational-scripts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/contiamo/operational-scripts/git/refs{/sha}","trees_url":"https://api.github.com/repos/contiamo/operational-scripts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/contiamo/operational-scripts/statuses/{sha}","languages_url":"https://api.github.com/repos/contiamo/operational-scripts/languages","stargazers_url":"https://api.github.com/repos/contiamo/operational-scripts/stargazers","contributors_url":"https://api.github.com/repos/contiamo/operational-scripts/contributors","subscribers_url":"https://api.github.com/repos/contiamo/operational-scripts/subscribers","subscription_url":"https://api.github.com/repos/contiamo/operational-scripts/subscription","commits_url":"https://api.github.com/repos/contiamo/operational-scripts/commits{/sha}","git_commits_url":"https://api.github.com/repos/contiamo/operational-scripts/git/commits{/sha}","comments_url":"https://api.github.com/repos/contiamo/operational-scripts/comments{/number}","issue_comment_url":"https://api.github.com/repos/contiamo/operational-scripts/issues/comments{/number}","contents_url":"https://api.github.com/repos/contiamo/operational-scripts/contents/{+path}","compare_url":"https://api.github.com/repos/contiamo/operational-scripts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/contiamo/operational-scripts/merges","archive_url":"https://api.github.com/repos/contiamo/operational-scripts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/contiamo/operational-scripts/downloads","issues_url":"https://api.github.com/repos/contiamo/operational-scripts/issues{/number}","pulls_url":"https://api.github.com/repos/contiamo/operational-scripts/pulls{/number}","milestones_url":"https://api.github.com/repos/contiamo/operational-scripts/milestones{/number}","notifications_url":"https://api.github.com/repos/contiamo/operational-scripts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/contiamo/operational-scripts/labels{/name}","releases_url":"https://api.github.com/repos/contiamo/operational-scripts/releases{/id}","deployments_url":"https://api.github.com/repos/contiamo/operational-scripts/deployments","created_at":"2018-08-23T12:02:21Z","updated_at":"2018-09-19T07:49:33Z","pushed_at":"2018-10-16T12:47:51Z","git_url":"git://github.com/contiamo/operational-scripts.git","ssh_url":"git@github.com:contiamo/operational-scripts.git","clone_url":"https://github.com/contiamo/operational-scripts.git","svn_url":"https://github.com/contiamo/operational-scripts","homepage":"","size":139,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":11,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/contiamo/operational-scripts/pulls/24"},"html":{"href":"https://github.com/contiamo/operational-scripts/pull/24"},"issue":{"href":"https://api.github.com/repos/contiamo/operational-scripts/issues/24"},"comments":{"href":"https://api.github.com/repos/contiamo/operational-scripts/issues/24/comments"},"review_comments":{"href":"https://api.github.com/repos/contiamo/operational-scripts/pulls/24/comments"},"review_comment":{"href":"https://api.github.com/repos/contiamo/operational-scripts/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/contiamo/operational-scripts/pulls/24/commits"},"statuses":{"href":"https://api.github.com/repos/contiamo/operational-scripts/statuses/55548c88c5698aa9e98c0417d050b08221bee909"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"peterszerzo"}}